StringFind is not working correctly - page 2

 
Relina: Sorry but I really don't see any error in my code.

Because there is no error in your posted code.

Looking for …959. Rejects …995. Doesn't exist, Alerts 0.
HedgeEA_v.4.0 AUDNZD,M5: Alert: t- 25721959
HedgeEA_v.4.0 AUDNZD,M5: Alert: gn- Mag_25716995_-211.60
HedgeEA_v.4.0 AUDNZD,M5: Alert: 0
Looking for …995. Finds it. Alerts 1.
HedgeEA_v.4.0 GBPCHF,M5: Alert: t- 25716995
HedgeEA_v.4.0 GBPCHF,M5: Alert: gn- Mag_25716995_-211.60
HedgeEA_v.4.0 GBPCHF,M5: Alert: 1

Your log shows no problem with your posted code.


Relina: Anyways I'm attaching the EA so you also can check ...
   for(int i=0; i<=total; i++) if(
      OrderSelect(i, SELECT_BY_POS)
   && OrderMagicNumber() == MagicNumber 
   && OrderSymbol()      == _Symbol){
         ticket = OrderTicket();
         if(a(ticket) != 0.0)
           {
            continue;
           }
  1. You will never find a order at position total.
  2. If you don't find a GV corresponding to your ticket you return. No GV will ever be created.
 

Forum on trading, automated trading systems and testing trading strategies

StringFind is not working correctly

Alain Verleyen, 2020.06.23 17:18

0       16:02:07.672    HedgeEA_v.4.0 AUDNZD,M5: Alert: t- 25721959
0       16:02:07.672    HedgeEA_v.4.0 AUDNZD,M5: Alert: gn- Mag_25716995_-211.60
0       16:02:07.672    HedgeEA_v.4.0 AUDNZD,M5: Alert: 0

What is the problem with StringFind() ? There is not, the function can't find something inexistent.

Fix your logic and your code, and stop blaming the language for your error, it will help you to progress.

If you get Alert "0" while you don't expect it, that means you need to fix your logic, and then your code accordingly.
 
William Roeder:

Because there is no error in your posted code.

Looking for …959. Rejects …995. Doesn't exist, Alerts 0.
HedgeEA_v.4.0 AUDNZD,M5: Alert: t- 25721959
HedgeEA_v.4.0 AUDNZD,M5: Alert: gn- Mag_25716995_-211.60
HedgeEA_v.4.0 AUDNZD,M5: Alert: 0
Looking for …995. Finds it. Alerts 1.
HedgeEA_v.4.0 GBPCHF,M5: Alert: t- 25716995
HedgeEA_v.4.0 GBPCHF,M5: Alert: gn- Mag_25716995_-211.60
HedgeEA_v.4.0 GBPCHF,M5: Alert: 1

Your log shows no problem with your posted code.

Of course ...

# William Roeder you are top man, thanks a lot, much appreciated!

 
This seems like a XY problem...
The XY Problem
  • xyproblem.info
The XY problem is asking about your attempted solution rather than your actual problem . This leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. User wants to do X. User doesn't know how to do X, but thinks they can fumble their way to a solution if they can...