Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Exit On Close with Multi Time Frame Strategy
Collapse
X
-
Hello Alex,
Yes, true. In such scenario you have to custom code it further using the GetNextBeginEnd method.
http://www.ninjatrader.com/support/h...xtbeginend.htm
-
Originally posted by NinjaTrader_JoydeepYou can also use LastBarOfSession to check it
-Alex
Leave a comment:
-
Hello Alex,
You can also use LastBarOfSession to check it.
Code:BarsArray[0].LastBarOfSession
Leave a comment:
-
Originally posted by NinjaTrader_Joydeep View PostHello mithnadril,
In backtesting ... in a multi series environment the Exit on close is triggered on the primary bar only.
I guess I need to use GetNextBeginEnd to calculate when the strategy is 1 bar from the last bar of the session, and send an exit order for any open position at that time.
-Alex
Leave a comment:
-
Hello mithnadril,
In backtesting orders are submitted at the end of the bar. If you submit the order in the last bar of the session then orders get executed on the next day. However in a multi series environment the Exit on close is triggered on the primary bar only and as such you will have a scenario like this.
Please further custom code your strategy and please make sure you are not submitting any entry order at the last bar of session.
Leave a comment:
-
oops... the line 82 should read private int OrderBars =1 ... this change was from my own testing, the actual version is attached.
The screen shows the trades tab ordered using the exit name. The date format ist german, Day . Month . Year, Ths sample uses FDAX data with default session template.
the screenshot was made with start Jan 1, 2012, Data Series 5 minutes
Leave a comment:
-
Hello mithnadril,
To assist you further can you post a screenshot depicting the scenario you are facing.
Also in your sample code you are submitting the orders on the primary bar series only and not in the secondary series.
I look forward to assisting you further.
Leave a comment:
-
Exit On Close with Multi Time Frame Strategy
Hello,
I oberserved strange executions in the strategy analyzer when I use a MTF strategy with unmanaged orders. If the orders are placed in the secondary time frame, the entry order is executed on the bar of the next day and the exit order is executed immediately. The entry and exit times in the Trades tab show an exit time before the entry time.
Attached is a sample strategy I used to pinpoint the problem, it is just the plain order logic, anything else removed.
changing line 82 to "private int OrderBars = 0;" shows the correct result.Attached FilesTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by alanlopen, 03-18-2023, 03:05 AM
|
5 responses
28 views
0 likes
|
Last Post
![]()
by alanlopen
Today, 07:52 PM
|
||
Started by ttodua, 03-01-2019, 05:17 AM
|
24 responses
367 views
0 likes
|
Last Post
![]()
by StoneMan78
Today, 07:25 PM
|
||
Started by torento, 03-16-2023, 06:02 AM
|
5 responses
72 views
0 likes
|
Last Post
![]()
by torento
Today, 07:23 PM
|
||
Started by paypachaysa, 03-18-2023, 09:22 AM
|
4 responses
35 views
0 likes
|
Last Post
![]()
by paypachaysa
Today, 07:17 PM
|
||
Started by alanlopen, Yesterday, 03:40 AM
|
4 responses
17 views
0 likes
|
Last Post
![]()
by alanlopen
Today, 07:06 PM
|
Leave a comment: