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 funk10101, Today, 09:43 PM
      0 responses
      6 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      24 views
      0 likes
      Last Post algospoke  
      Working...
      X