I created a variable
double StopLossLong = Math.Min(value1, value2)
double StopLossShort = Math.Max(value1, value2)
then
if (Position.MarketPosition == MarketPosition.Long)
{
SetStopLoss(CalculationMode.Price, StopLossLong);
}
if (Position.MarketPosition == MarketPosition.Short)
{
SetStopLoss(CalculationMode.Price, StopLossShort);
}
Then I printed out the values:
Print(Time[0] + " " + Close[0] + " " + value1Long + " " + value2Long + " " + StopLossLong + " " + value1Short + " " + value2Short+ " " + StopLossShort);
If you compare the picture and the log attached (for AUDJPY, but it applies to all pairs) you will see
12/4/2008 2:30:00 AM Entered internal PlaceOrder() method at 12/4/2008 2:30:00 AM: Action=SellShort OrderType=Market Quantity=25,000 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
12/4/2008 3:00:00 AM 60.59 59.31 59.31 59.31 60.79 60.56 60.79
NT went short at 2:30 AM and the StopLossShort is 60.79.
Yet, as you can see in my chart, the Stop Loss kicks in at 60.56! Why does this happen?
Thank you

Comment