Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Look Back Period Since Position Exit

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

    Look Back Period Since Position Exit

    Hi guys,
    I'm working on a strategy involving the keltner channel indicator. The strategy consists of taking longs when price touches the lower band and vice versa with the top. I managed to get the action of taking longs and shorts to work. Problem is the strategy consists of price crossing above/below the midline of the keltner channel in order to provide the next signal to enter. Currently with the action I set up, the strategy enters a trade then either hits the profit target or gets stopped out and then enters again when price touches the lower or upper bands. I'm trying to create a condition where price has to cross above/below the midline in order to trigger the next entry signal. I've played around with the "Look back period" but this isn't accurate since price can linger in between the midline and lower/upper bands without touching both. Ideally I need to create a condition that says "since last position exit(profit or stop) price needs to cross above/below midline in order to trigger the next long or short." Thank you.

    #2
    Hello traderdanny,

    Welcome to the NinjaTrader forums.

    I'm focusing on specific sentence that I think is your inquiry "I'm trying to create a condition where price has to cross above/below the midline in order to trigger the next entry signal."

    It sounds like you already have Price > Close selected on the left, CrossAbove as the operator in the center, and Indicator > Keltner channel with the Plot set to Midline on the right for the first condition and Strategy > Position on the left, equals in the center, and Strategy > Market Position set to Long on the right.

    Are finding that this conditions is not evaluating as true when expected?

    Use prints to understand why.
    Below is a link to a forum post that demonstrates using prints to understand behavior. Please watch the video 'Debugging using prints with the Strategy Builder'.
    https://ninjatrader.com/support/foru...121#post791121

    I am happy to assist with analyzing the output from prints.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your response Chelsea. The action is currently working based on the condition but the condition isn’t exactly where I need it to be. I need the strategy to register that after I exit a market position(profit or stop) I don’t want the strategy to take another long until price crosses the midline of the Keltner channel. Currently if I get stopped out the strategy just re enters right away since it’s under the lower channel. Or if I take profit and price doesn’t cross above the midline but returns to the bottom band it also enters a trade again.

      Comment


        #4
        Hello traderdanny,

        You could require the position to be flat and the close crosses above the midline.

        A condition with cross above / below would be comparing the previous bars values for two series with the current bars values for two series. This would not be the same as choosing Less than as the operator in the center.

        Are you wanting to wait an additional bar?

        Is the script running with Calculate set to OnBarClose?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,
          I'm not sure what you mean by two series. Currently my action keeps entering a long position when price touches the lower band of the keltner channel which is what I want it to do. However, I need to cross above the midline of the keltner channel once the position is closed in order to re enter the next trade.

          I do have an IF condition of CrossAbove(Close, keltnerema(Close, 9, 140). Midline, 100). This however forces me to use a look back period of 100 in order for the action to work. My strategy can't work on a set number for the look back period.

          I need a condition stating IF price(close) crosses above keltnerema midline SINCE the last market position whether it was a stop or profit then the action of taking a long on the bottom keltner channel should be completed. Heres my action code if it helps you out. EnterLongLimit(1, (keltnerema(9, 140).Lower[0] + (2 * TickSize)), @''"");

          What exactly would this type of coding look like?

          Thanks for your help.

          Comment


            #6
            Hello traderdanny,

            Two series just means two inputs like two indicators or two price series.

            When you say that you need to use 100 for the lookback, are you getting an error or just seeing that the condition is not true when using other values?

            For a condition with the lookback since the alast entry you could use BarsSinceEntryExecution

            https://ninjatrader.com/support/help...tsub=barssince

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Janfor, Today, 07:08 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by memonolog, Today, 06:49 AM
            0 responses
            6 views
            0 likes
            Last Post memonolog  
            Started by fawzanalim, Today, 04:37 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by SpongeRob, Today, 06:41 AM
            0 responses
            17 views
            0 likes
            Last Post SpongeRob  
            Started by focus333, Yesterday, 05:48 PM
            1 response
            20 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Working...
            X