Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
      BertrandNinjaTrader Customer Service

      Comment


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        0 responses
        2 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X