Martingale cBot default

Created at 12 Dec 2020, 22:40
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!
MA

mario.simonetti29

Joined 29.11.2020

Martingale cBot default
12 Dec 2020, 22:40


Hi,

Regarding the default Martingale cBot, I see that every time a new trade is opened after the take profit, a new random trade is generated.

As the direction of the trade is random (buy/sell), it makes every backtest result different!

Is it possible to add a logic like "after a trade is closed, if gross profit > 0, then buy?


@mario.simonetti29
Replies

PanagiotisCharalampous
14 Dec 2020, 08:37

Hi Mario,

Yes it is. You should change the code as follows

            if (position.GrossProfit > 0)
            {
                ExecuteOrder(InitialQuantity, TradeType.Buy);
            }

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous