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!
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
NinjaTrader
strategy calculation
Collapse
X
-
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
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
by jeronymite
Today, 06:43 PM
|
||
Started by algospoke, Today, 06:36 PM
|
0 responses
6 views
0 likes
|
Last Post
by algospoke
Today, 06:36 PM
|
||
Started by ETFVoyageur, Yesterday, 06:05 PM
|
8 responses
53 views
0 likes
|
Last Post
by ETFVoyageur
Today, 06:35 PM
|
||
Started by futtrader, 04-21-2024, 01:50 AM
|
7 responses
69 views
0 likes
|
Last Post Today, 06:31 PM | ||
Workspaces
by pibrew
Started by pibrew, Today, 06:10 PM
|
0 responses
13 views
0 likes
|
Last Post
by pibrew
Today, 06:10 PM
|
Comment