Is there "Crosses" condition in Rule Manager?

Post Reply
Tomasz Kot
Posts: 18
Joined: Sun Dec 18, 2022 8:09 pm

Is there "Crosses" condition in Rule Manager?

Post by Tomasz Kot »

Is there an option in the Rule Manager to do an action when one EMA crossess another EMA (ideally differentiating cross "from top" and cross "from bottom")?
NakedMarkets
Posts: 20
Joined: Tue Feb 22, 2022 11:06 am

Re: Is there "Crosses" condition in Rule Manager?

Post by NakedMarkets »

At the moment, there is no rule dedicated to crosses conditions but it can be done by defining the following rule.
As an example, we'd like to set a condition to pause the backtest when the SMA 20 (below) crosses the SMA 50 (above).

Here is the related core rule :

[Indicator Value SMA 20 (position 0)] < [Indicator Value SMA 50 (position 0)] AND [Indicator Value SMA 20 (position 1)] > [Indicator Value SMA 50 (position 1)]
Since you compare the value between the last bar and the previous last bar positions, you can check if the SMA cross occurs.

And you can reverse the SMA indicator values, if you want to catch the conditions "from top" :
[Indicator Value SMA 50 (position 0)] < [Indicator Value SMA 20 (position 0)] AND [Indicator Value SMA 50 (position 1)] > [Indicator Value SMA 20 (position 1)]
Tomasz Kot
Posts: 18
Joined: Sun Dec 18, 2022 8:09 pm

Re: Is there "Crosses" condition in Rule Manager?

Post by Tomasz Kot »

Thank you for the solution!

If in the future updates there could be condition of crossing it would make it even simplier, so I think it could be a nice addition. :)
Post Reply