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
Conditions and Order Management Calculation
Collapse
X
-
Hello KINGKODA,
Calculate.OnEachTick and Calculate.OnBarClose will have different barsAgo indexing, so you would not be able to use the same indexing for Calculate.OnBarClose to get the value for the last tick that comes in. Price Series objects will update based on the Calculate mode.
You could use OnMarketData for level 1 events that come in for each tick, however it should be noted that this is a realtime data stream and will not work historically unless Tick Replay is used.
Additional reference for OnMarketData() can be found here - https://ninjatrader.com/support/help...marketdata.htm
Please let us know if you have any additional questions.
-
Thanks Jim,
The Strategy needs to Calculate.OnEachTick to be able to add if(IsFirstTickOfBar) which calculates onbarclose.
I was wondering if the reverse is possible. To have the Strategy Calculate.OnBarClose, then to add a Syntax for oneachtick calculations.
Would protected override void OnMarketData work? If not, what is possible?
Leave a comment:
-
Hello KINGKODA,
Thanks for your inquiry.
Bar closes are triggered by a "tick through." You could trigger events that occur on bar closes by using IsFirstTickOfBar. The bar that had just closed can be referenced with a BarsAgo of 1 for each Series<t> object. (Close[1] on that tick for the close price of that bar that had just closed. This would be Close[0] for OnBarClose calculation modes.) Your other logic that should occur on each tick should happen outside of this condition.
Code:if(IsFirstTickOfBar) { double CurrentTick = Close[0]; double ClosedBar = Close[1]; }
Please let us know if we can be of further assistance.
Leave a comment:
-
Conditions and Order Management Calculation
Hello,
Is it possible to have my conditions checked OnBarClose and at the same time have my order management conditions updated OnEachTick?
Currently I have everything listed under " protected override void OnBarUpdate() "
What should I do? Is it possible?Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Kaledus, Today, 01:29 PM
|
5 responses
12 views
0 likes
|
Last Post Today, 02:56 PM | ||
Started by Waxavi, Today, 02:00 AM
|
1 response
8 views
0 likes
|
Last Post Today, 02:53 PM | ||
Started by alifarahani, Today, 09:40 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 02:53 PM | ||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
3 responses
16 views
0 likes
|
Last Post Today, 02:41 PM | ||
Started by PhillT, Today, 02:16 PM
|
2 responses
7 views
0 likes
|
Last Post
by PhillT
Today, 02:33 PM
|
Leave a comment: