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

Strategy.CalculateOnBarClose=true vs. Indicator.CalculateOnBarClose=false

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

    Strategy.CalculateOnBarClose=true vs. Indicator.CalculateOnBarClose=false

    Hi everyone ,

    I have in my strategy calculateOnBarClose = false. And I need set on my indicators calculateOnBarClose=true;

    Now i have this in my code:

    CalculateOnBarClose = false;
    LPcurrentBidAsk.CalculateOnBarClose = false;
    BBdown.CalculateOnBarClose = true;
    BBup.CalculateOnBarClose = true;
    SBdown.CalculateOnBarClose = true;
    SBup.CalculateOnBarClose = true;
    emATRdown.CalculateOnBarClose = true;
    emATRup.CalculateOnBarClose = true;

    ,but it doesnt work :-(. All indicators are being drawn and redrawn on actual bar after each newcoming tick.

    I need this for cross for 2 SMA's calculation on bar close (cross must was in bar in past). So i try use a CrossBelow(SMA1,SMA2,1) , but it still dont calculate on bar close.

    Thanks for help
    Kellerstein Lukas
    [email protected]

    #2
    Hi Kellerstein, the UI inputs for CalculateOnBarClose take priority over what is set in code. When you add the indicators to the chart, you'll need to specify CalculateOnBarClose = true in the indicator window.

    If you set the strategy to COBC = false, everything in the strategy will be COBC = false, including CrossBelow(SMA1, SMA2, 1).
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hi Austin ,

      So i havent in my strategy any indicator with COBC = false and any indicator with COBC = true ??
      Will be in NT 7 ?

      thanks
      Kellerstein Lukas

      Comment


        #4
        Kellerstein Lukas,

        Sorry I am not sure I follow exactly what you are asking. COBC is already in 6.5 so it will be in 7 as well.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Josh and Austine,
          I need to set global CalculateOnBarClose=false for my strategy. I need method OnBarUpdate() and all what it contains to work all the time during bar when being draw. Not only when it closes. But I need several indicators I use in my strategy to be calculated only from close prices (like I need to know the value of indicator when bar closes, not when being drawn), so to set calculateOnBarClose = true just and only for them.

          The reasoning example: My first signal for the trade comes when SMA1 and SMA2 cross each other on bar close (not when bar is being drawn), but that way I have to set CalculateOnBarClose = false. The second signal is calculated from tick data. This first signal comes true when the two SMAs cross each other durin bar being just calculated (redrawn) and theat is undesirable result. I want this signal to be true only when that happens on bar close data (after bars close).

          Comment


            #6
            This is not possible due to a bug in 6.5 which will be resolved in 7.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              This is not possible due to a bug in 6.5 which will be resolved in 7.
              Hi,
              Did this get fixed?
              I've tried this in NT7, setting the strategy CalculateOnBarClose = false, and the called indicator CalculateOnBarClose = true, but the indicator setting is still being overridden by the strategy setting. Is there some way to do this?

              Comment


                #8
                palinuro, I believe this limitation unfortunately still exists in NT7, please try calling your indicator value then in FirstTickOfBar - http://www.ninjatrader.com/support/h...ttickofbar.htm
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by LawrenHom, Today, 10:45 PM
                0 responses
                3 views
                0 likes
                Last Post LawrenHom  
                Started by love2code2trade, Yesterday, 01:45 PM
                4 responses
                28 views
                0 likes
                Last Post love2code2trade  
                Started by funk10101, Today, 09:43 PM
                0 responses
                7 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  
                Working...
                X