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

CalculateOnBarClose=false for paint bars

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

    CalculateOnBarClose=false for paint bars

    Hi Everyone, using CalculateOnBarClose=false for paint bars, lets say a condition to paint inside bars:

    #region Variables
    private Color color2 = Color.Yellow;
    ------------------
    protected override void OnBarUpdate()
    if (High[0] < High[1] && Low[0] > Low[1] )
    CandleOutlineColor = Color2;

    Now if the bar starts as an inside bar, wich almost every bar does, and then before the close of this bar it changes to a High[0]>High[1] && Low[0]>Low[1] for example, the bar is still painted because the condition was met some point during the construction of that bar.

    My question is how to evercome this limitation for paint bars?
    Thanks for the support your company is the best for both software and support.

    Marreta
    Last edited by marreta; 02-26-2015, 12:58 PM.

    #2
    Hello Marreta,

    Thank you for posting.

    You would want to use CalculateOnBarClose to true so that at the end of the bar being built it gets processed correctly.

    Otherwise, you will need to have additional checks for when this condition is no longer true and change the color back on the bar.

    So -
    Code:
    if(High[0] > High[1] && Low[0] > Low[1])
    CandleOutlineColor = Color.Black;
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Cal, perfect example. Thats what I needed. Thank you verry much.

      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