indicator results for position

Created at 08 Dec 2023, 02:20
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
WI

Winmillion

Joined 20.07.2022

indicator results for position
08 Dec 2023, 02:20


i have a function with positions :

foreach (var position in Positions){….

is there a way to get indicator data for said position? like ATR?

eg i would like to get the Indicators.AverageTrueRange(….); but for the current position in the loop not the current opened chart?


@Winmillion
Replies

Winmillion
08 Dec 2023, 02:21

Bars bars = MarketData.GetBars(TimeFrame.Daily, position.SymbolName);
ATR = Indicators.AverageTrueRange(bars, 14, MovingAverageType.Simple);


found the above to work


@Winmillion