if kb==ka then You get zero divide
no
double ka;
double kb;
ka= .05;
kb= .17
the question is if i can divide (ind_buffer2[i]*(1-ka)-ind_buffer3[i]*(1-kb)) by (kb-ka) and plot it.
i mean it doesnt work because i get a result that is not correct
in Amibroker i use the following:
KA=2/13;
KB=2/27;
A=EMA(Close,12);
B=EMA(Close,26);
MACDMOD=A-B;
C1=EMA(MACDMOD,9);
PT=(A*(1-KA)-B*(1-KB)-C1)/(KB-KA);
Plot(PT,"PT",colorGreen,1);
and in metatrade i get a diferent plot
double ka;
double kb;
ka= .05;
kb= .17
the question is if i can divide (ind_buffer2[i]*(1-ka)-ind_buffer3[i]*(1-kb)) by (kb-ka) and plot it.
i mean it doesnt work because i get a result that is not correct
in Amibroker i use the following:
KA=2/13;
KB=2/27;
A=EMA(Close,12);
B=EMA(Close,26);
MACDMOD=A-B;
C1=EMA(MACDMOD,9);
PT=(A*(1-KA)-B*(1-KB)-C1)/(KB-KA);
Plot(PT,"PT",colorGreen,1);
and in metatrade i get a diferent plot
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer2[i+1]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
for(i=0; i<limit; i++)
ind_buffer3[i+1]=iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
for( i=0; i<limit; i++)
ind_buffer4[i+1]=iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
for(i=0; i<limit; i++)
ind_buffer5[i+1]=iMAOnArray(ind_buffer4,Bars,SignalEMA,0,MODE_EMA,i);
//---- main loop
for(i=0; i<limit; i++)
ind_buffer1[i+1]=(ind_buffer2[i]*(1-ka)-ind_buffer3[i]*(1-kb)-ind_buffer5[i])/(kb-ka);
limit=Bars-counted_bars;
//---- macd counted in the 1-st additional buffer
for(int i=0; i<limit; i++)
ind_buffer2[i+1]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
for(i=0; i<limit; i++)
ind_buffer3[i+1]=iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd additional buffer
for( i=0; i<limit; i++)
ind_buffer4[i+1]=iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);
for(i=0; i<limit; i++)
ind_buffer5[i+1]=iMAOnArray(ind_buffer4,Bars,SignalEMA,0,MODE_EMA,i);
//---- main loop
for(i=0; i<limit; i++)
ind_buffer1[i+1]=(ind_buffer2[i]*(1-ka)-ind_buffer3[i]*(1-kb)-ind_buffer5[i])/(kb-ka);
this cannot be done
ind_buffer1[i]=(ind_buffer5[i])/2;
its the same as
ind_buffer1[i]=(ind_buffer5[i])
ind_buffer1[i]=(ind_buffer5[i])/2;
its the same as
ind_buffer1[i]=(ind_buffer5[i])
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
for(i=0; i<limit; i++)
ind_buffer1[i+1]=(ind_buffer2[i]*(1-ka)-ind_buffer3[i]*(1-kb))/(kb-ka);
IS IT CORRECT?