how to get entry price of one positon by symbol in many positions

Created at 04 Dec 2018, 05:31
MI

MinMin

Joined 23.07.2018

how to get entry price of one positon by symbol in many positions
04 Dec 2018, 05:31


Hi team, please help! I want to get the value of entry price of a position by it's symbol. when there are many positions are opening with many symbol too. Thanks so much for your help, Best regards

@MinMin
Replies

PanagiotisCharalampous
04 Dec 2018, 10:13

Hi vancong140293,

You can get all the positions for the symbol that the cBot is running on using the following line of code.

var positions = Positions.Where(x => x.SymbolCode == Symbol.Code);

If there is only one then you can get the entry price with the below

var entryPrice = positions.First().EntryPrice;

Best Regards,

Panagiotis


@PanagiotisCharalampous