Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator using wrong prices

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

    Indicator using wrong prices

    Hey everyone

    So i am testing a indicator that identifies when 3 or more bull bars dont go below the prior bars low, but for some reason i can see in the output debugging that the prices from the bars are way off, which i assume is why the 3 or more bull microchannels are being calculated wrong.
    Does anyone know the cause of this issue?

    Here is the code:
    Removed it
    Last edited by xerker22; 01-31-2025, 02:50 AM.

    #2
    Hello xerker22,

    You are storing the CurrentBar to a variable which is the bars index and not a BarsAgo, later in the EvaluateMicroChannel method you are using the index as a bars ago. You would have to use CurrentBar - microChannelStartIndex to get the barsago from right now in processing. If you want to use a loop and indexes you can also use the GetValueAt method on the series.

    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.

    Comment


      #3
      [QUOTE=NinjaTrader_Jesse;n1332776]Hello xerker22,

      Thanks that worked!

      I have another issue now though, so when the indicator identifies 3 bars+ with no lows below prior bar, on the third bar that starts calculating the factors it only analyzeses the first 2 for some reason. Like its one bar delayed for the microchannel?
      Can you identify the issue?
      Thanks!

      Removed the code
      Last edited by xerker22; 01-31-2025, 02:51 AM.

      Comment


        #4
        Hello xerker22,

        ny just looking at the code I wouldn't be sure, have you tried adding Print statements to trace how the logic is working?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        637 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X