多單移動停損與移動停利
If (PositionStatus = 1) Then Begin
If StopLossPoint = 0 Then Begin
StopLossPoint = Entry_Price - MaxDrawdown;
End;
If Close > Entry_Price Then Begin
If Close - MaxDrawdown > StopLossPoint Then Begin
StopLossPoint = Close - MaxDrawdown;
End;
End;
If Max_Profit = 0 And Close >= Entry_Price + TakeProfit Then Begin
Max_Profit = Close;
End;
If Max_Profit <> 0 Then Begin
If Close <= Max_Profit - ProfitDrawbackPoint Then Begin
Sell(1);
PositionStatus = 0;
StopLossPoint = 0;
Max_Profit = 0;
End
Else If Close > Max_Profit Then Begin
Max_Profit = Close;
End;
End;
If Close <= StopLossPoint Then Begin
Sell(1);
PositionStatus = 0;
StopLossPoint = 0;
Max_Profit = 0;
End;
End
為什麼我這段程式無法順利執行移動停利
2 評論