Need help with changing ATR to show double its value
m-c-f:
I appreciate help with changing the code of the ATR indicator to show double its value. For example if ATR is 30 pips, I want it to show 60. Thanks!
for(i=limit; i<rates_total; i++) { ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]); ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-InpAtrPeriod])/InpAtrPeriod; ExtATRBuffer[i] *= 2; }
Thanks for the reply.
There were no compile errors, but the indicator is not showing any values. The sub window, and the data window are blank. Any ideas? Thanks
m-c-f:
the indicator is not showing any values. The sub window, and the data window are blank.
My mistake. This should do the trick:
ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]); ExtTRBuffer[i] *= 2.; ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodATR;
That did it. Thanks so much! Do you know how to get the new indicator to limit the results to 4 decimal places like the original? It is showing 5. Thanks again.
m-c-f:
That did it. Thanks so much! Do you know how to get the new indicator to limit the results to 4 decimal places like the original? It is showing 5. Thanks again.
That did it. Thanks so much! Do you know how to get the new indicator to limit the results to 4 decimal places like the original? It is showing 5. Thanks again.
Do you mean something like this?
IndicatorSetInteger(INDICATOR_DIGITS,4);
Perfect. It works exactly as I wanted. Thanks for all your help.
I appreciate help with changing the code of the ATR indicator to show double its value. For example if ATR is 30 pips, I want it to show 60. Thanks!
Here is the code: