Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Signals from the previous day triggering trades
Collapse
X
-
I will give it a go tomorrow Bernard. What is strange though, if you look at the output window below, it is blank until the session begins, then you have the signals from yesturday and the order and entry is triggered as soon as the session begins, there is not a latent order from the previous day.Originally posted by NinjaTrader_Bertrand View PostHi Mark, then please try running the strategy with a TIF setting of DAY instead GTC - would that change your outcome seen?
I just don;t understand why I have to have a lookback at all, why can't I just apply the stategy on today only?
Version:0.9 StartHtml: 105 EndHtml: 4091 StartFragment: 334 EndFragment: 4059
**NT** Enabling NinjaScript strategy 'ACD/8f88c32f84f54166807e36966fe78ef4' : On starting a real-time strategy - StrategySync= WaitUntilFlat SyncAccountPosition=True EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=ByStrategyPosition ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Str ategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDi sable=True MaxRestarts=4 in 5 minutes
10/05/2011 14:03:00 OR High Established
10/05/2011 14:12:00 Aup Established
11/05/2011 14:00:00 Entered internal PlaceOrder() method at 11/05/2011 14:00:00: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 11/05/2011 14:00:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=0 Currency=425 Si mulated=False
11/05/2011 14:00:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=0 Currency=2500 Simulated=False 10/05/2011 14:18:00 Aup Entry
11/05/2011 14:00:00 Entered internal PlaceOrder() method at 11/05/2011 14:00:00: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
11/05/2011 14:00:00 Ignored PlaceOrder() method: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' F romEntrySignal='' Reason='This was an exit order but no position exists to exit'
10/05/2011 15:39:00 Exit Long ATR
11/05/2011 14:04:00 OR High Established
Comment
-
I just disabled and reenabled with the TIF set to day and the following happened:
You can see it is entering historic orders when the it should not be.Version:0.9 StartHtml: 105 EndHtml: 4648 StartFragment: 334 EndFragment: 4616
**NT** Enabling NinjaScript strategy 'ACD/013ccbeb9abc4f86b2ab0ea2b246f997' : On starting a real-time strategy - StrategySync =WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Str ategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDi sable=True MaxRestarts=4 in 5 minutes
10/05/2011 14:03:00 OR High Established
11/05/2011 14:04:00 OR High Established
11/05/2011 14:05:00 OR High Established
11/05/2011 14:06:00 OR High Established
11/05/2011 14:12:00 Adown Established
11/05/2011 18:53:00 Entered internal PlaceOrder() method at 11/05/2011 18:53:00: BarsInProgress=0 Action=SellShort OrderType=Ma rket Quantity=1 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal='' 11/05/2011 18:53:00 Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=0 Currency=425 Si mulated=False 11/05/2011 18:53:00 Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=0 Currency=2500 Simulated=False
11/05/2011 14:18:00 Adown Entry
11/05/2011 18:53:00 Entered internal PlaceOrder() method at 11/05/2011 18:53:00: BarsInProgress=0 Action=BuyToCover OrderType =Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
11/05/2011 18:53:00 Ignored PlaceOrder() method: Action=BuyToCover OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalNa me='' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'
11/05/2011 17:15:00 Exit Short ATR
**NT** Stop/target handling for strategy 'ACD' set to 'ByStrategyPosition' since currency based stop order was placed.
Very confusing!
Comment
-
MinBarsRequired is currently set to 2. So would this look back 2 bars into the previos session at the start of a new one?Originally posted by NinjaTrader_Bertrand View PostThen the TIF change would likely not make a difference here - the question then remains : what about the code logic would result in a signal being issued here?
The lookback needed is determined by MinBarsRequired, you can set this to 0 and then just roll the strategy forward.
The confusing thing is it works perfectly when backtested.
Is there anyway of resticting when an entry happens from when the entry conditions are met? What appears to be happening is the code is running over the historic code and then entering positions because the conditions were set at some point in the past.
Comment
-
Hello MJUK10,
Yes, this was the suggestion in Post #6.
You can add if (Historical) return; to top line of OnBarUpdate() and it will exclude strategy processing on historical bars.Ryan M.NinjaTrader Customer Service
Comment
-
All ready added that Ryan as well as all the other suggestions and it had no effect.Originally posted by NinjaTrader_RyanM View PostHello MJUK10,
Yes, this was the suggestion in Post #6.
You can add if (Historical) return; to top line of OnBarUpdate() and it will exclude strategy processing on historical bars.
Comment
-
Thanks Brett
For some reason my virus software won't let me attach the code to my email. I have realised however the if(historical) function could be in the wrong place. I have a If(BarsinProgress==0) function at the top and the historical function was outside of the brackets for this function so this could be why it wasn't working? I have put the historic function inside the BarsinProgress fuctions brackets like so:
OnBarUpdate()
{
If (BarsInProgress==0)
{
If(Historical)
return;
REST OF THE CODE
}
Is this correct?
Thanks
Mark
Comment
-
Please for example this simple HMA indicator example attached - you see it will only process realtime seen bars, no historical ones. It would be easiest if Print the CurrentBar and Time after the historical statement sitting at the top of your OnBarUpdate() method, this way you see exactly which bars are then processed by it after the Historical addition. It would also be important to apply a new strategy instance after editing / compiling changes in.Attached Files
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
671 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
379 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 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
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
582 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment