Download MetaTrader 5

Problem with using indicator in EA

To add comments, please log in or register
Having questions to the author of an article? Discuss them on the Forum!
tob2011 2015.02.08 16:32 

Dear all,

I have an indicator named "ma_bar".

when I use it in another indicator using iCustom(NULL,0,"ma_bar",0,i) (e.g. a[i] = iCustom(NULL,0,"ma_bar",0,i); ), it works properly.

however, when I use it in an EA using  iCustom(NULL,0,"ma_bar",0,1) (e.g. if( iCustom(NULL,0,"ma_bar",0,1) > 0.1 ) ) , it returns 0.0000 values at every ontick loop in backtesting when I use Print command to check  (Print(DoubleToStr(iCustom(NULL,0,"ma_bar",0,1),Digits)), (what make me mad is, in backtesting, the chart added the indicator successfully and showed value of every bar correctly!)

I have tried to create an variable (double c1) to store the value and use c1 to make calculation but it still didn't work.

does anyone know why?



whroeder1 2015.02.08 22:12  
tob2011: does anyone know why?
What you're saying makes no sense. Don't tell us what you're doing, post the code. (iCustom and indicator.)
To add comments, please log in or register