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
Trouble parametres Developing stretegy
Collapse
X
-
Hello simonerg,
Thanks for your post.
The error message is pretty clear that you are submitting a buy stop (market or limit) order below the current price which results in a rejected order which then disables the strategy.
You would need to correct your strategy coding so that is does not do that.
As we do not know how you have coded your strategy, we could not provide further specific advise.
If you do not wish to share or show your strategy coding in a public forum, please feel free to send it into PlatformSupport[at]NinjaTrader[dot]Com. Mark the e-mail Atten Paul and Ticket#2242523 and include a link to this thread for reference. In addition, include your strategy file which can be found in Documents>NinjaTrader8>bin>Custom>Strategies> and it will have the same name as your strategy.
In most cases, you will want to debug your strategy (we do not provide debugging services), here is a link to our debugging tips which may get you started: https://ninjatrader.com/support/help...script_cod.htm Most likely you will want to compare the stop price you are using to the current price.
Paul H.NinjaTrader Customer Service
- Likes 1
-
Hello simonerg,
Thanks for your reply, glad we were able to help.
For readers of this thread, the issue was created by unexpected entry orders which related to the use of Calculate.OnEachTick. The strategy is run on each tick and when the entry conditions were true they remained true for many ticks thus placing many orders. While the EntriesPerDirection was set to 1, in this OnEachTick mode, the strategy is run before the position can be updated to prevent further orders. The issue was solved by adding an int variable to store the bar number of the bar where the first entry order was placed and in the entry conditions, checking to see that the CurrentBar is not equal to the saved bar number. Example:
if (Entry conditions && CurrentBar != savedBar)
{
// place order here
savedBar = CurrentBar; // store the entry bar
}
Other solutions would be to use a bool variable that is set when the 1st entry occurs and checking the state of the bool as an entry condition, however this would require an addition set of conditions to "reset" the bool to allow for subsequent entries.Paul H.NinjaTrader Customer Service
- Likes 1
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
4 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
22 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
944 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
||
Started by oviejo, Today, 12:28 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:20 AM |
Comment