Some One help me fix this CODE
the problems i face are:
1-suppose the atr value is 0.00589, i want it to be 589.
2-the correct atr value of the current bar never gets returned.
There is a huge problem with iATR or I simple can not use it properly so please teach me
the problems i face are:
1-suppose the atr value is 0.00589, i want it to be 589.
2-the correct atr value of the current bar never gets returned.
There is a huge problem with iATR or I simple can not use it properly so please teach me
Inserted Code
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots 1
#property indicator_type1 DRAW_LINE
#property indicator_style1 STYLE_SOLID
#property indicator_color1 clrBlanchedAlmond
#property indicator_width1 2
double atr_spread[];
input int Y = 100;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0,atr_spread,INDICATOR_DATA);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
for(int i=prev_calculated; i<rates_total; i++)
{
int x =(((iATR(_Symbol,PERIOD_CURRENT,Y))*(10^Digits()) / MODE_SPREAD) -1);
atr_spread[i] = x;
}
return(rates_total);
}
//+------------------------------------------------------------------+