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 andrewtrades, Today, 04:57 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      3 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X