Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 indicators doing the same thing at x time

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

    2 indicators doing the same thing at x time

    hi hello,
    im doing with a strategy (in 3 min chart) that i want to stop a short when 2 indicators stay in 0 during for example 12 minutes (4 candles)
    it is possible?
    thanks

    #2
    Hello canarydaytrading,

    Thanks for your post.

    You could try creating conditions in your strategy that checks if the indicators are equal to 0 for the last 4 bars.

    You would set the indicator method's BarsAgo value of 0 to check the indicator value on the current bar. A BarsAgo value of 1 would check the indicator value on the previous bar. BarsAgo 2 would check the indicator value 2 bars prior to the current bar. BarsAgo 3 would check the indicator value 3 bars ago, and so on.

    Using the SMA indicator as an example, the code to check if the SMA is equal 0 on the last 4 bars might look something like this.

    if (SMA(20)[0] == 0 && SMA(20)[1] == 0 && SMA(20)[2] == 0 && SMA(20)[3] == 0)
    {
    //do something.
    }


    System Indicator Methods: https://ninjatrader.com/support/help...indicators.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X