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 Quick Summary with 1 posts (0 thanks)
    4. looks_4 edstar with 1 posts (0 thanks)
    1. trending_up 1,826 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 5 attachments




 
Search this Thread

StopLoss Order Placed on Opposite of Entry Order

  #1 (permalink)
goodoboy
Houston
 
Posts: 380 since Dec 2016
Thanks Given: 344
Thanks Received: 246

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:	184
Size:	389.5 KB
ID:	238090   Click image for larger version

Name:	error3.jpg
Views:	238
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?
ZombieSqueeze
Platforms and Indicators
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
32 thanks
Just another trading journal: PA, Wyckoff & Trends
26 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425



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: 380 since Dec 2016
Thanks Given: 344
Thanks Received: 246


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,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


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: 380 since Dec 2016
Thanks Given: 344
Thanks Received: 246


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:	164
Size:	19.6 KB
ID:	302874  
Reply With Quote




Last Updated on July 14, 2020


© 2024 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 - Privacy Policy - Downloads - Top
no new posts