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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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?
tobwil