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 CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        13 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        119 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        172 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        88 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        131 views
        0 likes
        Last Post cmoran13  
        Working...
        X