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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment