我寫了一個策略,回測都可以正常依照我要的進出場點執行
但是實際在跑的時候已經過了進出場點程式都沒反應
請問是怎麼回事呢?
進出場代碼如下:
if position = 0 and long_condition = 1 then SetPosition(1);
if close cross under Average(Close, 20) then exit_long_condition = 1;
if position = 1 and exit_long_condition = 1 then SetPosition(0);
if position = 0 and short_condition = 1 then SetPosition(-1);
if close cross over Average(Close, 20) then exit_short_condition = 1;
if position = -1 and exit_short_condition = 1 then SetPosition(0);
1 評論