1. Time Filter 2. Daily average range
if (Bars != cBars) newBar = true; else newBar = false; cBars = Bars;
This is unsafe. Once Bars reaches Maximum Bars On Chart, the indicator stops working as Bars and cBars will not change.bool newBar = Time0 < Time[0]; Time0 = Time[0];
- The code checking for a symbol/TF change is unnecessary. When that occurs you'll get a deInit() init() cycle.
- Hard coded array size but never checked if exceeded
gTradeID++; ArrayResize(gTradeOpen,gTradeID+1); ArrayResize(gTradeMin,gTradeID+1); ArrayResize(gTradeMax,gTradeID+1); ArrayResize(gTradeCmd,gTradeID+1); ArrayResize(gTradeStart,gTradeID+1); ArrayResize(gTradeEnd,gTradeID+1); gTradeOpen[gTradeID] = price; ...
This indicator has errors when attempting to compile it.
If you manage to fix it please post it in full code post.
Hi Thomas,
I have taken a look at this indicator and the method you used to find the optimised moving average is amazing. I tried tinkering the indicator for the indicator to just output a single optimised MA without any bells and whistle and this is how far I have reached. Can anyone kindly help with this?
https://drive.google.com/open?id=11ow982kViK7RxQkJ5AjVV1PIAlGUfzLs

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Optimize single Moving average trading:
Author: Thomas Quester