Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I restrict my stratgies to run on a particular time period

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How can I restrict my stratgies to run on a particular time period

    Hi,

    As the subject, please let me know what is the function can restrict my stratgies to run only on a particular time period. I don't want my stratgies to place any orders for the first 20mins and the last 20mins during the market is open.

    Thanks,
    Jess

    #2
    Code:
    protected override void OnBarUpdate()
    {
    
    //Print ( "B4 Historical" );
        
    if (Historical) return;
        
    if ( BarsInProgress == 0 ) 
    {    
    
    if (    ToTime(Time[0]) >= ToTime( 9, 30, 00)
        &&  ToTime(Time[0]) <= ToTime( 16, 00, 00)) 
    {
    Originally posted by jesshon View Post
    Hi,

    As the subject, please let me know what is the function can restrict my stratgies to run only on a particular time period. I don't want my stratgies to place any orders for the first 20mins and the last 20mins during the market is open.

    Thanks,
    Jess

    Comment


      #3
      Hi sledge,

      thanks for your help.

      Regards,
      Jess

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Balage0922, Today, 07:38 AM
      0 responses
      3 views
      0 likes
      Last Post Balage0922  
      Started by JoMoon2024, Today, 06:56 AM
      0 responses
      6 views
      0 likes
      Last Post JoMoon2024  
      Started by Haiasi, 04-25-2024, 06:53 PM
      2 responses
      19 views
      0 likes
      Last Post Massinisa  
      Started by Creamers, Today, 05:32 AM
      0 responses
      6 views
      0 likes
      Last Post Creamers  
      Started by Segwin, 05-07-2018, 02:15 PM
      12 responses
      1,786 views
      0 likes
      Last Post Leafcutter  
      Working...
      X