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

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 CortexZenUSA, Today, 12:53 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by CortexZenUSA, Today, 12:46 AM
        0 responses
        1 view
        0 likes
        Last Post CortexZenUSA  
        Started by usazencortex, Today, 12:43 AM
        0 responses
        5 views
        0 likes
        Last Post usazencortex  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        168 responses
        2,265 views
        0 likes
        Last Post sidlercom80  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X