This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community
HELP WITH AN INDICATORBack to topics list |
|
PaulDawidowicz
2005.07.08 17:57
I WANT TO DIVIDE DATA IN A BUFFER BUT IT DOESNT WORK
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? |
|
Slawa
2005.07.08 18:05
if kb==ka then You get zero divide
|
|
PaulDawidowicz
2005.07.08 18:25
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 |
|
PaulDawidowicz
2005.07.08 18:28
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); |
|
PaulDawidowicz
2005.07.08 18:47
this cannot be done
ind_buffer1[i]=(ind_buffer5[i])/2; its the same as ind_buffer1[i]=(ind_buffer5[i]) |
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets
