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
Understanding start behavior
Collapse
X
-
Chelsea:
I inserted your code into the strategy. I don't necessarily want to prevent the strategy from processing historical data, but I do want to be able to apply the script and begin executing trades immediately, without waiting for the virtual order to close the historical position, when I see signs from price action that the market has temporarily converted into a sideways market. Can you tell me if I inserted the script properly? The strategy appear to still function, but I don't know if it will accurately begin generating signals on live data immediately.
OneMinSwingIndScalpCloseOnRevC345StartNow.zip
Thanks-
Rick
-
I have been trying to study C#, but since this will be by first time unlocking code, where should I place this? And I assume I begin at the "if" statement?
Leave a comment:
-
Hello Bionian,
The strategy will process historical data before real-time data.
Historical orders will appear on the chart.
https://ninjatrader.com/support/foru...442#post782442
With Wait until flat, if the strategy calculates a historical position open, it will wait until a virtual order closes the historical position before placing any real-time orders.
Once the strategy has become flat or crossed through flat, the strategy name will become green indicating the strategy is now sending real-time orders.
https://ninjatrader.com/support/foru...541#post811541
To prevent a strategy from processing any historical data use:
if (State == State.Historical)
return;
To exit a position on the last historical bar use:
if (State == State.Historical && CurrentBar == Count - 2)
{
if (Position.MarketPosition == MarketPosition.Long)
ExitLong();
if (Position.MarketPosition == MarketPosition.Short)
ExitShort();
}
- Likes 1
Leave a comment:
-
Understanding start behavior
Please help me to understand Start Behavior for a strategy. I currently have the behavior set to "Wait until flat, synchronize account". But I just activated a strategy, and on the chart it shows that there is an active short on the chart. I believe currently the strategy will wait until that trade finishes, and then it will start initiating trades once the strategy is flat. How can I get the strategy to activate a trade on the NEXT signal, without having it activate immediately based on the last signal?Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jonafare, 12-06-2012, 03:48 PM
|
5 responses
3,985 views
0 likes
|
Last Post
by rene69851
Today, 01:44 PM
|
||
Started by Fitspressorest, Today, 01:38 PM
|
0 responses
2 views
0 likes
|
Last Post Today, 01:38 PM | ||
Started by Jonker, Today, 01:19 PM
|
0 responses
2 views
0 likes
|
Last Post
by Jonker
Today, 01:19 PM
|
||
Started by futtrader, Today, 01:16 PM
|
0 responses
8 views
0 likes
|
Last Post
by futtrader
Today, 01:16 PM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,792 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
Leave a comment: