Please edit your post.

FxLogic: I am using 3 in my IMAonArray, and it does not draw the LRI for last 3 bars as you can see in the picture, I will attach code here too.
Play videoPlease edit your post.
For large amounts of code, attach it.
- No code attached.
for (i = btp-1;i>=0;i--){ tmp1[i]=iMA(Symbol(),0,period,0,MODE_SMA,price,i); .. for (i=0;i<btp;i++){ tmp5[i]=iMAOnArray(tmp4,btp,3,0,MAMethod,i);
tmp1 - tmp4 only contain values for indexes [0 ..btp-1] So how do you compute imaOnArray(btp) for btp-1? You don't have that many values (for sma) you don't have 3.45btp values (for ema)

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
Hi I am trying to use existing LRI code and add some smoothing to it, the problem is that the LRI is not drawn after smoothing Periods, I am using 3 in my IMAonArray, and it does not draw the LRI for last 3 bars as you can see in the picture, I will attach code here too.
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red
extern int period=34;
extern int price=0;
extern int MAMethod = 3;
extern int Shift=0;
//---- buffers
double BufferGreen[];
double BufferYellow[];
double BufferRed[];
int limit, tmpBar, tmpTime, counted_bars, i, j,k, barsToProcess=5000, btp;
double tmp1[5000],tmp2[5000],tmp3[5000],tmp4[5000],tmp5[5000],tmp6[5000],tmp7[5000];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
int i;
for (i=0;i<3;i++) {
SetIndexStyle(i,DRAW_LINE);
SetIndexDrawBegin(i,period);
SetIndexShift(i,Shift);
}
SetIndexBuffer(0,BufferYellow);
SetIndexBuffer(1,BufferGreen);
SetIndexBuffer(2,BufferRed);
return(0); }//int init()
//+------------------------------------------------------------------+
int start() {
counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
btp = Bars;
if(btp>barsToProcess) btp=barsToProcess;
//if(limit>0){
for (i = btp-1;i>=0;i--){
tmp1[i]=iMA(Symbol(),0,period,0,MODE_SMA,price,i);
tmp2[i]=iMA(Symbol(),0,period,0,MODE_LWMA,price,i);
tmp4[i]=3.0*tmp2[i]-2.0*tmp1[i];
}
for (i=0;i<btp;i++){
tmp5[i]=iMAOnArray(tmp4,btp,3,0,MAMethod,i);
}
for (i=0;i<btp;i++){
tmp3[i]=iMAOnArray(tmp5,btp,period,0,MAMethod,i);
}
for (i = btp-1;i>=0;i--){
BufferGreen[i] =tmp3[i];
BufferYellow[i]=tmp3[i];
BufferRed[i] =tmp3[i];
if (BufferYellow[i]>BufferYellow[i+1]){
BufferRed[i]=EMPTY_VALUE;
} else if (BufferYellow[i]<BufferYellow[i+1]){
BufferGreen[i] =EMPTY_VALUE;
} else {
BufferRed[i]=EMPTY_VALUE;
BufferGreen[i] =EMPTY_VALUE;
}
}
//}
return(0);
}