Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Double Bottom Indicator

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

    Double Bottom Indicator

    Hi,
    I'm seriously struggling with this one. I'm trying to create a Double Bottom indicator with certain features.
    I just don't know how to write a code of it. I'm aware about this code: Swing(int strength).SwingHighBar(int barsAgo, int instance, int lookBackPeriod) b and athe help guide on the swing indicator: https://ninjatrader.com/support/help...nt8/?swing.htm
    I just can't figure out how to implement following criteria.
    Here are key features of the indicator. Since Double Bottom has 2 swings I will be using SL2 and SL1 (Swing Low2 and Swing Low1) SL1 being most recent swing.
    1. There is up to 6 bars within between SL1 and SL2 (including SL1 and SL2 Bars)
    2. If SL1 is Higher then SL2 then LL (Lower Low) of SL1 to be within 2 ticks distance from LL of SL2
    3. HH coming from SL2 should be 6 ticks or more away from the 20 EMA
    I would appreciate your help with it

    #2
    Hello Ludwik,

    Use 1 as the instance for the most recent swing, use 2 as the instance for the previous most recent swing.

    With those two bars ago numbers, you would need a loop that compares the open to the close.

    Something similar to

    bool upBarFound = false;

    for (int index = startBarsAgo; index < endBarsAgo; index++)
    {
    if (Close[index] > Open[index])
    {
    upBarFound = true;
    }
    }

    Print("upBarFound: " + upBarFound);

    You can compare the high or lows of the bars to each other.

    if (Low[Math.Max(0, Swing(5).SwingLowBar(0, 1, 10))] > Low[Math.Max(0, Swing(5).SwingLowBar(0, 2, 10))] - 2 * TickSize)

    You can compare the high of the swing low bar to be greater than the EMA(20) plus 6 ticks.

    if (Low[Math.Max(0, Swing(5).SwingLowBar(0, 2, 10))] > EMA(20)[0] + 6 * TickSize)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you Chelsea, you are helping me a lot.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      41 views
      0 likes
      Last Post JonesJoker  
      Started by timko, Today, 06:45 AM
      0 responses
      3 views
      0 likes
      Last Post timko
      by timko
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      2 responses
      37 views
      0 likes
      Last Post poeds
      by poeds
       
      Started by chbruno, Yesterday, 04:10 PM
      1 response
      44 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Max238, Today, 01:28 AM
      1 response
      25 views
      0 likes
      Last Post CactusMan  
      Working...
      X