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 aa731, Today, 02:54 AM
      0 responses
      4 views
      0 likes
      Last Post aa731
      by aa731
       
      Started by thanajo, 05-04-2021, 02:11 AM
      3 responses
      469 views
      0 likes
      Last Post tradingnasdaqprueba  
      Started by Christopher_R, Today, 12:29 AM
      0 responses
      10 views
      0 likes
      Last Post Christopher_R  
      Started by sidlercom80, 10-28-2023, 08:49 AM
      166 responses
      2,237 views
      0 likes
      Last Post sidlercom80  
      Started by thread, Yesterday, 11:58 PM
      0 responses
      4 views
      0 likes
      Last Post thread
      by thread
       
      Working...
      X