Get all Open Positions

Created at 25 Sep 2022, 10:43
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!
CT

ctid3999979

Joined 05.07.2021

Get all Open Positions
25 Sep 2022, 10:43


Hi

Reading through the API Reference, the Positions.FindAll() method requires a label to search for.

The bot that I'm making executes orders with the label determined by the candlestick pattern. So if the order is executed because it's a shooting star, the label will be "Shooting Star". I'm doing this to do analysis on each position type in Pandas. This obviously means, I don't know what label to look for as I need to know what labels my orders have. So is there a way I can simply list all open positions, store those in a variable and loop over them to check for the condition I want to perform?

I essentially want to move my SL to 1pip in profit once price has moved 75% to my TP in roughly the same way you can do in cTrader itself by protecting the position.


@ctid3999979
Replies

PanagiotisCharalampous
26 Sep 2022, 10:52

Hi there,

Just use Positions :) It's a collection.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

ctid3999979
26 Sep 2022, 11:55

RE:

PanagiotisCharalampous said:

Hi there,

Just use Positions :) It's a collection.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook

Damn it. Hahaha

Cheers :)


@ctid3999979