Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with lowest bar

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

    Help with lowest bar

    Hi, I'm trying to create an entry where the current price is 4 ticks above the high of the lowest bar looking back at the last 3 bars.

    I'm using this logic:
    GetCurrentBid() + -4 * TickSize >= LowestBar(High, 3)

    However, when backtesting I consistently enter when this is not true (see attachment). Can someone help me with my logic?

    Thanks,

    Rich
    Attached Files

    #2
    Hello richp6,

    LowestBar returns the number of bars ago the lowest price value occured for the lookback period.

    You may be looking for MIN() instead. It returns the lowest value over the specified lookback period.
    http://www.ninjatrader-support.com/H...inimumMIN.html
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      You're right that is definitely not what I wanted. Is there anyway using the ninja code wizard to capture the high price of the lowest bar in the lookback period, or do I need to do custom code?

      Comment


        #4
        Hi Richp6,

        You would need to custom code for this. The two statements below should work for this.

        int barsAgo = LowestBar(Low, 3);
        double myHighValue = High[barsAgo];
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        40 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        26 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        44 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        37 views
        0 likes
        Last Post CarlTrading  
        Working...
        X