Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
NT checking my stop order price against the wrong timeframe Bar
Collapse
X
-
All I know is that I sent over my strategy to you guys and one of you says my strategy is too complelx, one of you says I'm "cheating" and now you say I need to submit against the first tick of the new bar and basically none of this advice makes much sense to me.Originally posted by NinjaTrader_Josh View PostYou cannot backtest trade on the close of a signal bar because the bar has already closed. There is no more tradeable locations on that bar. A closed bar is terminal and is impossible to trade on. Next tradeable location is the open of the next bar and that is where you will see the trade show up. Unfortunately allowing the trade to go on a historical point in time in a backtest is "cheating".
As the title of the thread states, I think NT has got a problem. I thought there was more and I told you what I thought the symptoms were (with the BIP and the timestamp in the OrderUpdate & Execution events), so unless you say something to the contrary now, I'm going to stick with my strategy with the work-around, because it works in backtesting and it works in simulated trading, and maybe I'll have time to boil down my ninjascript into something short that shows the issue.
Thanks
Comment
-
Checking prices is not a "cheat". "Cheating" would be placing orders at a moment in time which has already passed. Meaning you cannot see data from the future and then after seeing such data decide that you wanted to back pedal and place a trade 1 second ago. This is already prohibited and not possible to be done in NT.Josh P.NinjaTrader Customer Service
Comment
-
After reading this thread, I believe I am having the same problem Adamus is having.
I am calculating indicator values on a 5 min bar (BIP=0) and entering trades on a 1 min bar(BIP=1). I submit a stop order in OnExecution after an entry is filled. I'm using ExitShortStop to submit the stop order.
Here is logging data from the Output window showing a Short entry at 1.2685 on the 6:33 bar. The stop order submitted at 1.2694 was rejected even though it is above the high of the 6:33 bar. I believe it was rejected because it is below the high of the 5 min bar at 6:35.
I've also attached a screen shot. The top frame is 5 minute bars, the bottom frame is 1 minute bars.PHP Code:8/20/2010 06:33:00 EURUSD 5 Qty=0 Short Entry Conditions Met 8/20/2010 06:33:00 EURUSD 5 Qty=0 Short Entry 8/20/2010 06:33:00 EURUSD 5 Qty=0 High[0]=1.2692 < dSRValue-Stop0Ticks*TickSize=1.2694 8/20/2010 06:30:00 EURUSD 5 Qty=60000 In OnExecution 8/20/2010 06:30:00 EURUSD 5 Qty=60000 Order ID => NT-00021, Current Order => Order='NT-00021/Sim101' Name='Short' State=Filled Instrument='$EURUSD' Action=SellShort Limit price=0 Stop price=0 Quantity=0.06M Strategy='SineWaveBreakout_Dev' Type=Market Tif=Gtc Oco='' Filled=60000 Fill price=1.2685 Token='39bee9699d5a4cb7af4fe7d27a035be6' Gtd='12/1/2099 00:00:00' 8/20/2010 06:30:00 EURUSD 5 Qty=60000 Short Entry Fill at 1.2685 **NT** A BuyToCover stop order placed at '8/20/2010 06:30:00' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy. 8/20/2010 06:30:00 EURUSD 5 Qty=60000 Submitted Stop S0, 60000 at 1.2694 8/20/2010 06:30:00 EURUSD 5 Qty=60000 Submitted Target T1, 20000 at 1.268
Comment
-
I'm writing a new strategy and I'm getting the same error message as I showed before when trying to submit stop orders in the OnExecution() event.Originally posted by NinjaTrader_Josh View PostYou cannot backtest trade on the close of a signal bar because the bar has already closed. There is no more tradeable locations on that bar. A closed bar is terminal and is impossible to trade on. Next tradeable location is the open of the next bar and that is where you will see the trade show up. Unfortunately allowing the trade to go on a historical point in time in a backtest is "cheating".
I work out where I want to place my stop based on the entry. How do I test that I have a valid price for my stop when the OnExecution method isn't linked to any bars and the close price of the current bar is inaccessible?09/09/2010 14:28:44 Strategy A Buy order placed at '22/09/2009 02:00:00' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.Last edited by adamus; 09-09-2010, 08:11 AM.
Comment
-
Adamus,
I have not tried it yet, but I wonder if using ExitShortStop or ExitLongStop with the following signature will solve the problem.
ExitShortStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity,double stopPrice,string signalName,string fromEntrySignal)
If I understand this correctly, barsInProgressIndex should link the order to the correct BIP.
Comment
-
Hi Greg, I already do that. It's not the BIP alone that's the problem, it's a combination of the logic for submitting orders (particularly in backtesting) and the hidden price check logic on stop orders that NT does.
There must be a logical method but I'm currently in the dark about it.
Just realised that it's also happening to Stop orders submitted during OnBarUpdate().
First things first, during OnBarUpdate(), I have access to the Close of the bar. So I want to use that to submit a stop order, but I'm generating a batch of NT errors saying that the Stop is the wrong side of the market. Not all the time, just about 25% of the time.
Comment
-
I have nailed this one.
Would you give me your attention for a minute on this one? I'm beginning to suspect you've flagged this thread with "ignore".
The strategy I am writing is a multi-instrument strategy trading $EURUSD and $EURGBP.
I just looked through the TraceOrders output and realised that it is only throwing this error on long orders on the second instrument.
NT is consistently refusing to enter buy stop orders for $EURGBP stating that they are all invalid due to being lower than the market. This is even in places when the market never even reached that price!
So I figure what is happening is that NT is checking the stops against the primary bars. The price of EURUSD (e.g. 1.3456) is always going to be way above any EURGBP price (e.g 0.8989), so my Buy Stop will always look bad.
This explains why the Short stops are always fine.
I can send you my strategy if you give me a bit of time to pull in all the code snippets from the helper files.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
581 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
338 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment