Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Target previous plotted area / line

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

    Target previous plotted area / line

    Hi there,

    I'm trying to create a simply strategy that targets a price crossover/under in the past. In the attached example, I am trying to trigger when price crosses below the bottom lime green line. However because of the settings on this indicator, as soon as price crosses through it, the plots reset, and thus I cannot trigger the crossunder.

    Any ideas here? In this example was trying to displace a 1 period EMA a few bars back, but I'm not sure how to trigger this in the builder. Any suggestions are greatly appreciated. Thanks!
    Attached Files

    #2
    Originally posted by NinjaTrader_BrandonH
    Hello quicksandatl,

    Thanks for your post.

    To clarify, are you trying to detect a cross above/cross below for when the market price crosses above/below the plot of the indicator plotting the lime green line? Or, are you trying to detect if the EMA indicator crosses above/below the indicator plotting the lime green line?

    Is the indicator plotting the lime green line one that comes with NinjaTrader? Or, is this a third-party indicator from a vendor?

    It seems you might want to use BarsAgo to accomplish this.

    As CrossAbove and CrossBelow cannot work with BarsAgo values, you will instead want two conditions to compare the previous bars.

    For example, to find if the market price has crossed below the indicator displaced by 1 in the Strategy Builder:

    Price folder > Close with Bars ago set to 1, Greater, Indicators > (select indicator) with Bars ago set to 2.
    Price folder > Close with Bars ago set to 0, Less, Indicators > (select indicator) with Bars ago set to 1.

    See this help guide page for more information about Strategy Builder conditions: https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?strategybuilder_cond ition_builder.htm

    Here is a forum thread discussing this topic: https://forum.ninjatrader.com/forum/...moving-average
    This worked perfectly! Thank you so much.

    Comment


      #3
      Hi NinjaTrader_BrandonH

      I was wondering if I can get some additional input from you please.

      What would be the way I could specify a longer lookback period for this? I tinkered with it, but couldn't get it to trigger. Basically, if the crossover occurs between the previous (lets say for example) 1 to 6 bars, how could I define that?

      The other question would be is, how could I trigger an entry on a reversal bar? Let's say the reversal renko bar is 100 ticks. The criteria would basically be for long: 1. does the low cross under one of the specified plotted lines within the lookback period and 2. if following bar is 100 ticks from low of previous bar, enter long.

      Thank you!
      Last edited by quicksandatl; 05-15-2024, 10:43 PM.

      Comment


        #4
        Originally posted by NinjaTrader_BrandonH
        Hello quicksandatl,

        Thanks for your notes.

        Something you could consider doing is setting the "Of the following conditions are met" drop-down menu to "If Any", creating condition groups, and adding your conditions in each condition group to check for a different barsAgo.

        In the first condition group check if the market price has crossed below the indicator displaced by 1 as seen in post # 2. In the second condition group in the Set use a BarsAgo to check if the cross below occurs for previous bars.

        For example:

        Condition Group 1:
        Price folder > Close with Bars ago set to 1, Greater, Indicators > (select indicator) with Bars ago set to 2.
        Price folder > Close with Bars ago set to 0, Less, Indicators > (select indicator) with Bars ago set to 1.

        Condition Group 2:
        Price folder > Close with Bars ago set to 2, Greater, Indicators > (select indicator) with Bars ago set to 3.
        Price folder > Close with Bars ago set to 1, Less, Indicators > (select indicator) with Bars ago set to 2.

        And so on.​ To create a condition group you would click the 'group' button on the Conditions and Actions screen of the Strategy Builder.

        Conditions and Actions: https://ninjatrader.com/support/help...dActionsScreen

        To detect if the previous bar is an up bar you could create a conditions that checks if Close[1] > Open[1] and to detect if the current bar is a down bar, you could create a conditions that checks if Close[0] < Open[0].

        The opposite would be done to detect if the previous bar is a down bar and the current bar is an up bar. Close[1] < Open[1] and Close[0] > Open[0].​
        Thank you for this!

        How am I able to get the reversal bar to trigger based on the previous condition groups? Essentially, the strategy is one bar crosses under the plotted line, and only if the following bar is an up bar (for long) does it entry?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        44 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X