Thanx Raptor for your advice...I have used the print statements as you instructed and found that no matter which color block is plotted on the chart
the values of those buffers do not change...the 5min red is always 0 and the 5min blue is always 4 even if i look back to the [1] or [2] candles values.
this helps me see why the indy wasnt alerting properly...
now my (inevitable) questions is how the heck do I code an alerter for this indy? I have done an alerter before that used a comparison of buffers and it worked fine...
so now im stumped as to how to proceed...some guidance /suggestions as to how I can code an alerter for this indicator would be much appreciated.
also want to take a moment to thank you all (especially Raptor and Dabbler) for their assistance...and ENDLESS patience :)
thanks guys...
any advice on how to proceed would be gratefully and humbly accepted
I ran a script with buffers set as in the code above the same as the code in this post and it works fine as a script...but just wont work as an alerter...
heres what worked fine as a script (it alerts perfectly as to what the colors are over the 3 criteria (colors of : 15min candle[1], 5min candle[2], 5min candle[1]) ...but the minute I try use the exact same comparison criteria in the same format as this script in an alert indicator ...then it wont do a thing)
//+------------------------------------------------------------------+//| Buffer test.mq4 |//| |//| |//+------------------------------------------------------------------+#property copyright "."#property link ""//+------------------------------------------------------------------+//| script program start function |//+------------------------------------------------------------------+int start()
{
//----int h=TimeHour(TimeCurrent());
int m=TimeMinute(TimeCurrent());
double red5current = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,1,1); // RED 5 mindouble blue5current = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,0,1); // BLUE 5 mindouble red5last = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,1,2); // previous RED 5 mindouble blue5last = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,0,2); // previous BLUE 5 mindouble blue15current = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,3,1); // BLUE 15 min double blue15last = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,3,2); // BLUE 15 min last candle [2]
double red15current = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,2,1); // RED 15 mindouble red15last = iCustom(Symbol(),0,"4 TF HAS Bar",2,6,3,2,0,Blue,Red,White,500,2,2); // previous RED 15 min [2]if(red15current<blue15current)
{
AlertOnce("15min is RED",1);
}
else{
AlertOnce("15min is BLUE",2);
}
if(red5last<blue5last)
{
AlertOnce("Previous 5min is BLUE",3);
}
else{
AlertOnce("Previous 5min is RED",4);
}
if(red5current<blue5current)
{
AlertOnce("Last Closed 5min is BLUE",5);
}
else{
AlertOnce("Last Closed 5min is RED",6);
}
//----//----return(0);
}
//+------------------------------------------------------------------+bool AlertOnce(string alert_msg,int ref)
{
staticint LastAlert_1 =0;
staticint LastAlert_2 =0;
staticint LastAlert_3 =0;
staticint LastAlert_4 =0;
staticint LastAlert_5 =0;
staticint LastAlert_6 =0;
switch(ref)
{
case1:
if(LastAlert_1==0 || LastAlert_1 < Bars)
{
Alert(alert_msg);
LastAlert_1=Bars;
return(1);
}
break;
case2:
if(LastAlert_2==0 || LastAlert_2< Bars)
{Alert(alert_msg);
LastAlert_2=Bars;
return(1);
}
break;
case3:
if(LastAlert_3==0 || LastAlert_3< Bars)
{Alert(alert_msg);
LastAlert_3=Bars;
return(1);
}
break;
case4:
if(LastAlert_4==0 || LastAlert_4< Bars)
{Alert(alert_msg);
LastAlert_4=Bars;
return(1);
}
break;
case5:
if(LastAlert_5==0 || LastAlert_5< Bars)
{Alert(alert_msg);
LastAlert_5=Bars;
return(1);
}
break;
case6:
if(LastAlert_6==0 || LastAlert_6< Bars)
{Alert(alert_msg);
LastAlert_6=Bars;
return(1);
}
break;
}
}
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.
Thanx Raptor for your advice...I have used the print statements as you instructed and found that no matter which color block is plotted on the chart
the values of those buffers do not change...the 5min red is always 0 and the 5min blue is always 4 even if i look back to the [1] or [2] candles values.
this helps me see why the indy wasnt alerting properly...
now my (inevitable) questions is how the heck do I code an alerter for this indy? I have done an alerter before that used a comparison of buffers and it worked fine...
so now im stumped as to how to proceed...some guidance /suggestions as to how I can code an alerter for this indicator would be much appreciated.
also want to take a moment to thank you all (especially Raptor and Dabbler) for their assistance...and ENDLESS patience :)
thanks guys...
any advice on how to proceed would be gratefully and humbly accepted
Can you please show the code you are currently using for your iCustom calls . . .
I think you maybe looking at the wrong buffers . . . buffer 0 is buf4_up i.e. H1 if you are on a M5 chart
I ran a script with buffers set as in the code above the same as the code in this post and it works fine as a script...but just wont work as an alerter...
heres what worked fine as a script (it alerts perfectly as to what the colors are over the 3 criteria (colors of : 15min candle[1], 5min candle[2], 5min candle[1]) ...but the minute I try use the exact same comparison criteria in the same format as this script in an alert indicator ...then it wont do a thing)