Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Request Breakeven Functions in Strategy Builder
Collapse
X
-
HelloOriginally posted by NinjaTrader_ChrisL View PostHello Santillana1971, thanks for your reply.
You must separate the logic, so yes you would need 4 trigger states if you need the strategy to go long and short. Regrettably, I can not modify existing examples or create new ones for specific issues, this is so we can assist as many clients as we can effectively. If you come across problems, I will try to help. Please provide code you have tried and what exactly is not working.
Best regards.
When I try both Long and Short's strategies separately they work for me but when I combine them, don´t work as one. see attached strategy code with long/short ways.
ThanksAttached Files
Leave a comment:
-
Hello Santillana1971, thanks for your reply.
You must separate the logic, so yes you would need 4 trigger states if you need the strategy to go long and short. Regrettably, I can not modify existing examples or create new ones for specific issues, this is so we can assist as many clients as we can effectively. If you come across problems, I will try to help. Please provide code you have tried and what exactly is not working.
Best regards.
Leave a comment:
-
ChrisL I could finally do it!!! But now i have 2 strategies: one for Long and one for Short (jajajaja). I have the last question I hope: to engage them, the Trigger State which have from 0 to 2 states for the long example, i must to set 4 trigger satates?
Leave a comment:
-
CrisL, in the same way like your coworker ChelseaB did at the beginning of this chains of post, could you please send me the example script with BE to short trade? I have done everything and I can not make it work, I feel frustrated. See attached waht Chelsea sent us at the beginning just for Long trades. It seems simple, but it is not. I have changed Enter Long for Enter short trade, i´ve changed Initial Stop Distance from negative value to positive because Stoploss have to be set above entry position, but none of that works for me, I don't know what else to do.
Please open the script and do the changes, I will be thankful
Attached Files
Leave a comment:
-
Hello, Santillana1971, thanks for the follow up.
From piecing the scenario together, It seems like by the time 5 ticks of profit was seen, the price had already went at or below the average entry price. Was this the case when you ran the strategy? They only reason you are getting the error message is because the strategy is submitting the stop to an illegal price level, so its fixable (try submitting a few ticks above average entry, or check the current price of the market before submitting the order).
Leave a comment:
-
I have realized that the problem is the trigger to move stop to breakeven. The stop loss is already working , that is, when the short trade enters, the stop is placed in the indicated position (InitialDistanceStop=10 tick). but when the price moves 5 ticks against, it closes the trade showing the error message "Buy stop order can´t be placed below the market".
5 ticks is the Breakeven trigger input. I have tried it with negative and positive values and in both cases strategy close at the close of the entry bar. i give up!
Leave a comment:
-
YES! i´m agree with you, Stop loss order need to go above averge entry price. in the example stop is named Initial DistaceStop and for the shorts it value must be positive (no negative like Long example). i set it up in this way but it doesn´t work.Originally posted by NinjaTrader_ChrisL View PostHello Santillana1971, thanks for your reply.
If you try to set a buy stop market order below average entry price the order will be rejected. Stop loss orders for sell orders need to go above average entry price. It looks like you were able to find the long version of the strategy. Jim originaly posted it in this thread.
Best regards.
please see attached my exampleAttached Files
Leave a comment:
-
If you refer to the example i attached, yes. I'm over writing the example with the suggested changes here but it still doesn't work for shortsLast edited by Santillana1971; 07-31-2020, 03:30 PM.
Leave a comment:
-
Hello Santillana1971, thanks for your reply.
If you try to set a buy stop market order below average entry price the order will be rejected. Stop loss orders for sell orders need to go above average entry price. It looks like you were able to find the long version of the strategy. Jim originaly posted it in this thread.
Best regards.
- Likes 1
Leave a comment:
-
I think you´re wrong. For a short order the Breakeven needs to be below average entry once triggered. InitialDistanceStop needs to be above average entry. see attached inputs of long entry sample and the example itselfOriginally posted by NinjaTrader_ChrisL View PostHello Santillana1971, thanks for your reply.
The initial stop distance is X ticks below the average entry price. For a short order the break-even needs to be above average entry, so remove the '-' to place the stop above the average entry price. I recommend fully understanding the long version of this strategy before converting it to a short strategy. Consider replicating the example in a brand new strategy to get a good understanding of how this strategy works. It would be easier to convert it with this knowledge.
Best regards.
Please send me the long version of that strategy. ThanksLast edited by Santillana1971; 07-31-2020, 02:32 PM.
Leave a comment:
-
Hello Santillana1971, thanks for your reply.
The initial stop distance is X ticks below the average entry price. For a short order the break-even needs to be above average entry, so remove the '-' to place the stop above the average entry price. I recommend fully understanding the long version of this strategy before converting it to a short strategy. Consider replicating the example in a brand new strategy to get a good understanding of how this strategy works. It would be easier to convert it with this knowledge.
Best regards.
Leave a comment:
-
Hello Jim,
you know the input "initialStopDistance is a negative value to Long. should i switch to a positive? for the other side, how can i subtract initialStopDistance*ticksize to Position.AveragePrice? i mean, there is no a negative sign or something (please see image attached)
the breakeven remain equal? would please send me a sample?
Attached Files
Leave a comment:
-
Hello Santillana1971,
Thanks for your post.
The concept is the same, but the stops must be placed on the correct side of the market. Enter/Exit methods can be switched from Long to Short, but the logic will have to be modified so instead of checking "Close[0] >= TriggerPrice" you are checking "Close[0] <= TriggerPrice."
You would also make changes like the following so the stop price is at the correct side of the market. I.E. Instead of adding (InitialStopDistance * TickSize) to Position.AveragePrice you would subtract it from Position.AveragePrice.
We look forward to assisting.
- Likes 1
Leave a comment:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
601 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 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
559 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
558 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Leave a comment: