Thanks.
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
Starting strategies with an open position?
Collapse
X
-
Starting strategies with an open position?
I'm trying to figure out why when I start a strategy it says there is a position entered and the unrealized PNL is fluctuating. When I shut everything down, I made sure that there were no open positions and had flattened everything. I also don't hear that orders have been filled. It seems like there is a "ghost" order. Is there any reason for this?
Thanks.Tags: None
-
Your strategy always manages a virtual position that may or may not reflect your accounts actual position. When you start a strategy, it calculates historical what your strategy has done and its current state. This state may include an open position. If you want to sync your account and strategy position you can place an order into your account via the Control Center.
Alternatively, you can include:
if (Historical)
return;
So your strategy will not process on the historical data of your chart.RayNinjaTrader Customer Service
-
Originally posted by NinjaTrader_Ray View PostYour strategy always manages a virtual position that may or may not reflect your accounts actual position. When you start a strategy, it calculates historical what your strategy has done and its current state. This state may include an open position. If you want to sync your account and strategy position you can place an order into your account via the Control Center.
Alternatively, you can include:
if (Historical)
return;
So your strategy will not process on the historical data of your chart.
return; code?
Comment
-
Hello jmahon,
Thanks for your post.
In NinjaTrader7, to prevent the historical data/trades from being processed you can have the code "return" if it processing historical data.
In OnBarUpdate() you can add:
if (Historical) return; // do not process your code below this line if historical
Please note that this means you would not be able to run backtests in the strategy analyzer. You may want to create a user input that allows you to turn on or off historical trades by enabling (or not) the above code line.
Reference: https://ninjatrader.com/support/help...historical.htmPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ETFVoyageur, Today, 07:05 PM
|
0 responses
7 views
0 likes
|
Last Post
by ETFVoyageur
Today, 07:05 PM
|
||
Started by Orion815, 05-02-2024, 08:39 AM
|
2 responses
18 views
0 likes
|
Last Post
by Orion815
Today, 06:24 PM
|
||
Started by suroot, 02-25-2017, 04:43 AM
|
11 responses
2,551 views
0 likes
|
Last Post
by Zilvercat
Today, 05:36 PM
|
||
Started by Rogers101, 05-05-2024, 11:30 AM
|
16 responses
50 views
0 likes
|
Last Post
by Rogers101
Today, 04:44 PM
|
||
Started by ninza33, Today, 12:31 PM
|
2 responses
12 views
0 likes
|
Last Post
by ninza33
Today, 03:52 PM
|
Comment