Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EOD - How to avoid huge opening gaps?

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

    EOD - How to avoid huge opening gaps?

    Hello,

    I use daily candles and would like to avoid huge opening gaps.
    The strategy should only buy, if the current day opening is within a certain range +-X% of last days close.

    Since the the strategy only has one candle per day I 'am not sure if my approach would work:

    && (Close[0]) * (1 + GapUpLong) >= CurrentDayOHL().CurrentOpen[0]
    && (Close[0]) * (1 - GapDownLong) <= CurrentDayOHL().CurrentOpen[0])

    Also is there anything I need to change in the general settings?
    Code:
            protected override void Initialize()
            {
    			EntriesPerDirection = 2; 
        		EntryHandling = EntryHandling.AllEntries;
                SetStopLoss("", CalculationMode.Percent, StopProzent, true);
                CalculateOnBarClose = true;
    					
            }
    		
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    			EntriesPerDirection = 2; 
        		EntryHandling = EntryHandling.AllEntries;
    			
    			
    			(..........Random Strategy................)
    [COLOR="Red"][SIZE="3"]				&& (Close[0]) * (1 + GapUpLong) >= CurrentDayOHL().CurrentOpen[0]
    				&& (Close[0]) * (1 - GapDownLong) <= CurrentDayOHL().CurrentOpen[0])[/SIZE][/COLOR]
    				
                {
                    EnterLong(DefaultQuantity, "");
                }
    Are there other alternatives such as using different order types?
    I also tried:
    EnterLongStopLimit(DefaultQuantity, (Close[0]) * (1 + GapUpLong), (Close[0]) * (1 - GapDownLong), "");
    But backtesting gave me 0 trades on this one.

    So what is the most practical way to avoid opening gaps?

    #2
    Hello Foerster,

    Thank you for your post.

    The Close[0] will actually check the current bar's close and not the previous bar's close. If you wanted to check the previous day's close you would use Close[1] in this case.

    So you could compare the current open with Open[0] against the previous close with Close[1].

    For information on Open please visit the following link: http://www.ninjatrader.com/support/h...s/nt7/open.htm

    For information on Close please visit the following link: http://www.ninjatrader.com/support/h.../nt7/close.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      The Close[0] will actually check the current bar's close and not the previous bar's close. If you wanted to check the previous day's close you would use Close[1] in this case.
      If I did as you say, wouldn't the strategy just check if the last candle had a gap?

      Basically all I want is in this picture:

      Comment


        #4
        Hello Foerster,

        If I am following your logic you want to check the previous bars Close value to make sure that the current bar's Open is not more than 2% above or below the Close value correct?

        If so you should be able to use Close[1] to check the last days Close value and Open[0] for the current days open price.

        Here is a thread that has a few examples of using Brackets that may view for an example.


        Let us know if that works for you or if you have any questions.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frslvr, 04-11-2024, 07:26 AM
        9 responses
        123 views
        1 like
        Last Post caryc123  
        Started by rocketman7, Today, 09:41 AM
        4 responses
        16 views
        0 likes
        Last Post rocketman7  
        Started by selu72, Today, 02:01 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by WHICKED, Today, 02:02 PM
        2 responses
        16 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        21 views
        0 likes
        Last Post f.saeidi  
        Working...
        X