A few minutes ago I replaced the iCustom Juice call with a iStdDev (=Juice?) one, and got the appropriate values. So it seems that I am not addressing Juice right, but what is my mistake?
A few minutes ago I replaced the iCustom Juice call with a iStdDev (=Juice?) one, and got the appropriate values. So it seems that I am not addressing Juice right, but what is my mistake?
Juice have 2 parameters. Look at the code
extern int Periyod=7;
extern double Level=0.0004;
and two buffers
#property indicator_buffers 2
So u have to pass the parameters to the iCustome command
double J1 = iCustome(NULL,0, "Juice", 7, 0.0004, 0, 0);
the above command will return the first buffer value from the current bar
Hope it will help
Eli
Thank you for replying! I just found out what I should do - read the value with shift=1, as during the backtesting the shift=0 value sometimes varies too quickly with a very large amplitude. Again, thanks a lot!
Hi
I created an indicator in mql4. It simply draws High point of any candle. But when I take backtest, result is like Close point!
And when I compile the same code again, chart fixes!
Can anyone tell me what the problem is?
Thanks alot
#property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 clrBlue #property indicator_color1 clrRed //----------------------------------------------------------- double line1[]; //----------------------------------------------------------- int OnInit() { SetIndexBuffer(0, line1); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1); return(INIT_SUCCEEDED); } //----------------------------------------------------------- int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { for(int i=rates_total-prev_calculated-1;i>=0;i--) { double a=High[i]; line1[i]= a; } return(rates_total); } //-----------------------------------------------------------
-
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
-
for(int i=rates_total-prev_calculated-1;i>=0;i--) { double a=High[i];
First run (or after refresh,) prev_calculated is zero, so you run [rates_total-1 … 0], no problem. After that it is rates_total (what you returned) so you try to run starting at rates_total - rates_total - 1 which is minus one, you do nothing.
See How to do your lookbacks correctly #9 … #14 & #19.
-
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
-
First run prev_calculated is zero, so you run [rates_total-1 … 0], no problem. After that it is rates_total (what you returned) so you try to run starting at rates_total - rates_total - 1 which is minus one, you do nothing.
See How to do your lookbacks correctly #9 … #14 & #19.
1. I thought my problem is same.
2. Thanks a lot.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello. I have been struggling with this matter for two days now, and can't seem to find of any solution about it.
No matter what I do, the values that I get from any custom indicator during backtesting of EA are always totally different from what appears on the charts. I have updated the M1 historical data from Alpari, etc.. Here is the function that I am using:
init(){
if (LocalTime()>StrToTime("7:30")&&LocalTime()<StrToTime("7:45")){
Print(DoubleToStr(iCustom(NULL,PERIOD_M5,"Juice",0,0),8));
}
}
Running the EA on M5 timeframe.
Here is a piece of the results:
2006.06.03 19:21:21 2006.06.02 07:34 ICustomTest EURUSD,M5: 0.00000000
2006.06.03 19:21:21 2006.06.02 07:34 ICustomTest EURUSD,M5: 0.00000000
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00000506
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00000506
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00002318
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00002318
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00000000
2006.06.03 19:21:21 2006.06.02 07:33 ICustomTest EURUSD,M5: 0.00000000
I can clearly see that on the charts Juice shows values as high as 0.0003. Results seem to vary no matter how big values are. I get the same strange results with all custom indicators I've tried so far...
Has anybody encountered such a problem before? I'd be really glad if you let me know what to do.
Thank you in advance!