f3n_dy replies to: SilentFathers Trading Ideas


{quote} Very many thanks for looking at this. Unfortunately, even with your amendments I still have one account that I can’t get it to work on. It seems crazy that it will work on some and not others.

Morning all!

I have had a quick look at the code and can see why some folk are having trouble! The whole premise is a bit wrong — the iEnvelopes() function takes as its “dev” argument a PERCENTAGE, not a value. So you need to scale by the actual price. Then you can throw away the code for switching between numbers of “digits” as it is irrelevent, and reduce the whole loop to 3 lines of code.

If you do that, it will work perfectly and you will get identical results on ALL symbols and ALL timeframes. I have tested on:
– FX USD pairs with 4 or 5 digits
– FX JPY pairs with 2 or 3 digits
– Indices/Commodities with 0, 1, or 2 digits etc

All work fine and give consistent results.

And now we can actually see what is going on! Look at the charts below. I have added a normal Keltner channel with the same settings, and the results are essentially identical. On the 5-min there are very slight differences (due to the way Keltner calculates the MA of the ATR) but on the higher timeframes the results are absolutely identical.

So we don’t need to struggle to get the Blue Indy to work – just use Keltner (which you can download anywhere) and you are good to go!

Kind regards,


EDIT ….. and as a bonus, it removes the need for the CPU intensive bar-by-bar Envelopes calculations and lets you switch timeframes instantly. On my laptop the CPU load from the MT4 Terminal dropped from 15% to <1% …


Attached Images (click to enlarge)

Click to Enlarge Name: WTIM5_KELTNER+BLUE.png Size: 44 KB Click to Enlarge Name: WTIH1_KELTNER+BLUE.png Size: 54 KB

Leave a Reply

Your email address will not be published. Required fields are marked *