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 wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X