Exploit Strtotime - page 3

 
It's true yes, when there is not a time condition it open positions at every tick after starting EA. I didn't think about that...
 

But in other EA i set it:

(OpenSellHour==Hour())&&(OpenSellMinutes==Minute())&&(OpenSellSeconds>=Seconds()))
And orders are open on time i choose (opensellhour= 1 for example) Why? Where is the difference?
 
Kane59:

But in other EA i set it:

And orders are open on time i choose (opensellhour= 1 for example) Why? Where is the difference?

Because of this . . .

OpenSellSeconds>=Seconds()

 So the hour has to match,  the minute has to match but the seconds can be more than one second . . . 

 

So if i use:


extern string         TimeDayHighLow="12:43";

datetime Now= TimeCurrent(),
         TDHL= StrToTime(TimeDayHighLow);

if (Now>=TDHL)
   {
//Buy conditions
      if (O<H)// Si Open B0 < High B1 ou 2     
      {
         OrderSend(Symbol(),OP_BUYSTOP,Lot,H,0,0,H+TP1,NULL,MagicHL,iTime(Symbol(), PERIOD_D1, 0 ) + (J*2*86395));
         OrderSend(Symbol(),OP_BUYSTOP,Lot,H,0,0,H+TP2,NULL,MagicHL,iTime(Symbol(), PERIOD_D1, 0 ) + (J*2*86395));

//Sell conditions  
      if (O>L)// Si Open B0 > Low B1 ou 2
      {
         OrderSend(Symbol(),OP_SELLSTOP,Lot,L,0,0,L-TP1,NULL,MagicHL,iTime(Symbol(), PERIOD_D1, 0 ) + (J*2*86395));
         OrderSend(Symbol(),OP_SELLSTOP,Lot,L,0,0,L-TP2,NULL,MagicHL,iTime(Symbol(), PERIOD_D1, 0 ) + (J*2*86395)); 

Is it working?

or maybe that: 

extern string         TimeDayHighLow="12:43:00";
 
Kane59:

So if i use:

Is it working?

That should work for ANY time after 12:42:59 today . .  .
 

Lol Ouch !


Yes but it can be filtered by a counter

example if ticket == 5

                   Allow open == false.

 

And can i do this and how?

extern string         TimeDayHighLow="12:43";

if ((Now>=TDHL)&&(Now<=TDHL+"00:00:05")

So TDHL + 5 seconds for example.

Can add time in string format and how?


EDIT:

Oh i think i know:

string         Add="00:00:05";

Addtime= StrToTime(Add)

if ((Now>=TDHL)&&(Now<=TDHL+AddTime)
Is it correct?
 
Kane59:

And can i do this and how?

EDIT:

Oh i think i know:

Is it correct?
No . . .  you need to read up on and understand how time is represented in mql4 . . .  read up on what a datetime type variable is.  If you want to add time you just add the extra time you want to add . . .
 
Kane59:

And can i do this and how?

So TDHL + 5 seconds for example.

5 seconds is 5 seconds . . .  "00:00:05"  is 5 seconds past midnight . . .  they are not the same.