How to get current value of a "trailing stop loss"?
How to get current value of a "trailing stop loss"?
26 Mar 2019, 12:47
HI everyone:
Is it possible to obtain the current value of the trailing stop loss in Pips or otherwise after several ticks when it moves?
If so, how?
Thank you :-)
Replies
firemyst
26 Mar 2019, 16:02
Thank you for your reply, but that's not what I meant. :-)
In the "OnTick" method, after I place an order:
ExecuteMarketOrder(TradeType.Buy, Symbol, PositionSize, MyLabel, StopLossInPips, null, null, null, true);
I had an area of code that gets run through if I have at least 1 open position:
if (Positions.Count > 0) { Position position = Positions[0]; Print("Stoploss: {0},", position.StopLoss); }
The value of position.StopLoss never seemed to change, even though I can see the trailing stop loss move on the chart in backtest mode.
However, I've since managed ot figure out my issue - I wasn't looking at the correct times in the log. Doh! :-)
Anyway, I appreciate your response :-)
@firemyst
PanagiotisCharalampous
26 Mar 2019, 14:07
Hi FireMyst,
Thanks for posting in our forum. Here is an example for buy positions
Best Regards,
Panagiotis
@PanagiotisCharalampous