MA cross over instances
-
Hi coders.
I am using a simple MA cross-over strategy, but I want to check how many times the cross over occurred in the past , if the instances were more then twice. I take action.
See the picture below

-
I assume this is the crash index, can't trade in the UK, but this was exactly my plan to use, which was just to open on the cross and then close long before the drop. If you set up every time a cross happens to add 1 into a variable, reset it to 0 when needed, and you will get what you need.
-
@jstap Thank you bro, Ill try that now I'll get back when i get stuck with variables
-
@jstap can you please show an example to save the cross in a variable
-
I have this block that checks the cross-over, how to add a variable that counts the number of times the cross-over has occurred

-
Like this, the numbers will count from left to right: https://fxdreema.com/shared/7yaezRs5d
-
Thankyou so much
-
I see it counts the total crosses from the left and adds on the recent crosses. I guess I'll have to reset the count to count when the price is below 50 MA, then reset when price goes above 50 MA then recounts again when the cross happens below 50 MA
-
Yes, the principle is the same, set up a separate tree, and when a X< happens reset the existing variable (modify variables) to 0.