Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Script Misses Entry at 8:30 Open

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

    Script Misses Entry at 8:30 Open

    I have an automated strategy based off of the ChandelierSAR for short trades, that automatically enters a short trade at 8:30AM (when the market opens) if the indicator is higher than the current market position as shown below.



    It seemed to work fine on a 233-tick chart but does not enter on the 377-tick chart shown below.



    You can see from the chart that it worked fine later on. It isn't because there are no 8:30AM tick bars either, there are three of them.

    8:27
    8:29
    8:30
    8:30
    8:30
    8:31
    8:31
    8:32

    What is the deal? It works on one chart and not another? I am stumped.

    The Strat and Indicator are attached.
    Attached Files

    #2
    Hello RDpos,

    Thank you for your post.

    ToTime() returns an integer representing time including seconds. A bar would have to end at 8:30:00 for your condition to be true. This happens all the time on minute bars but not so often on ticks bars.

    Add this statement and view the output window:
    Code:
    Print (ToTime(Time[0]));
    You can then see how the bar stamps are represented as an integer.

    Try this to capture the whole minute:
    Code:
     
    if (ToTime(Time[0]) >= ToTime(8, 30, 0) && ToTime(Time[0]) <= ToTime(8, 30, 59 ))
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan, I did an analog in the strategy wizard by changing to

      ToTime(Time[0]) > ToTime(8,29,0)
      ToTime(Time[0]) < ToTime(8,31,0)
      DefaultInput[0] < Chandelier....

      The only problem now would be an inactive market where no 377-tick bar is completed between 08:30:00 and 08:30:59. Is there a way to account for that intrabar? That problem would be much more prominent at 610-tick or higher tick charts.

      Comment


        #4
        Yes, that should work when creating it with the condition builder.

        You can use:
        Code:
        if (Bars.BarsSinceSession == 0)
        This should be the first bar of the day regardless of the timestamp.

        Session times are defined in the Chart Properties.

        http://www.ninjatrader-support.com/H...ceSession.html
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by tonynt, Today, 10:15 AM
        0 responses
        4 views
        0 likes
        Last Post tonynt
        by tonynt
         
        Started by darthy, 08-21-2020, 03:39 PM
        2 responses
        25 views
        0 likes
        Last Post darthy
        by darthy
         
        Started by ballboy11, Today, 09:43 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by rene69851, 08-17-2020, 07:30 PM
        7 responses
        45 views
        0 likes
        Last Post NinjaTrader_Heath  
        Started by ntdev, Today, 04:35 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X