Ordermodify function to complete under specific conditions - but only once

 

Hi,

I'm fairly new to programming in MQL.

I have a problem for my EA that I haven't found any information on and am trying to find a solution. 

The scenario is this:

Certain trading conditions met = ordermodify -> change stop-loss (this applies to all open trades)

However the problem is that the conditions may exist for some time - multiple candles but the intention is to send through ordermodify for each open order but do it once only.

Any ideas? The only thing I've thought of is either Sleep or similar (which isn't appropriate) or labelling all open orders once ordermodify has completed (but not sure how I'd go about this).

I'm not looking for a complete answer, but perhaps someone has done something similar and could put me in the right direction.

Thanks!

 
Autobotsgo:

Hi,

I'm fairly new to programming in MQL.

I have a problem for my EA that I haven't found any information on and am trying to find a solution. 

The scenario is this:

Certain trading conditions met = ordermodify -> change stop-loss (this applies to all open trades)

However the problem is that the conditions may exist for some time - multiple candles but the intention is to send through ordermodify for each open order but do it once only.

Any ideas? The only thing I've thought of is either Sleep or similar (which isn't appropriate) or labelling all open orders once ordermodify has completed (but not sure how I'd go about this).

I'm not looking for a complete answer, but perhaps someone has done something similar and could put me in the right direction.

Thanks!


You have a problem we don't see

 so how do you expect we can help you ??

Any idea ???

.....  show your attempt fixing your problem ,tell what the problem is you have

and it might be someone can help you..... 

 
Autobotsgo: However the problem is that the conditions may exist for some time - multiple candles but the intention is to send through ordermodify for each open order but do it once only.
Variations of
static bool isCondition=false;
int start(){
   bool wasCondition = isCondition;
   isCondition = ...
   if(!isCondition) return; // no modify yet
   if(wasCondition) return; // already did it
   // do modify.
 
WHRoeder:
Variations of

Many thanks - I'll test that out. :)
Reason: