Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Variable Stop Loss and Profit Target
Collapse
X
-
Variable Stop Loss and Profit Target
I am trying to use Strategy Builder to mark a specific signal bar if certain criteria are made. The order entry will occur either 1 tick above or below that signal bar if prices cross that mark within the next 3 bars. I'd like to take certain info from that signal bar and use it to place my stop loss and profit target. I need the stop loss to be 1 tick above or below the signal bar (not just the previous bar to the order entry). I also want my profit target to be the same size as the signal bar (in ticks). See the attached screenshot to see how I am currently capturing that info. For some reason it doesn't seem to be working. When an order is triggered, it is almost immediately stopped out because the stop loss is placed right next to order entry and not above or below the signal bar. Any idea on what I'm doing wrong?Tags: None
-
Hi srtrader, thanks for posting.
It's likely the stop loss is too close to the market price to be effective. Typically if you have a stop loss this close to the market price, you will need error handling logic within OnOrderUpdate in the case where the price moves before the order get submitted and the order is rejected. Having rejection/error handling logic in OnOrderUpdate will let you re-submit an order if it gets rejected.
First test your strategy by placing your stop loss further away from market price and see if the same error happens.
Kind regards,
-ChrisL
Comment
-
No problem here you go. I've attached a screenshot of the chart with an example of the setup and what I'm trying to accomplish and screenshots of the Strategy Builder. The signal bar and order entry seem to work fine, it's just the placement of the stop loss and target that seems to not work properly. Let me know if you need more info or clarification on this. Thanks again so much for the help!
Comment
-
Hi srtrader, I appreciate the screenshots. The SetStopLoss and SetProfitTarget methods can not take data from the script while it is running. The stop and target are set up in State.Configure so you can only use hard coded values for the stop and target method. You must use Exit orders within your sets to get a stop and target to function this way. See here for an example:
Kind regards,
-ChrisL
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment