Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time exit not working

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

    Time exit not working

    Hello,

    On my automated strategies I usually have a time exit condition, to exit the trade shortly before market close. The problem I have is that sometimes it seems to work, and other times it does not, and uses the normal exit on close logic instead.

    For example, today I had a live strategy running on the 6B, with the following exit logic:

    // Condition set 5
    if (ToTime(Time[0]) == ToTime(13, 55, 0))
    {
    ExitLong("", "");
    }

    However when time reached 13:55+, the strategy did not exit as programmed. It was only at 13:59:30, 30 seconds before market close, that the strategy took itself out, which again was the normal "exit on close" logic, not the programming. What I don't understand is that all of these strategies use that same code, and sometimes it works, and sometimes it does not. Can you think of any reason why it wouldn't trigger randomly?

    Regards,

    Andrew

    #2
    Hi Andrew, what chart type / timeframe do you run this code on? Time[0] is the bar timestamp so there could be cases where the logic would not be triggered as for example on non time based charts the stamp would not be exactly this time to resolve.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      These are on 1 minute charts/time frames.

      Comment


        #4
        I see, you could still not see a time stamp for this time, for example if there not sufficient trading to see a trade / tick, the bar would be staying open until that closing / new open tick happened. If you check your charts, is there a timestamp to trigger this condition?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          I see, you could still not see a time stamp for this time, for example if there not sufficient trading to see a trade / tick, the bar would be staying open until that closing / new open tick happened. If you check your charts, is there a timestamp to trigger this condition?
          Okay I think I see what you're saying -- if I look at a chart now, there is a 13:54 bar and the next bar is 13:56, so no 13:55 bar....so I gather what you're saying is that if there are no trades during the 13:55 time period, then nothing appears in the system to actually register that time, or create a time stamp, and thus there is no 13:55 time stamp for the exit logic to operate on. Is that more or less correct?

          Comment


            #6
            That is correct in understanding Andrew, and the reason for your 'random' logic trigger.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Bertrand View Post
              That is correct in understanding Andrew, and the reason for your 'random' logic trigger.
              Ok that makes sense -- I didn't realize there had to be a trade and a time stamp for the logic to realize it was time to exit, but now I see why that would be the case. At least the exit on close logic still works when the time exit fails, to prevent holding overnight. Thanks for the clarification.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ginx10k, Today, 05:49 AM
              0 responses
              1 view
              0 likes
              Last Post ginx10k
              by ginx10k
               
              Started by Goldy, Today, 04:00 AM
              0 responses
              14 views
              0 likes
              Last Post Goldy
              by Goldy
               
              Started by Betican, Today, 12:32 AM
              0 responses
              19 views
              0 likes
              Last Post Betican
              by Betican
               
              Started by Betican, Today, 12:25 AM
              0 responses
              17 views
              0 likes
              Last Post Betican
              by Betican
               
              Started by dgee949, Yesterday, 10:51 PM
              1 response
              25 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X