This causes problems because now all of my variables have been affected by historical data. For example, I have a variable that tracks my PnL and this causes it to have a value based on historical data, when it should be starting at 0. Now my strategy PnL is different from my account PnL. This is just one example, but it would be great if this could be disabled somehow.
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 Historical Execution
Collapse
X
-
Strategy Historical Execution
Forgive me for what I'm sure is a completely novice question, but I've been unable to find any information about this. When a strategy is enabled, why does it run retroactively through historical data first? As in, when I enable a strategy it appears to run through some number (I'm not sure how many) of bars on the chart before reaching the current "present" bar. Is there any way to disable this behavior?
This causes problems because now all of my variables have been affected by historical data. For example, I have a variable that tracks my PnL and this causes it to have a value based on historical data, when it should be starting at 0. Now my strategy PnL is different from my account PnL. This is just one example, but it would be great if this could be disabled somehow.Tags: None
-
Hello,
Thank you for the post.
This is simply how the platform works, bars are evaluated from left to right starting at bar 0 in historical data. If you load X amount of data, all of that data would be processed. In the case you want to omit historical data from being used, you can.
If you are manually coding, you would just need to check that the state is not equal to Historical:
Code:protected override OnBarUpdate() { if(State == State.Historical) return;
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by alifarahani, Today, 09:40 AM
|
6 responses
31 views
0 likes
|
Last Post
by alifarahani
Today, 03:18 PM
|
||
Started by Waxavi, Today, 02:10 AM
|
1 response
17 views
0 likes
|
Last Post Today, 03:03 PM | ||
Started by Kaledus, Today, 01:29 PM
|
5 responses
13 views
0 likes
|
Last Post Today, 02:56 PM | ||
Started by Waxavi, Today, 02:00 AM
|
1 response
12 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
17 views
0 likes
|
Last Post Today, 02:41 PM |
Comment