I tried also with this one and the problem remain exactly the same, then, one more times: what's wrong with iCustom ?
//+------------------------------------------------------------------+ //| Shift.mq4 | //| me | //| http://localhost/ | //+------------------------------------------------------------------+ #property copyright "me" #property link "http://localhost/" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_width1 4 #property indicator_width2 4 //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; bool Fact_Up = true; // Fact of report that market.. bool Fact_Dn = true; //..is bullish or bearish //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,241); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,242); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; if(counted_bars<0) return(-1); //limit=Bars-counted_bars; //---- double MA; // MA value on 0 bar double MA2; double MA3; double MA4; //-------------------------------------------------------------------- double value1, value2, value3; for (int i=Bars-1;i>=0;i--) //---- main loop //for(int i=0; i<limit; i++) {value1=0.0; value2=0.0; value3=0.0; //-------------------------------------------------------------------- // Checking if bullish if( (iCustom(Symbol(),NULL,"Laguerre",0,i) > 0.15) && (iCustom(Symbol(),NULL,"Laguerre",0,i+1) < 0.15) && Fact_Up == true && (iCustom(Symbol(),60,"Laguerre",0,i) > 0.75)) { Fact_Dn = true; // Report about bullish market Fact_Up = false; // Don't report bullish market // Alert("BUY SIGNAL."); value1=Open[i]; } //-------------------------------------------------------------------- // Checking if bearish if( (iCustom(Symbol(),NULL,"Laguerre",0,i) < 0.75) && (iCustom(Symbol(),NULL,"Laguerre",0,i+1) > 0.75) && Fact_Dn == true && (iCustom(Symbol(),60,"Laguerre",0,i) < 0.15)) { Fact_Up = true; // Report about bearish market Fact_Dn = false; // Don't report bearish market // Alert("SELL SIGNAL."); value2=Open[i]; } ExtMapBuffer1[i]=value1; ExtMapBuffer2[i]=value2; } //---- return(0); } //+------------------------------------------------------------------+
I think your parameter count is incorrect. there are two inputs, gamma and CountBars missing.
Try this ...
Hope that helps.
V
Thanx but i tried already, same problem... it's driving me nutz
Not sure then, but with the correct paramenter count, it is returning the correct value
int start() { //---- Alert(iCustom(Symbol(),NULL,"Laguerre",0.7,950,0,0)); //---- return(0); }
Perhaps it's something to do with the for loop and i... not sure....
Try evaluating and printing the results outside the loop to make sure it makes sense.
V
Not sure then, but with the correct paramenter count, it is returning the correct value
Perhaps it's something to do with the for loop and i... not sure....
What i really need is the value from H1 !
Again, still works fine...
int start() { //---- Alert(iCustom(Symbol(),NULL,"Laguerre",0.7,950,0,0)); Alert(iCustom(Symbol(),60,"Laguerre",0.7,950,0,0)); //---- return(0); }
Out of interest, have you tried breaking it down and using print to see what values are being returned?
Again, still works fine...
Out of interest, have you tried breaking it down and using print to see what values are being returned?
i'm probably the worst coder on the board... i don't know how to do it. and your code seems return wrong values when i try it.
but maybe if you try my indicator on your MT4 you will find out the problem ? you need only Laguerre.mq4:
Many Thanx for the help
//+------------------------------------------------------------------+ //| Laguerre.mq4 | //| Emerald King | //| mailto:info@emerald-king.com | //+------------------------------------------------------------------+ #property copyright "Emerald King" #property link "mailto:info@emerald-king.com" #property indicator_separate_window #property indicator_color1 Magenta #property indicator_level2 0.75 #property indicator_level3 0.45 #property indicator_level4 0.15 //---- input parameters extern double gamma=0.66; extern int CountBars=9500; double L0 = 0; double L1 = 0; double L2 = 0; double L3 = 0; double L0A = 0; double L1A = 0; double L2A = 0; double L3A = 0; double LRSI = 0; double CU = 0; double CD = 0; double val1[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- SetIndexBuffer(0,val1); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- TODO: add your code here //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if (CountBars>Bars) CountBars=Bars; SetIndexDrawBegin(0,Bars-CountBars); int i; int counted_bars=IndicatorCounted(); //if(CountBars<=Lookback) return(0); //---- initial zero //if(counted_bars<1) //{ // for(i=1;i<=Lookback;i++) val1[CountBars-i]=0.0; //} i=CountBars-1; while(i>=0) { L0A = L0; L1A = L1; L2A = L2; L3A = L3; L0 = (1 - gamma)*Close[i] + gamma*L0A; L1 = - gamma *L0 + L0A + gamma *L1A; L2 = - gamma *L1 + L1A + gamma *L2A; L3 = - gamma *L2 + L2A + gamma *L3A; CU = 0; CD = 0; if (L0 >= L1) CU = L0 - L1; else CD = L1 - L0; if (L1 >= L2) CU = CU + L1 - L2; else CD = CD + L2 - L1; if (L2 >= L3) CU = CU + L2 - L3; else CD = CD + L3 - L2; if (CU + CD != 0) LRSI = CU / (CU + CD); val1[i] = LRSI; i--; } return(0); } //+------------------------------------------------------------------+
Just looking again at your OP, the first use of icustom is correct but the bit in Red for H1 has the wrong parameter count. If that's the only problem with your code then it's the parameter count that is the issue
Same problem with this one:
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 SeaGreen #property indicator_color2 Red #property indicator_width1 3 #property indicator_width2 3 double CrossUp[]; double CrossDown[]; extern bool SoundON=true; double alertTag; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY,3); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY,3); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i = 0; i <= limit; i++) { if ( (iCustom(NULL,0,"Laguerre",0.66,9500,0,i) > 0.15) && (iCustom(NULL,0,"Laguerre",0.66,9500,0,i+1) < 0.15) && (iCustom(NULL,PERIOD_H1,"Laguerre",0.66,9500,0,i) > 0.75)) //check for buy signal { CrossUp[i] = Close[i]; } else if ( (iCustom(NULL,0,"Laguerre",0.66,9500,0,i) < 0.75) && (iCustom(NULL,0,"Laguerre",0.66,9500,0,i+1) > 0.75) && (iCustom(NULL,PERIOD_H1,"Laguerre",0.66,9500,0,i) < 0.15)) //check for sell signal { CrossDown[i] = Close[i]; } if (SoundON==true && i==1 && CrossUp[i] > CrossDown[i] && alertTag!=Time[0]){ Alert("SHORT signal on ",Symbol()," ",Period()); alertTag = Time[0]; } if (SoundON==true && i==1 && CrossUp[i] < CrossDown[i] && alertTag!=Time[0]){ Alert("Long Signal on ",Symbol()," ",Period()); alertTag = Time[0]; } } return(0); }
Just to be sure... the script I provided, did you change the parameters in icustom to match the input parameters for the indicator? I notice that the parameters in the version of laguerre are different from the one I just down loaded from codebase.
So does this still give the wrong result?
int start() { //---- Alert(iCustom(Symbol(),NULL,"Laguerre",0.66,9500,0,0)); Alert(iCustom(Symbol(),60,"Laguerre",0.66,9500,0,0)); //---- return(0); }
- 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'm trying to code a very simple indicator using iCustom and Laguerre.mq4
when Laguerre cross the 0.75 level head down it gives a sell signal and when it cross the 0.15 level head up it gives a buy signal, it works but, of course it's not very useful like that and i have to add something else to make it more useful. this is where i fail:
i'm trying to check where is laguerre on H1 adding "&& (iCustom(NULL,60,"Laguerre",0,i) > 0.75)" and "&& (iCustom(NULL,60,"Laguerre",0,i) < 0.15)" in the conditions but it doesn't work and i can't figure out why, it gives random signal even if laguerre is not above 0.75 or below 0.15.
Your Help would be very welcome !
Thanx
here is the code (it's based on EMA cross indicator i found on the web) what do not work is written in RED: