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

Help with Color Bar indicator

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

    Help with Color Bar indicator

    This simple ColorBar indicator is not working. Can someone help?
    Here is the code:
    ====================
    protected override void OnBarUpdate()
    {
    //Are there enough bars
    //if (CurrentBar < Period) return;
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.

    if (Close[0] > Open[0] && Close[0] > High[1])
    {
    BarColor = Color.Blue;
    }
    else if (Close[0] < Open[0] && Close[0] < Low[1])
    {
    BarColor = Color.Red;
    }

    else if (Close[0] >= Low[1] && Close[0] <= High[1])
    {
    BarColor = Color.Black;
    }

    }
    ===============
    end
    thanks!!!

    #2
    Hello,

    Please put this at the top of your OnBarUpdate() block and see if it helps:

    if(CurrentBar < 1) return;

    (Or just delete the "//" marks from left of the CurrentBar condition you already have.)

    This link will help:


    What is probably happening is you are referring to an index of 1 before it exists.
    DenNinjaTrader Customer Service

    Comment


      #3
      quick question paint bars

      Hello,

      If you have the paint bar indicator or have ben able to get one do you mind sharing?

      I use only bars when trading, I see there are lots of heikin ashi indicators
      in this forum but nothing for strickly bars?

      Please let me know, if I have to pay I will.

      thanks,

      Colin

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by lorem, Today, 09:18 AM
      1 response
      4 views
      0 likes
      Last Post lorem
      by lorem
       
      Started by bmartz, Today, 09:30 AM
      0 responses
      1 view
      0 likes
      Last Post bmartz
      by bmartz
       
      Started by GussJ, 03-04-2020, 03:11 PM
      14 responses
      3,244 views
      0 likes
      Last Post GussJ
      by GussJ
       
      Started by ArkansasClint, Today, 09:28 AM
      0 responses
      0 views
      0 likes
      Last Post ArkansasClint  
      Started by hazylizard, Today, 08:38 AM
      4 responses
      12 views
      0 likes
      Last Post hazylizard  
      Working...
      X