Experts: OpenTime 2

 

OpenTime 2:

The Expert Advisor opens positions inside two time intervals. Trades are closed at the specified time. Trailing Stop.


Author: Vladimir Karputov

 
Hello! Is it possible to disable the Duration input so that trades are opened only at a certain time, not every time after closing on stop? If yes, how?
 
Alena.k:
Hello! Is it possible to disable the Duration input so that trades are opened only at a certain time, not every time after closing on a stop? If yes, how?

And what is the connection? On what symbol and with what settings are you testing? On what time period?

 
Vladimir Karputov:

What is the connection? On what symbol and with what settings are you testing? On what time period?

Test on RTS with M5 period, when setting the check "all ticks", positions are reopened as soon as there is a stop close.
 
Alena.k:
Test on RTS with M5 period, when you set the "all ticks" check, positions are reopened as soon as the stop close occurs.

Sorry, but I can't test my codes on the exchange, so you use them on the exchange at your own risk. If you use my codes on the exchange - I do not advise.


Added: you can try setting the Duration parameter to zero.

 

I think there's a mistake

//---
   MqlDateTime STimeCurrent;
   TimeToStruct(TimeCurrent(),STimeCurrent);
   int time_current=STimeCurrent.hour*3600+STimeCurrent.min*60+STimeCurrent.sec;
   if(!Monday && STimeCurrent.day_of_week==1)
      return;
   if(!Tuesday && STimeCurrent.day_of_week==2)
      return;
   if(!Wednesday && STimeCurrent.day_of_week==32)
      return;
   if(!Thursday && STimeCurrent.day_of_week==3)
      return;
   if(!Friday && STimeCurrent.day_of_week==5)
      return;
//---
 
Konstantin Seredkin:

I think there's a mistake

Yeah, that's right. Thank you.

 

Greetings.

Interesting EA, but I have a problem with it.

If I set the order opening in the evening at 22:15 and closing at 10:15 the next day, it does not close.

Any ideas how to fix it?

PS The first version has the same problem. It doesn't close by time on the next day.
 
AsusNSK:

Greetings.

Interesting EA, but I have a problem with it.

If I set the order opening in the evening at 22:15 and closing at 10:15 the next day, it does not close.

Any ideas how to fix it?

PS The first version has the same problem. It does not close by time on the next day.
Is the transition through the day announced in this Expert Advisor?
 

Can you tell me how to make a long position open exactly at 9.00 at the current price under any conditions? Exit not by time, i.e. time is not limited, but by stop or profit.

 
Newwinner2020:

Can you tell me how to make a long position open exactly at 9.00 at the current price under any conditions? Exit not by time, i.e. time is not limited, but by stop or profit.

Read the settings. Find the start time. Set the time.