Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

HeikenAshi Bar Color

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

    HeikenAshi Bar Color

    What's the trick to changing a HeikenAshi bar color in a strategy ?

    I've tried HeikenAshi().BarColor = Color.Black but, the indicator colors remain...

    Thank you in advance for any suggestions

    #2
    Hello Randwulf,

    Thank you for writing in. The Heiken Ashi is not configured by default to be able to change the bar color programatically. You can however accomplish this using code. Please follow the steps below:
    1) Navigate to Tools -> Edit NinjaScript -> Indicator -> HeikenAshi
    2) Right Click in the code editor and select Save As.
    3) Save it as "CustomHeikenAshi" and press OK.
    4) Scroll down to line 112 and delete it.
    Code:
    [Gui.Design.DisplayNameAttribute("Down color")]
    5) Change the next line from:
    Code:
    [Category("Visual")]
    to the following:
    Code:
    [GridCategory("Parameters")]
    6) Scroll down to line 132 and delete it.
    Code:
    [Gui.Design.DisplayNameAttribute("Up color")]
    7) Change the next line from:
    Code:
    [Category("Visual")]
    to the following:
    Code:
    [GridCategory("Parameters")]
    8) Press F5 on your keyboard to compile the new code
    9) Then close the code editor and switch to your strategy code.
    10) You would use the following code in your strategy to add a HeikenAshi indicator with different colored bars:
    Code:
    Add(CustomHeikenAshi(Color.Crimson, Color.LightYellow)); //First color for down bars, then color for up bars.
    Please let me know if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Thx 4 the reply Michael.
      I appreciate the time that you took to complete the reply and I will keep the code in mind for future reference.
      However, I simply wanted to change the color of a few bars that were in chop and leave my default DarkRed & DarkGreen active.
      After finding no way programmatically to change a few bars, I simply tried having the strategy draw wide, colored lines from HeikenAshi().HAOpen to HeikenAshi().HAClose...
      Much to my surprise, the bars look just like the bar color was changed.
      I also coded the strategy Z-Order to ensure that the lines would always be on top.

      Thx again for your support.
      Last edited by Randwulf; 10-18-2015, 05:43 AM.

      Comment


        #4
        Hello Randwulf,

        Thank you for the update. I am glad to hear you were able to find a solution and thank you for updating the forums in case any other users run into similar issues.

        Please let us know if we may be of further assistance anytime.
        Michael M.NinjaTrader Quality Assurance

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X