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 CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        27 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        183 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        335 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        260 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X