NexusFi: Find Your Edge


Home Menu

 





StopLoss Order Placed on Opposite of Entry Order


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one goodoboy with 3 posts (2 thanks)
    2. looks_two ratfink with 2 posts (0 thanks)
    3. looks_3 edstar with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,431 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 5 attachments




 
Search this Thread
  #1 (permalink)
goodoboy
Houston
 
Posts: 396 since Dec 2016
Thanks Given: 366
Thanks Received: 262

Hello,

I am sim testing my first strategy in NT7.

Strategy Information:
Managed Approach from the wizard with the following in NT7. I unlock the code to add additional code
I am using limit orders to enter the market, then NT auto creates a OCO bracket orders for stoploss and profit order.
EnterLongLimit()
EnterShortLimit()
SetStopLoss()
SetProfitTarget()

Problem

Sometimes (normally during high volume price action) when the entry limit order is filled, instantly I get an error (see attachment) that the stop order is placed on the profit side of the trade. For example, if a long order is filled, the stop order is being placed above the entry price. This causes the Order Rejection and causes the strategy to disable. This happen on the long and short side.

I am using a -30 tick stop loss, and after the Order Rejection occurs, I never see the market prices below my original stop loss price. So the stop loss is just plain being placed on the wrong side of the trade for no apparent reason. I never see price move more then 5-7 ticks towards the stop loss price. So may not be related to high volume.

This problem does not occur often, but it worries me when it happens. I am trading sim until problem is resolved.

I have discussed this issue with NT support on email, but they tell me somewhere in my code is the problem. I can not find the bug.

I attached my code for review and errors.

Questions

1. From your experience with NT, do you recommend I move towards UnManaged Approach? I like Managed Approach because my coding skills is still in the beginner stages and learning.

Thank you kindly.


Attached Thumbnails
Click image for larger version

Name:	error.jpg
Views:	242
Size:	389.5 KB
ID:	238090   Click image for larger version

Name:	error3.jpg
Views:	352
Size:	815.6 KB
ID:	238092  
Attached Files
Elite Membership required to download: strategy.txt
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CME Group Fee Schedule Changes Hit All Four Exchanges -- …
Traders Hideout
Prop Firm Tracked Payouts Hit $115M in Q1 but Growth Fla …
Funded Trading Evaluation Firms
Double Deadlock: Rubio Calls Hormuz Tolls "Unfeasib …
Traders Hideout
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430



goodoboy View Post
Sometimes (normally during high volume price action) when the entry limit order is filled, instantly I get an error (see attachment) that the stop order is placed on the profit side of the trade. For example, if a long order is filled, the stop order is being placed above the entry price. This causes the Order Rejection. This happen on the long and short side.

This is normal and a valid rejection if price is moving quickly you have to allow for it. I can't remember all the details but here is some code I wrote a fair while back that might help.





Pretty sure I got around it ok, others took the unmanaged approach, but that is much harder work and I didn't like the risk involved.

Cheers


Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
goodoboy
Houston
 
Posts: 396 since Dec 2016
Thanks Given: 366
Thanks Received: 262


ratfink View Post
This is normal and a valid rejection if price is moving quickly you have to allow for it. I can't remember all the details but here is some code I wrote a fair while back that might help.





Pretty sure I got around it ok, others took the unmanaged approach, but that is much harder work and I didn't like the risk involved.

Cheers

Thank you ratfink for responding.

I edit my original post to be more clearer.

I am using a -30 tick stop loss, and after the Order Rejection occurs, I never see the market prices below my original stop loss price. So the stop loss is just plain being placed on the wrong side of the trade for no apparent reason. I never see price move more then 5-7 ticks towards the stop loss price. So may not be related to high volume.

I believe NT order handling is actually placing the stop loss order on the wrong side of trade.

Have you or anyone else ever seen this issue before?

Thank you kindly.


Reply With Quote
Thanked by:
  #5 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430


goodoboy View Post

Have you or anyone else ever seen this issue before?

No, I didn't.

Just had a quick glance at your code and you seem to be calling the Limit Entries twice

 
Code
				EnterLongLimit(0, true, DefaultQuantity, Variable1, "LONG");
				myEntryOrder = EnterLongLimit(0, true, DefaultQuantity, Variable1, "LONG"); //get the order number
Same is short case, given the same name maybe it just overrides anyway, in which case ignore.

More importantly there are lots of other states in OnOrderUpdate that might be affecting you (e.g Pending, etc), see if the code in KeyTrader can shed any light on it. I've got my head full of too much other stuff at the moment to be much of a shining light..

Cheers


Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
goodoboy
Houston
 
Posts: 396 since Dec 2016
Thanks Given: 366
Thanks Received: 262


ratfink View Post
No, I didn't.

Just had a quick glance at your code and you seem to be calling the Limit Entries twice

 
Code
				EnterLongLimit(0, true, DefaultQuantity, Variable1, "LONG");
				myEntryOrder = EnterLongLimit(0, true, DefaultQuantity, Variable1, "LONG"); //get the order number
Same is short case, given the same name maybe it just overrides anyway, in which case ignore.

More importantly there are lots of other states in OnOrderUpdate that might be affecting you (e.g Pending, etc), see if the code in KeyTrader can shed any light on it. I've got my head full of too much other stuff at the moment to be much of a shining light..

Cheers

Thank you ratfink for the response and your time.

I removed the additional EnterLongLimit order. Thanks for the review.

I will respond with what I find regarding stop loss occasionally being placed on the wrong side of trade.

Thanks,


Reply With Quote
Thanked by:
  #7 (permalink)
 edstar 
HONG KONG CHINA
 
Experience: None
Platform: NinjaTrader
Trading: Emini ES
Posts: 10 since Aug 2018
Thanks Given: 5
Thanks Received: 4

I too am facing this issue constantly, I am using the shark indicators sofftware to place my trades through the blackbird interface, even a simple trailing stop loss triggers this error for me. Has anyone got any code which can supress the pop up error, it can happen 50+ times for me in a trading session and is so annoying. I have tried to get NT to do this but with no luck



error


Attached Thumbnails
Click image for larger version

Name:	image_684.png
Views:	224
Size:	19.6 KB
ID:	302874  
Reply With Quote




Last Updated on July 14, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts