I wanted to check with you guys if you can help me with a function that I can call to check if previous 10 candles is not touching my SMA(18) as I want to use it as another filter for the EA that I am working on something like below:
Start with writing down, what you see in the chart. If you are shure you have all details (what is with gaps) pack all in a algorith and then you can start with coding.
If you have worked it out on a paper, you can compare it with your code.
I would have coded it otherwise, but i don't know what you want.
But if you prefer thinking and writing code at the same time, learn to use a debugger or print your variables.
There is not only a debugger, there also is some information in the manual.
Hi WhRoeder, thanks so much for responding I appreciate it. Below is my response. Will try to check the buttons thanks! And thanks in advance for bothering to understand me more I super appreciate it
Refine your requirement.
A) not touching the SMA, & B) Above or below the current value of the SMA. B is what your code does.
I need to assign a variable that checks for "noise" meaning if a price crosses above the sma I will only open a long position if the last 10 candles did not touch the sma
The other way around for short position, when it crosses the sma downwards I will only open a short position if the past 10 candles did not touch my SMA
Thanks for pointing me to the debugger, I found whats causing it not to work, I have declared my variables as INT instead of double good thing you showed me the debug function thanks so much!!