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.

        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sephichapdson, Today, 11:36 PM
        0 responses
        1 view
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,612 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Today, 05:56 PM
        0 responses
        9 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        19 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by Jon17, Today, 04:33 PM
        0 responses
        6 views
        0 likes
        Last Post Jon17
        by Jon17
         
        Working...
        X