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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    72 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X