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

How to prevent a certain calculation to be loaded when CalculateBarClose is FALSE

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

    How to prevent a certain calculation to be loaded when CalculateBarClose is FALSE

    Hi,
    I have a strategy that I found out to be generating better results when ran in CalculateOnBarClose = False

    This is why I am looking to easily and effectively add one additional controller as a criteria to each of the formulas that would result in "False" statement and thus way I will be able to filter out all of the things that I do not need to run while in realtime calculation.

    Any Ideas how I can achieve this?

    Thanks!

    #2
    Hello,

    Thank you for the question.

    You can essentially set a script to CalculateOnBarClose = false but also do some things if it were using true by using FirstTickOfBar.



    Here is a simple example:

    Code:
    protected override void OnBarUpdate()
    {
        if (FirstTickOfBar)
        {
             //code in here is executed only on each first tick of the bar or after the Close of the bar just like CalcualteOnBarClose = true; 
        }
    //anything outside would be processed as CalculateOnBarClose = false; 
    }
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Try this to filter your sections of code that only need to run on a tick by tick basis:

      if(!CalculateOnBarClose)
      {
      Do it!
      }
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,227 views
      0 likes
      Last Post xiinteractive  
      Started by andrewtrades, Today, 04:57 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      7 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      440 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      12 views
      0 likes
      Last Post FAQtrader  
      Working...
      X