Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

I am having a dense moment

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

    I am having a dense moment

    Please tell me what is wrong with this statement,

    if ((MACD(12, 26, 9).Avg[0]) < (MACD(12, 26, 9).Avg[1]))
    {
    DrawArrowDown(
    "Dn"+ CurrentBar, 0, High[0] + 2 * TickSize, Color.Red);
    }


    When that didn't work, I put this in front of the *if* statement to see what was happening. The output window only shows the first 2 print statements.


    Print("outside if statement begin");
    Print(Time[
    0].ToString());
    Print(
    "MACD 0 bar " + MACD(12, 26, 9).Avg[0] + "/ MACD 1 bar " + MACD(12, 26, 9).Avg[1]);

    Thank you.

    #2
    You are trying to access a bar that doesn't yet exist when the chart is on bar zero. Try adding this at the beginning of the OnBarUpdate() section:

    if(CurrentBar < 1) return;
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Thanks eDanny - jethro likely you run into this issue - http://www.ninjatrader.com/support/f...ead.php?t=3170

      Comment


        #4
        Thanks for the help eDanny and thanks for the link NT Bertrand.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        583 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X