小幫手大大您好
我這程式邏輯只有四個部分
1.多單進場
2.多單停損
3.空單進場
4.空單停損
一般狀況下也沒什麼問題
但偶爾會遇到:當2和3同時達成時,僅有多單被停損,但沒有下空單
說不定日後也有可能遇到:當4和1同時達成時,僅有空單被停損,但沒有下多單
想請問小幫手大大
有沒有指令可以解決
謝謝您
PS. condition 1和2,只是超單純的對稱式策略,cross上下而已
程式碼如下~~~~~~~~~~~~
//多單
if condition1 then SetPosition(3, market);
if filled >= 1 and position >= 1
and close < (filledAvgPrice - 80) //多單停損
then setposition(0, market);
//空單
if condition2 then SetPosition(-1, market);
if filled <= -1 and position <= -1
and close > (filledAvgPrice + 80) //空單停損
then setposition(0, market);
1 評論