Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Request Breakeven Functions in Strategy Builder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    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.
    JimNinjaTrader Customer Service

    Comment


      #62
      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

      Comment


        #63
        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.
        Chris L.NinjaTrader Customer Service

        Comment


          #64


          Where i can find the long version?

          Comment


            #65
            Originally posted by NinjaTrader_ChrisL View Post
            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.
            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 itself
            Please send me the long version of that strategy. Thanks
            Attached Files
            Last edited by Santillana1971; 07-31-2020, 02:32 PM.

            Comment


              #66
              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.
              Chris L.NinjaTrader Customer Service

              Comment


                #67
                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 shorts
                Last edited by Santillana1971; 07-31-2020, 03:30 PM.

                Comment


                  #68
                  Originally posted by NinjaTrader_ChrisL View Post
                  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.
                  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.

                  please see attached my example
                  Attached Files

                  Comment


                    #69
                    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!

                    Comment


                      #70
                      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).
                      Chris L.NinjaTrader Customer Service

                      Comment


                        #71
                        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

                        Comment


                          #72
                          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?

                          Comment


                            #73
                            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.
                            Chris L.NinjaTrader Customer Service

                            Comment


                              #74
                              Originally posted by NinjaTrader_ChrisL View Post
                              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.
                              Hello
                              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.

                              Thanks
                              Attached Files

                              Comment


                                #75
                                Hello Santillana1971, thanks for your reply.

                                Please Export your script so I can import it onto my system:



                                Also, could you let me know exactly what is not working for you so I can have somewhere specific to look?

                                I look forward to hearing from you.
                                Chris L.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by GussJ, 03-04-2020, 03:11 PM
                                11 responses
                                3,223 views
                                0 likes
                                Last Post xiinteractive  
                                Started by andrewtrades, Today, 04:57 PM
                                1 response
                                10 views
                                0 likes
                                Last Post NinjaTrader_Manfred  
                                Started by chbruno, Today, 04:10 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post chbruno
                                by chbruno
                                 
                                Started by josh18955, 03-25-2023, 11:16 AM
                                6 responses
                                438 views
                                0 likes
                                Last Post Delerium  
                                Started by FAQtrader, Today, 03:35 PM
                                0 responses
                                10 views
                                0 likes
                                Last Post FAQtrader  
                                Working...
                                X