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 calculation

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

    strategy calculation

    Hi, In Strategy Builder or a coded strategy is it possible to have the main data series be calculated on bar close, and the additional data series be calculated on each tick? Thanks

    #2
    Hello tunabomb,

    Thanks for your note.

    This would be possible to accomplish in an unlocked script using IsFirstTickOfBar.

    Logic can be separated between Calculate.OnEachTick and Calculate.OnBarClose using IsFirstTickOfBar. Please note that a hosted script will inherit the Calculate mode of the script that hosts it. You can take the following approach to differentiate logic between OnBarClose and OnEachTick processing.

    Please see this reference sample which demonstrates a technique used for those who need to separate their logic to calculate some values on each tick and others only on the close of a bar. You will set your host script to Calculate.OnEachTick and use if(IsFirstTickOfBar) and place all code that needs to calculate once every bar within that condition check. Then place all code that you want to calculate OnEachTick outside of the IsFirstTickOfBar condition check.

    SampleEnterOnceExitEveryTick -https://ninjatrader.com/support/help...either_cal.htm

    Let me know if I may further assist you.​
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sidlercom80, 10-28-2023, 08:49 AM
    177 responses
    2,400 views
    0 likes
    Last Post jeronymite  
    Started by algospoke, Today, 06:36 PM
    0 responses
    6 views
    0 likes
    Last Post algospoke  
    Started by ETFVoyageur, Yesterday, 06:05 PM
    8 responses
    53 views
    0 likes
    Last Post ETFVoyageur  
    Started by futtrader, 04-21-2024, 01:50 AM
    7 responses
    69 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by pibrew, Today, 06:10 PM
    0 responses
    13 views
    0 likes
    Last Post pibrew
    by pibrew
     
    Working...
    X