Add a second trade if market have moved against one for x pips?

Created at 02 May 2017, 23:20
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!
FR

fredrik

Joined 02.05.2017

Add a second trade if market have moved against one for x pips?
02 May 2017, 23:20


Hi,

trying to create a simple cBot with the origins from the sample RSI template.

How can I add the possibility to add a second trade in the same direction as the original trade if the market have moved agains me for x pips with two times the original size?

Current logic:

        protected override void OnTick()
        {
            if (rsi.Result.LastValue < 30)
            {
                Close(TradeType.Sell);
                Open(TradeType.Buy);
            }
            else if (rsi.Result.LastValue > 70)
            {
                Close(TradeType.Buy);
                Open(TradeType.Sell);
            }
        }

Any help appreciated!

Thx!


@fredrik