I have a strange problem. I want my condition to be true if a moving average goes flat (sideways). So i have something like:
1
2
3
4
5
6
7
oncei=0
ifema=ema[1]then
i=i+1
endif
graphemaas"ema"
graphema[1]as"ema[1]"
graphias"i"
When i run the code the condition obviously never comes true since i remains zero all the time. Anyway when i look at the graphed variables the backtest shows many periods when ema=ema[1]. How can this be? Is that maybe that PRT intern calculates the emas with more than 5 digits and then cuts off the last digits when graphing them? This way there is a tiny difference between ema and ema[1] though graph shows the same value for them?
This takes me to the question, with how many digits behind the comma is PRT calculating?
Obviously there is a problem with hidden digits. PRT shows 5 digits but internally it must calculate with more digits. Does anybody know with how many?
I your assumption might be possible for very low TF’s, say 1 minute or lower, I think it would be extremely odd to have EMA’s matching the first 5 digits in a, say, 4-hour TF!
I was using 5 minute TF. And it is definitely th case with some hidden digits. When you graph the variables it comes back sometimes as “0” and sometimes as “-0.00” so obviously there is something going on one doesnt see (again!).
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue