Find a specific FX pair rather than ALL Positions

Created at 28 Aug 2021, 06:09
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!
TH

thecaffeinatedtrader

Joined 22.07.2020

Find a specific FX pair rather than ALL Positions
28 Aug 2021, 06:09


When I am running the same bot on multiple FX pairs with different parameters, how am I supposed to have it written in order to find a position in on a specific pair instead of using
"   Positions.FindAll()   "


@thecaffeinatedtrader
Replies

firemyst
29 Aug 2021, 12:13

Use Positions.Find()

//Example code
Position p = Positions.Find(positionLabel);
//or
Position p = Positions.Find(positionLabel, Symbol.Name);
//or
Position p = Positions.Find(positionLabel, Symbol.Name, TradeType);

 


@firemyst