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 kinfxhk, 07-14-2026, 09:39 AM
    0 responses
    13 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    59 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    41 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    47 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    38 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X