COCO研究院

 找回密碼
 註冊
搜索
查看: 2309|回復: 0

翻單功能沒有執行,麻煩大大們幫忙一下

[複製鏈接]
發表於 18-7-13 21:32 | 顯示全部樓層 |閱讀模式
大家好,我剛學了multichart沒多久,打算交易MHI, 但有一些問題不能解決,想麻煩大大們幫忙一下。

我想寫一個可以在虧損50點時作出翻單部位的程式。 交易口數為1口,以下是我的程式碼。

1)我的程式碼通過了editors,但是反手部份
  reversed sell 跟reversed buy 沒有反應,是不是邏輯不對?

2)我有看過一些貼文,如果要反手就不用              
       setstoploss ,那不會危險嗎?有其他停損方法嗎?

感謝

if marketposition = 0 and time_s <=163000 and condition8 then begin

     if condition4 and condition6 and condition2 then begin
     buy("Entrybuy") 1 contract next bar at market;

          end else if marketposition > 0 then begin
          sellshort("reversed sell") 1 contract next bar at PosTradeEntryPrice(0, currentcontracts-1) - 50 stop;
          end;

     if condition5 and condition6 and condition2 then begin
     Sellshort("Entrysell") 1 contract next bar at market;

         end else if marketposition < 0 then begin
         buy ("reversed buy") 1 contract next bar at PosTradeEntryPrice(0, currentcontracts-1) + 50 stop;
         end;
end;     


setstopcontract;
setprofittarget(win);
setstoploss (loss);
setpercenttrailing(percentamount,percentchance);
setexitonclose;
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-5-11 23:43

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 | AI繪圖AI超擬真美女AI beauty AI Stable DiffusionAI正妹AI Lookbook