Help on extracting data printed from console i.e. (PID) and use it in the same bot

samachua2011 since: 18 Apr 2022;

  23 Sep 2022, 16:49
Help on extracting data printed from console i.e. (PID) and use it in the same bot

Greetings,

I have a bot which has the following condition set to print market position id when it executes a market order.

ExecuteMarketOrder(type, SymbolName, volumeInUnits, Label, SL, TP);
Print(LastResult, Position.Id);

However, we need to call this result on an advanced take profit function within the same bot on the prompt......"if (PositionId == DefaultPositionIdParameterValue)

        protected override void OnStart()
        {
            if (PositionId == DefaultPositionIdParameterValue)
                PrintErrorAndStop("You have to specify \"Position Id\" in cBot Parameters");

Is there a way to retrieve the position id automatically within the bot's functionality for each trade to allow the advanced take profit functionality to work?

Thanks in advance

Best Regards,

Samuel Machua.