Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Setting Calculate gives Compiler Error
Collapse
X
-
Hello jeronymite,
Thanks for your feedback.
I have submitted your request to the Product Management group for consideration.
- Likes 1
-
Thanks, Jim.
I'm already using BarsRequest, and it's good to know the Calculate mode.
I was surprised that trying to use Calculate in an AddOn caused a compile-time error. I would have hoped for a more graceful means of "unavailability".
Also, may I recommend that the documentation be updated to state that Calculate is not available in AddOns, and to refer to BarsRequest and its OnEachTick Calculate mode, please?
Thanks again.
Leave a comment:
-
Hello jeronymite,
Thanks for your question.
Calculate will be available when we are working with a NinjaScript that utilizes OnBarUpdate. This is not available in AddOn where we would need to use BarsRequests to request and process bar data.
BarsRequests do not offer a Calculate mode, but will calculate following OnEachTick processing. We can identify when a bar has closed if the index for the updating bar changes in the BarsRequest update event.
Code:private int last = -1; private void BROnBarUpdate(object sender, NinjaTrader.Data.BarsUpdateEventArgs e) { /* Depending on the BarsPeriod type of your barsRequest you can have situations where more than one bar is updated by a single tick. Be sure to process the full range of updated bars to ensure you did not miss a bar. */ ClearOutputWindow(); // Output bar information on each tick for (int i = e.MinIndex; i <= e.MaxIndex; i++) { if (i != last) { NinjaTrader.Code.Output.Process("NewBar", PrintTo.OutputTab1); last = i; } } }
We look forward to being of further assistance.
Leave a comment:
-
Setting Calculate gives Compiler Error
According to the NT8 Help documentation, one can set Calculate as follows:
Code:protected override void OnStateChange() { if (State == State.SetDefaults) { // Calculate on the close of each bar Calculate = Calculate.OnBarClose; } }
Am I missing something obvious?
Thanks.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by cre8able, Today, 01:16 PM
|
2 responses
9 views
0 likes
|
Last Post
by cre8able
Today, 01:40 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
3 responses
48 views
0 likes
|
Last Post Today, 01:29 PM | ||
Started by samish18, Today, 01:01 PM
|
1 response
7 views
0 likes
|
Last Post Today, 01:25 PM | ||
Started by WHICKED, Today, 12:56 PM
|
1 response
9 views
0 likes
|
Last Post Today, 01:17 PM | ||
Started by WHICKED, Today, 12:45 PM
|
1 response
11 views
0 likes
|
Last Post Today, 01:08 PM |
Leave a comment: