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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    45 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X