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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        59 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        143 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        276 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X