I have attached a pic of the code and also the orders tab...
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Simple Strategy
Collapse
X
-
Simple Strategy
I put together a simple strategy to test some thoughts on order handling. To keep things very basic, I' kust using a SMA. When it is going up, I add a long at each bar close. When it turns down, I exit all positions and start adding shorts on each down bar. The problem is occuring on the changes from up to down, or visa versa. The strategy does a sell or "buy to cover", and also does a close position. What happens is I end up with same amount of contracts, heading in the opposite direction, instead of starting at 1 again. Am I missing something here? Thx.
I have attached a pic of the code and also the orders tab...Tags: None
-
Try simply eliminate ExitLong and ExitShortOriginally posted by BradB View PostI put together a simple strategy to test some thoughts on order handling. To keep things very basic, I' kust using a SMA. When it is going up, I add a long at each bar close. When it turns down, I exit all positions and start adding shorts on each down bar. The problem is occuring on the changes from up to down, or visa versa. The strategy does a sell or "buy to cover", and also does a close position. What happens is I end up with same amount of contracts, heading in the opposite direction, instead of starting at 1 again. Am I missing something here? Thx.
I have attached a pic of the code and also the orders tab...
When you EnterLong,it will automatically close your short positions and viceversa.
See how it goes.
-
I am not sure exactly how NinjaTrader handles things internally, but what I suspect that since you are exiting and entering on the same tick, NT simply does not have enough time to report that position is flat before you EnterLong or EnterShortOriginally posted by BradB View PostThanks, that works fine, but what I don't understand is... If the position was closed with the ExitLong or ExitShort, there should be no orders left when the next EnterLong or EnterShort fires.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
66 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
149 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
162 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|
||
|
Started by CarlTrading, 05-10-2026, 08:12 PM
|
0 responses
99 views
0 likes
|
Last Post
by CarlTrading
05-10-2026, 08:12 PM
|
||
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
286 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|

Comment