Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EnterLong and EnterShort to trigger on Close not Open

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

    EnterLong and EnterShort to trigger on Close not Open

    I am currently calculating entry signal at Close of bars. When I call EnterLong or EnterShort at that close, the strategy, enters the trade on Open of the next bar.

    How can I make the strategy enter the trade on Close of the next bar instead?

    This is all for Historical analysis not live data. The bars are Daily bars.
    I have already set CalculateOnBarClose = true

    #2
    Hello afshinmoshrefi,

    To have a strategy purchase not the open of the bar immediately after the condition is true, but the bar after, you could set CurrentBar to a variable then have another if statement check if the CurrentBar is >= the variable+1, and if so enterlong. An example of this can be seen in the attached sample.

    Regarding having the strategy execute on the close rather than the open, the attached strategy adds a 2nd bar series and a time filter to accomplish this.

    Please let us know if you need further assistance.
    Attached Files
    Last edited by NinjaTrader_AlanP; 04-27-2017, 03:47 PM.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Alan. I was hoping I could accomplish this task with daily bars only. Is that possible or do I require using second or tick data to do this task.

      Comment


        #4
        Hello afshinmoshrefi,

        The strategy I put together is applied to a daily chart/data, however uses a secondary series of tick to accomplish the exiting on close. I'm not sure how you could accomplish what you're looking to do without a secondary data series.

        If you formulate an idea I'd be interested to know.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by condorhero, Today, 09:28 PM
        0 responses
        5 views
        0 likes
        Last Post condorhero  
        Started by MaraAnkh, Today, 08:44 PM
        0 responses
        6 views
        0 likes
        Last Post MaraAnkh  
        Started by wooofad, Today, 05:38 PM
        0 responses
        7 views
        0 likes
        Last Post wooofad
        by wooofad
         
        Started by caacapital, Today, 10:10 AM
        2 responses
        18 views
        0 likes
        Last Post caacapital  
        Started by DiverG20, Today, 10:23 AM
        0 responses
        23 views
        0 likes
        Last Post DiverG20  
        Working...
        X