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

LowestBar() function with up arrow for the candle

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

    LowestBar() function with up arrow for the candle

    Hi,


    Is it possible to locate the lowest low of the last 20 bars using the LowestBar() function ? If so, what would go between the parenteses?

    Also, if such a value is obtainable, is it possible to print an up arrow for that bar/candle?

    Thanks?

    #2
    Hi Marcusplexus,

    Thanks for the Post.

    It is possible to locate the lowest low of the last 20 bars using the LowestBar() Function. In the parentheses you will put the following in –
    • Any DataSeries type object such as an indicator, Close, High, Low, etc...
    • Period or number of bars to check for the condition
    • I.E. LowestBar(Low, 20)
    Using the DrawArrowUp() will allow you to place an up arrow for and at that lowest value Bar.
    In your OnBarUpdate(), you would place this code
    Code:
    DrawArrowUp("TheLowBar", true, LowestBar(Low, 20), Low[LowestBar(Low,20)] - TickSize, Color.Red);
    Click here for more info on DrawArrowUp()
    Click here for more info on LowestBar()

    Please let me know if I can be of further assistance
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Excellent! Thanks!

      Comment


        #4
        Hey @ll, i want to do the same with multiple timeframes

        I am so far:

        Print(Time[0].ToString());
        Print(Low[LowestBar(Low, 20)]);
        Print(MIN(Low, 20)[0]);
        Print(Lows[Timeframe][LowestBar(Low,20)]);

        DrawArrowUp("TheLowBar"+CurrentBar, true, LowestBar(Low, 20), Lows[Timeframe][LowestBar(Low,20)] - TickSize, Color.Red);

        and the arrows are looking good, BUT when I add this information into my StopSystem:

        -->
        SetStopLoss("Name",CalculationMode.Price, Low[LowestBar(Low, 96)] ,true);
        ---> this is working somehow and put the Stop at the lowest bar of the 96 Bars, right?

        But if I try to switch from 5min to 60min i need something like
        SetStopLoss("Name",CalculationMode.Price, Lows[Timeframe][LowestBar(Low,20)] ,true);
        dont I?
        --> most confusing --> I just allowed long trades but here i get short trades as well?!

        I hope you get what I want :-)
        Some kind of trailing depending on the low of the last 20 bars and working in multiple Timeframes.

        Comment


          #5
          Hi eNhale,

          This is mostly correct with one small error.

          When using an input source for the call to LowestBar, supply the Lows with the proper BarsArray index.

          For example:
          SetStopLoss("Name",CalculationMode.Price, Lows[1][LowestBar(Lows[1],20)] ,true);
          SetStopLoss("Name",CalculationMode.Price, Lows[Timeframe][LowestBar(Lows[Timeframe],20)] ,true);
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hi ChelseaB,

            you made my day!
            Thank you for the super fast and 100% helping answer!!!!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bmartz, 03-12-2024, 06:12 AM
            5 responses
            32 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            13 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by cls71, Today, 04:45 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X