so in this image, i want to query "Test" value..
for (int i = NeedBarsCounted; i >= 1; i--) { if (i == Bars - 1) continue; string name = ObjectName(i); if (StringFind(name, "Test") == 0) { Alert("found"); ctime = Time[0]; if (ctime == prevtime) { return(0); } prevtime = ctime; } }
i was query successfully by use ObjectName and StringFind but one of problem is after every next bar "Alert("found");" fire everytime.
in my chart,many of arrow will incoming and i want to alert only one time not duplicate alarm continue .
how can i make Alert command only one time? thanks
i was query successfully by use ObjectName and StringFind but one of problem is after every next bar "Alert("found");" fire everytime.
in my chart,many of arrow will incoming and i want to alert only one time not duplicate alarm continue .
how can i make Alert command only one time? thanks
//------------------------------------------------------------------ // //------------------------------------------------------------------ #property indicator_chart_window extern bool alertsOn = true; extern bool alertsOnCurrent = false; extern bool alertsMessage = true; extern bool alertsSound = false; extern bool alertsEmail = false; //bool Alerted = false; extern bool displayAlert = true; static datetime lastAlertTime; // //------------------------------------------------------------------ datetime gOldTime=0; bool NewBar() { bool new = Time[0] != gOldTime; gOldTime = Time[0]; return (new); } int init() { return(0); } int deinit() { return(0); } int start() { //static datetime Time0; //if (Alerted) return(-1); //int Sit; int counted_bars=IndicatorCounted(); int i,shift; int limit; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars; for(i = shift ;i<=limit;i++){ string name = ObjectName(i); if (StringFind(name, "Test") == 0) { DisplayAlert("Found!",Symbol()); Print(Symbol()); } } } void DisplayAlert(string message, int shift) { if(shift <= 2 && Time[shift] != lastAlertTime) { lastAlertTime = Time[shift]; Alert(message, Symbol(), " , ", Period(), " minutes chart"); } } void doAlert(int forBar, string doWhat) { static string previousAlert="nothing"; static datetime previousTime; string message; if (previousAlert != doWhat || previousTime != Time[forBar]) { previousAlert = doWhat; previousTime = Time[forBar]; // // // // // message = Symbol()+" at "+TimeToStr(TimeLocal(),TIME_SECONDS)+" "+doWhat; if (alertsMessage) Alert(message); if (alertsEmail) SendMail(Symbol()+"alerts",message); if (alertsSound) PlaySound("alert2.wav"); } }
this is what i modified but it not working, still alert message popup continue.
what is wrong in here? it really confuse
First of all, I removed the code that is not used by the program to make it easier to follow
#property indicator_chart_window static datetime lastAlertTime; // //------------------------------------------------------------------ int init() { return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); int i,shift; int limit; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars; for(i = shift ;i<=limit;i++) { string name = ObjectName(i); if (StringFind(name, "Test") == 0) { DisplayAlert("Found!",Symbol()); Print(Symbol()); } } } void DisplayAlert(string message, int shift) { if(shift <= 2 && Time[shift] != lastAlertTime) { lastAlertTime = Time[shift]; Alert(message, Symbol(), " , ", Period(), " minutes chart"); } }
Now, it may just be my lack of knowledge, but I don't understand the function call
DisplayAlert("Found!",Symbol());
that sends 2 strings when the function is expecting a string and an integer
void DisplayAlert(string message, int shift)
thanks! i was test your modified source but still no alert for incoming arrow.
any hint for code much appreciate!
thanks! i was test your modified source but still no alert for incoming arrow.
any hint for code much appreciate!
Try this . . .
#property indicator_chart_window static datetime lastAlertTime; // //------------------------------------------------------------------ int init() { return(0); } int deinit() { return(0); } int start() { int ObjectIndex, shift; int limit; string ObjName; datetime ArrowObjTime; for(ObjectIndex = ObjectsTotal() - 1 ; ObjectIndex >= 0; ObjectIndex--) { if(ObjectType( ObjectName(ObjectIndex) ) == OBJ_ARROW) ObjName = ObjectName(ObjectIndex); // find the most recent Arrow Object if(ObjectGet(ObjName, OBJPROP_TIME1) > ArrowObjTime) // this arrow is more recent ArrowObjTime = ObjectGet(ObjName, OBJPROP_TIME1); } if (lastAlertTime < ArrowObjTime) { DisplayAlert("Found!"); Print(Symbol()); lastAlertTime = ArrowObjTime; } return(0); } void DisplayAlert(string message) { Alert(message, " ", Symbol(), " , ", Period(), " minutes chart"); }
thanks! this is great guide for me!
now i was modified bit and it working almost well.
but one of problem is incoming Name field's value is changing almost everytime.
for exmaple,
varTest;test23662;
varTest;test221;
varTest34223;test2;
varTest1;test33;
i want to extract rear value so what i want to extract value will be
test23662
test221
test2
test33
problem is it some hard to extract those info by use mt4 function.
i can't found proper String manipulatoin method.
please help me!
thanks !

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
i want to find Text value of arrow in my chart.
i was checked ObjectFind, ObjectGet but it seems to be don't have function to query Text value of arrow .
what kind of method or function should have to use to query name value in Arrow?
thanks!