Stanislav Ivanov:
0 means the "Remove" is found on the first position of the string. You should write:Hi guys,
Im struggling with a simple string find function.
I am using OnChartEvent handler, and my idea is to take the sparam and search it for a string, for example search for "Remove" in the object name, if there was a click on an object(button) on the chart. But the string find always returns 0 ! I printed the sparam, and its ok, it contains the word i am searching for(i have accounted for the uppercase), so this is my problem. Maybe the thing is that sparam is passed by reference, i am not sure.
Id appreciate it if someone helps !
Thanks
void OnChartEvent(const int id, // Event identifier const long& lparam, // Event parameter of long type const double& dparam, // Event parameter of double type const string& sparam) // Event parameter of string type { if(id==CHARTEVENT_OBJECT_CLICK) { if(StringFind(sparam,"Remove")>=0) { Print("Expert Removed by command !"); ExpertRemove(); return; } } }
Amir Yacoby:
0 means the "Remove" is found on the first position of the string. You should write:
0 means the "Remove" is found on the first position of the string. You should write:
oh, right, i forgot about that.
Thanks !
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi guys,
Im struggling with a simple string find function.
I am using OnChartEvent handler, and my idea is to take the sparam and search it for a string, for example search for "Remove" in the object name, if there was a click on an object(button) on the chart. But the string find always returns 0 ! I printed the sparam, and its ok, it contains the word i am searching for(i have accounted for the uppercase), so this is my problem. Maybe the thing is that sparam is passed by reference, i am not sure.
Id appreciate it if someone helps !
Thanks