Check if last trade was buy or sell condition

Created at 24 Jun 2022, 21:16
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!
IS

isabakas

Joined 25.11.2021

Check if last trade was buy or sell condition
24 Jun 2022, 21:16


Hi all, how would one code the following entry condition? The cbot can only enter a new buy position, if the last trade it took was a sell position. And vice versa.

Thx


@isabakas
Replies

PanagiotisCharalampous
27 Jun 2022, 12:20

Hi isabakas,

You can try something like this

            if (History.Last().TradeType == TradeType.Sell)
            { }

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous