alter positions only from a certain symbol

Created at 20 Aug 2018, 14:02
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!
swingfish's avatar

swingfish

Joined 25.06.2016

alter positions only from a certain symbol
20 Aug 2018, 14:02


i use 

foreach (vat position in Positions) 

to loop trough positions and execute on them.

 

is there a api based way to filter the positions by a certain Symbol only ? 

 

so the cAlgo would just edit/close/open posiitons on the selected Symbol and leave anything else alone ? 

 


@swingfish
Replies

PanagiotisCharalampous
20 Aug 2018, 14:07

Hi swingfish,

Here it is

            foreach (var position in Positions.Where(x => x.SymbolCode == Symbol.Code))
            {
            }

 


@PanagiotisCharalampous

swingfish
20 Aug 2018, 14:09

HOLY ! thats simple .. i use old fashion C# lists to solve that one ... 

thats alot more easy, thanks alot 

 

 


@swingfish