COCO研究院

 找回密碼
 註冊
搜索
查看: 2210|回復: 1

新手一問, 如果想連續虧損2次就暫停30分鐘

[複製鏈接]
發表於 21-4-5 15:03 | 顯示全部樓層 |閱讀模式
我想如果連續虧損2次就暫停30分鐘,之後再讓程式開動
不知道寫錯什麼,求高手指教,謝謝

vars: stoptrade30min (false);

if date<>date[1] then stoptrade30min=false;
if marketposition = 0 then begin
         if condition4 and condition6 then begin
         buy next bar at market;
         end;

          if condition5 and condition6 then begin
        sellshort next bar at market;
        end;
end;

if marketposition <> 0 then begin
        if close>average(close,20) then begin
        sell next bar at market;
        end;
        if  close<average(close,20) then begin
        buytocover next bar at market;
        end;
end;

if positionprofit(1) <0 and positionprofit(2) <0 then begin
stoptrade30min = true ;
if stoptrade30min = true then begin
if barssinceexit(1)>=30 or totaltrades = 0 then begin
      if condition4 and condition6 then begin
      buy next bar at market;
      end;

      if condition5 and condition6 then begin
      sellshort next bar at market;
      end;
end;
if marketposition <> 0 then begin
        if  close>average(close,20) then begin
        sell next bar at market;
        end;
       
        if  close<average(close,20) then begin
        buytocover next bar at market;
        end;
end;
end;

if positionprofit(1)>0  then begin
if stoptrade30min= false then begin
if marketposition = 0 then begin
      if condition4 and condition6 then begin
      buy next bar at market;
     end;

      if condition5 and condition6 then begin
      sellshort next bar at market;
      end;
end;
if marketposition <> 0 then begin
        if  close>average(close,20) then begin
        sell next bar at market;
        end;
       
        if  close<average(close,20) then begin
        buytocover next bar at market;
        end;
end;
end;
end;
end;


發表於 21-4-7 11:14 | 顯示全部樓層
stoptrade30min值沒有重置
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

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

GMT+8, 24-11-25 02:03

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |