Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One trade per setup and force close

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

    One trade per setup and force close

    I am wondering how I can force only one trade per setup? ie if the trade moves 25 ticks and my target is 10ticks, that it only takes the one trade and not re enters another 2 times.
    Also, how do I force it to close trades when a timeto is met. ie. Force close an open trade that began at 9:25am and the timeto period of no trading is set to 9:27 to 9:32
    The Timeto setting I have seem to work ok, but only stops new trades begining and doesn't force open trades to close.
    Thanks in advance

    #2
    vast524, to take only one trade per setup you work with user variables or flags like in this sample - http://www.ninjatrader-support2.com/...ad.php?t=15417

    To exit trades at a certain time, you can work with time filters, too - for example this snippet closes open longs and shorts at 10:15:00 -

    Code:
     
    if (ToTime(Time[0]) >= 101500)
    {
    ExitShort();
    ExitLong();
    }

    Comment


      #3
      Thanks Bertrand
      If I had several time periods that need to be avoided. ie opening, lunch times and close. ie. No trade between 9:28 to 9:33, 12:00 o 13:00 and 1:55 to 16:02. I have a series of ToTime commands in a row separated by ||. The coding sems to be in order.
      Would I need to place the following for each time frame.

      if (ToTime(Time[0]) >= 101500)
      {
      ExitShort();
      ExitLong();
      }

      Comment


        #4
        Sure, just work with this each time you want to exit at a specific time. Please note that this will simplpy get you net flat as it exits longs and shorts, whatever position is present at this time then.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X