iMAOnArray () should give me the value of the moving average and save it in the buffer and makes it from left to right while ArraySetAsSeries () from right to left. The problem is that in mql4 does not seem to be a "native" operation mine.
But I saw around someone who succeeds in this intent. In my case the value obtained differs from what appears on the chart.
D
Latest posts made by Deneris
-
RE: EA for indicators applied to Previous dataposted in Questions & Answers
-
EA for indicators applied to Previous dataposted in Questions & Answers
Hi,
I need to get the values of bollinger bands that are built on a mobile medium, which in turn is built on stochastic.
To recap:- Stochastic
- Moving average
- Bollinger bands
That's what I did
double BufferSto[]; //Buffer containing stochastic values double BufferiMaExpSto[]; // Buffer containing the values of the moving average double iBandUpMaExpSto=0.0; // BB Band UPPER double iBandDwMaExpSto=0.0; // BB band DOWN int OnInit() { ArrayResize(BufferSto,STO_KPeriod); ArrayResize(BufferiMaExpSto,IMA_Period); return(INIT_SUCCEEDED); } void OnTick() { if (IsNewBar()){ for(int i=1; i<STO_KPeriod; i++) BufferSto[i-1] = iStochastic(NULL,0,STO_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,i); ArraySetAsSeries(BufferSto, true); for(int i=1; i<IMA_Period; i++) BufferiMaExpSto[i-1] = iMAOnArray(BufferSto,0,IMA_Period,0,MODE_EMA,i); ArraySetAsSeries(BufferiMaExpSto, true); iBandUpMaExpSto = NormalizeDouble(iBandsOnArray(BufferiMaExpSto,0,BBPeriodMaExpSto,BBDevizioneMaExpSto,0,MODE_LOWER,1),Digits); iBandDwMaExpSto = NormalizeDouble(iBandsOnArray(BufferiMaExpSto,0,BBPeriodMaExpSto,BBDevizioneMaExpSto,0,MODE_UPPER,1),Digits); } if(!IsTradingTime()) return; }If I try to print on the video the bandwidth or indicators value I notice that they do not match the values that are on the chart given by the same indicators.
What am I doing wrong?Many thanks in advance
- Stochastic