Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Short Position on LONG strategy : RITHMIC vs NT Continuum
Collapse
X
-
Short Position on LONG strategy : RITHMIC vs NT Continuum
I have funny situation. I am running exactly the same strategies that are supposed to be only LONG on exactly same data series, 20 RENKO, on two different servers. One is configured with RITHMIC and another with NT Continuum. Somehow RITHMIC setup managed to have 2Short account position , while NT8 Continuum runs as it should be having only long position. Strategies were started at the same time and have exactly the same unrealized profit. So I am a bit puzzled. I always had little faith in Rithmic function on Renko but this discrepancy just hammers the point the home. How it is possible to have 2 SHORT account positions on LONG strategy is beyound me. Something to do with SYNC perhaps ?Tags: None
-
Hello kazbek966,
Thanks for your post.
The behavior you are reporting doesn't necessarily mean that it is isolated to using a specific broker. It may just be that the same logic didn't happen at the same time on the other test.
Are you calling Entry and Exit methods in the same condition in your script?
This could cause a double reverse to occur which could lead to seeing the behavior you reported.
You must make sure that the Entry and Exit methods are not called in the same condition in your script.
When calling an entry method in the opposite direction of your position this will cause your position to be reversed. NinjaTrader will automatically submit an order to close your existing position and then enter an order to enter you into the opposite position.
If you exit and then call an entry method in the same run of OnBarUpdate, the OnPositionUpdate() will not have yet run and NinjaTrader will not have known that your position is closed. It takes time for an order to be submitted, processed, transmitted, accepted, working, filled, and then for NinjaTrader to process the fill and update the position. This will not happen in the same bar update, it will take time.
The result will cause both actions to complete and end up sending 3 orders. The first order is the exit position from your exit method, the second order is to close the position from NinjaTrader automatically reversing your position, the third order is to enter you into the opposite position.
The result is that either the script will double the quantity when it reverses or it will cause an overfill and stop the script.
From the help guide: "Entry() methods will reverse the position automatically. For example if you are in a 1 contract long position and now call EnterShort() -> you will see 2 executions, one to close the prior long position and the other to get you into the desired 1 contract short position."
https://ninjatrader.com/support/help...d_approach.htm<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Hi Brandon,
Upon further examination I found that there is slight differences in both scripts ,
but nevertheless examination of abnormal one would be of interest. I am enclosing part of the script.
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
VolumeUpDown1 = VolumeUpDown(Close);
AuMovingMedian1 = AuMovingMedian(VolumeUpDown1.UpVolume, Convert.ToInt32(PERIOD));
AuMovingMedian2 = AuMovingMedian(VolumeUpDown1.DownVolume, Convert.ToInt32(PERIOD));
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress != 0)
return;
if (CurrentBars[0] < 1)
return;
// Set 1
if ((Position.MarketPosition == MarketPosition.Flat)
&& (AuMovingMedian1.MovingMedian[0] > AuMovingMedian2.MovingMedian[0])
&& (AuMovingMedian2.MovingMedian[0] == 0))
{
EnterLong(Convert.ToInt32(DefaultQuantity), "");
}
// Set 2
if ((Position.MarketPosition == MarketPosition.Long)
&& (AuMovingMedian2.MovingMedian[0] > 0))
{
ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
}
}
As we can see there are two sets. SET1 has two conditions for entrance, except Market position. SET2 has 1 condition for exit. Logic wise sheer number and conditions themselves for entry and exit are different. Script wise seems to me as well , unless script implementation has its own logic.
Any further comments ?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
104 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
52 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
34 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
38 views
0 likes
|
Last Post
|
||
|
Started by Mindset, 02-28-2026, 06:16 AM
|
0 responses
74 views
0 likes
|
Last Post
by Mindset
02-28-2026, 06:16 AM
|

Comment