Conditions within a range of bars
2 replies
Conmariin
6 years ago #201990
Hi,
I don’t know how to check some conditions if they happened in a specific range of bars.
I have 3 EMA conditions with different values and they don’t cross all at the same time. So how can I verify this?
Or is it possible to check if a crossing already happened in the past when I check the next condition?
For example: Price must be above EMA 50 and EMA 100 and EMA 5 must cross below EMA 15 before
Thanks for any help! 🙂
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
tomas262
6 years ago #202019
Hello,
you can setup a variable called “crossHappened” and set it to 0. Once the cross occurs you can set this variable to 1. You can then use this variable value for your next condition on trading decision. Once you enter your position you set the variable value back to 0. Let me know if you need an example on this
Conmariin
6 years ago #202029
Aaah…thank you tomas for your idea! 🙂
I will try it on my own.
Thanks for your tremendous support! 🙂 *thumbs up*
Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de
Viewing 2 replies - 1 through 2 (of 2 total)