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 algospoke, Yesterday, 06:40 PM
      2 responses
      23 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      22 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X