Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Request Breakeven Functions in Strategy Builder

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

    #91
    Hello all,
    I tried to follow the zip file for breakeven trigger but I’m stuck. The file has parameters to enter long on a specific place. I already have my strategy 99% completed, all I need is the trigger but I cannot follow the steps. Does anyone ever make a video explaining how to set that up instead of a zip file???

    Comment


      #92
      Hi rafael, thanks for posting.

      We do not have a video that demonstrates trailing logic. The best resources will be Chealses example on the first page of this thread.

      Kind regards,
      -ChrisL
      Chris L.NinjaTrader Customer Service

      Comment


        #93
        Hi FuturesPhantom, thanks for posting.

        You can print out the value of BarsSinceExitExecution to test the method. I attached a simple test strategy that enters the market once then prints the BarsSinceExit property.

        Kind regards,
        -ChrisL

        Attached Files
        Chris L.NinjaTrader Customer Service

        Comment


          #94
          Hi Futures,

          You can use it in a condition to, say, reset the boolean variable that I use in the sample script e.g.



          Kind regards,
          -ChrisL
          Chris L.NinjaTrader Customer Service

          Comment


            #95
            Originally posted by FuturesPhantom
            I give up also... I may as well pretend that BarsSinceExitExecution doesnt exist. I don't believe It is not possible to create even the simplest strategy example that shows its making many trades while creating a minimum distance since a last execution.


            Watch this video, it should help....

            I wish Strategy Builder would allow ATM Strategy, it would save a lot of people so much time and energy
             

            Comment


              #96
              In case anyone needs to ever to use BarsSinceExitExecution in a strategy here is sample of it in a actual strategy made to take a lot of entries and made to limit the exact number of bars since each prior exit.

              FuturesPhantom


              HTML Code:
              protected override void OnBarUpdate()
              {
              
              if (BarsInProgress != 0)
              return;
              if (CurrentBars[0] < 20)
              return;
              if ((Position.MarketPosition == MarketPosition.Flat))
              if (Close[0] > Close[1])
              // if (IsRising(EMA1) == true)
              
              if (BarsSinceExitExecution(0, "", 0) == - 1)
              {
              EnterLong(Convert.ToInt32(DefaultQuantity), "");
              }
              else if (BarsSinceExitExecution(0, "", 0) >= 5)
              {
              EnterLong(Convert.ToInt32(DefaultQuantity), "");
              }
              else
              {
              return;
              }
              
              if (Close[0] < Close[1])
              
              {
              ExitLong(Convert.ToInt32(DefaultQuantity), "", "");
              
              }
              
              
              }
              }
              }

              Comment


                #97
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello 123r34,

                I am happy to submit a feature request on your behalf for the NinjaTrader Development to consider this for a future version of NinjaTrader. Please let me know if you would like to do this.

                NinjaScript Strategies are meant to have the behavior customized by the logic of the programmer including any trailing or breakeven movements.

                Attached are two examples of a breakeven movement and a trailing action created with the Strategy Builder.

                (Update August 5th, 2020 - changed the CurrentTriggerPrice and CurrentStopPrice variables to doubles)

                NinjaTrader_ChelseaB

                Does this work for renko bars?

                I downloaded the template and it didnt execute.

                I remember I had it working before but now it doesnt seem to move the stop loss.

                Any ideas?

                Comment


                  #98
                  Hi litamm, thanks for posting.

                  This should work on any bar type in the platform. Do you see any errors in the Log tab of the Control Center? Did you add any Prints to the strategy to see if the logic is being executed when expected? Please also test using the Playback connection or Simulated data feed to help test the strategy.

                  Kind regards.
                  Chris L.NinjaTrader Customer Service

                  Comment


                    #99
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hello 123r34,

                    I am happy to submit a feature request on your behalf for the NinjaTrader Development to consider this for a future version of NinjaTrader. Please let me know if you would like to do this.

                    NinjaScript Strategies are meant to have the behavior customized by the logic of the programmer including any trailing or breakeven movements.

                    Attached are two examples of a breakeven movement and a trailing action created with the Strategy Builder.

                    (Update August 5th, 2020 - changed the CurrentTriggerPrice and CurrentStopPrice variables to doubles)
                    I have built a strategy in which I am trying to use a trailing stop and have created the Trailing Stop just like the example posted by Chelsea in the TrailBuilderExample file she attached. However, I am sometimes not having it move up in price or stop out at the right place. In the attached example I have the TrailFrequency Input set to 10 ticks and the TrailStopDistance set to -10 ticks. As it shows in the example, it went against me more than 18 ticks and still hadn't stopped out. What would be causing this?
                    Attached Files

                    Comment


                      Hi Lester, thanks for posting.

                      Does the example work on your end? I would recommend using this as a template for making your trailing stop. I am not able to tell what the issue with your code is from the information provided. Please use the provided example as a base case, then work in your own entry/exit logic. Using the Print statement in the Actions>Misc menu to print data from your strategy can also be very helpful to see what conditions the strategy is hitting and which conditions are being skipped, and also useful to print variables your script is using.

                      Kind regards,
                      -ChrisL
                      Chris L.NinjaTrader Customer Service

                      Comment


                        Would like to add my vote thanks

                        Comment


                          [QUOTE=NinjaTrader_ChelseaB;n810922]Hello 123r34,

                          I have received a tracking ID for your request.

                          Your request for the Strategy Builder to have breakeven settings is being tracked with ID #SFT-2212.


                          Add me to this request also would you please?

                          Comment


                            It would be fantastic if the script Chelsey supplied went in both directions. I have spent 8 days now trying to get this to work on long and short. Paul also created a script that worked both ways for Trailing stop but I can seem to ,make a simple change to Breakeven instead of Trailstop (I know it seems like an easy fix but I can't get it). I've tried everything and emailed and had a bunch of responses yet still no luck.

                            Comment


                              Hallo Chelsea
                              ich habe denHast Du die Möglichkeit ein Script dieser Strategie davon zu erstellen auch für Sell Positionen ?
                              Ich habe leider nicht die Erfahrung dafür, währe Dir sehr dankbar.

                              Gruss Vasili
                              Attached Files

                              Comment


                                Hi Gruss, the forums are English only. Please translate your text through a translator before posting.

                                The samples come as is. Any modifications must be done by the community.

                                Best regards.

                                Chris L.NinjaTrader Customer Service

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by kujista, Today, 05:44 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post kujista
                                by kujista
                                 
                                Started by ZenCortexCLICK, Today, 04:58 AM
                                0 responses
                                5 views
                                0 likes
                                Last Post ZenCortexCLICK  
                                Started by sidlercom80, 10-28-2023, 08:49 AM
                                172 responses
                                2,281 views
                                0 likes
                                Last Post sidlercom80  
                                Started by Irukandji, Yesterday, 02:53 AM
                                2 responses
                                18 views
                                0 likes
                                Last Post Irukandji  
                                Started by adeelshahzad, Today, 03:54 AM
                                0 responses
                                8 views
                                0 likes
                                Last Post adeelshahzad  
                                Working...
                                X