Thanks in advance.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Error with stop-order
Collapse
X
-
Error with stop-order
Sometimes when a stop order is sent by my strategy, it causes an error because the price (bad/ask) has changed quickly and then the stop-order is not correct. The problem is that the strategy is turned-off automaticly. How can I solve it?
Thanks in advance.Tags: None
-
Hello soyjesus,
How are you setting your stop loss order inside of your code?
Example:
Code:protected override void OnBarUpdate() { if(MarketPosition.Flat != Position.MarketPosition) { //sets stop loss 5 ticks behind average entry price SetStopLoss(CalculationMode.Ticks, 5); } }
JCNinjaTrader Customer Service
-
Hello soyjesus,
So using "CaclulationMode.Price" is going to be an absolute value, which you would want to make sure that it is being reset after the position is closed so that it will not use the same price for the next order that gets processed.
Here is a reference that demonstrates this that you may view at the link below.
You may also add TraceOrders = true to your Initialize() method and you view valuable output related to strategy submitted orders through Tools > Output window to see what price your stop loss is being set to so it is easier to see what is happening.
JCNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by gravdigaz6, Today, 11:40 PM
|
0 responses
3 views
0 likes
|
Last Post
by gravdigaz6
Today, 11:40 PM
|
||
Started by MarianApalaghiei, Today, 10:49 PM
|
3 responses
9 views
0 likes
|
Last Post Today, 11:33 PM | ||
Started by XXtrader, Today, 11:30 PM
|
0 responses
3 views
0 likes
|
Last Post
by XXtrader
Today, 11:30 PM
|
||
Started by love2code2trade, Yesterday, 01:45 PM
|
4 responses
28 views
0 likes
|
Last Post Today, 10:31 PM | ||
Started by funk10101, Today, 09:43 PM
|
0 responses
9 views
0 likes
|
Last Post
by funk10101
Today, 09:43 PM
|
Comment