Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Example of Auto Breakeven code?

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

    Example of Auto Breakeven code?

    1) I have the settings for my stop loss and targets as

    SetStopLoss("", CalculationMode.Ticks, 12, false);
    SetProfitTarget("", CalculationMode.Ticks, 12);

    I can't seem to find the code to insert auto break even?

    ie: go to breakeven after profit reaches 8 ticks.

    Any help would be appreciated.

    -------------------------------------------------------------------

    2) During the backtesting process, when I insert times for my strategy to operate, I don't get any signals. When I remove the code
    ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 1559
    I then get the backtesting results? What am I doing wrong here?

    Thanks in advance for any direction on these two matters.

    #2
    1) Unfortunately AutoBreakEven is not support on NinjaScript strategies only.
    2) I suggest adding Print() statements to your logic to see where it breaks.

    Comment


      #3
      [quote=NinjaTrader_Dierk;14474]1) Unfortunately AutoBreakEven is not support on NinjaScript strategies only.
      quote]

      1) Will auto break-even be an option on "NS strategies only", in the near future?

      2) Do I need to program in an ATM custom to get an auto break-even aspect to the strategy?

      3) If so, can I combine the custom ATM with other NS exit/profit target strategies? For simplistic sake, could I have a custom ATM and a simple "cross above..." strategy as the exits. If any exit is filled then all orders would be cancelled?

      Thanks in advance for your response.
      Last edited by Thomas; 08-17-2007, 01:33 PM.

      Comment


        #4
        1) No however, we will provide sample code to accomplish breakeven

        2) No, you can program this with NinjaScript right now. We will have some reference samples available soon.

        3) No you can not.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks for your reply...I'll be looking forward to all of the new reference samples.

          Comment


            #6
            Originally posted by NinjaTrader_Dierk View Post
            1) Unfortunately AutoBreakEven is not support on NinjaScript strategies only.
            2) I suggest adding Print() statements to your logic to see where it breaks.
            Hello, guys!

            I hope, it should be supported for now, cause the request was about 7 years ago
            Could you, please, advise some tips/code exapmles for how to implement AutoBreakEven for custom ATM Strategy.

            Thank you in advance.

            --
            Andriy

            Comment


              #7
              Hi Andriy, I suggest you check into this sample here http://www.ninjatrader.com/support/f...ead.php?t=3222

              It will show how to realize a breakeven with the Set() methods for your NinjaScript strategy. The concept is of course not limited to one step only, your stop loss / target will adjust when you dynamically call the set method again with your newly supplied price or offset value in the OnBarUpdate().
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                Hi Andriy, I suggest you check into this sample here http://www.ninjatrader.com/support/f...ead.php?t=3222

                It will show how to realize a breakeven with the Set() methods for your NinjaScript strategy. The concept is of course not limited to one step only, your stop loss / target will adjust when you dynamically call the set method again with your newly supplied price or offset value in the OnBarUpdate().
                Thank you for the reply.
                I would like to implement smth like helper for trading and have a few questions to you...

                The algorithm of what I want to do is:
                1) the trader manually find entry point & set buy stop or sell stop
                2) from the moment when price takes your order , should start to work my Helper

                Helper is a indicator or strategy (dont know what is better to use) which know :
                * Order Price
                * Timeframe (if not allowed to get what timeframe automatically - trader manually sets as a property of helper what timeframe is)
                * helper set default stop loss (let say 20 pips) and the trader after that can change it
                * helper monitor when price reach a price level & set the position to Auto breakeven
                Could you please advise or explain how to do it step by step.
                Thank you.
                --
                Andriy

                Comment


                  #9
                  Hi Andriy, let's take it a step back actually - are you already familiar with our signature ATM strategy feature? This basically what you describe directly configured from our order entry user interfaces like the SuperDOM or ChartTrader.



                  Once the entry is executed, the ATM would be started and managing your trade according to the preset parameters, which can (but not must) include AutoTrail and AutoBreakeven properties.

                  This would be ready to use without any custom coding.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Bertrand View Post
                    Hi Andriy, let's take it a step back actually - are you already familiar with our signature ATM strategy feature? This basically what you describe directly configured from our order entry user interfaces like the SuperDOM or ChartTrader.



                    Once the entry is executed, the ATM would be started and managing your trade according to the preset parameters, which can (but not must) include AutoTrail and AutoBreakeven properties.

                    This would be ready to use without any custom coding.
                    Thank you,

                    I familiar with ATM. Such code is a step for my custom full automatted strategy.
                    That is why I want to know how to implement the code for such logic.

                    Also, another questions.
                    * How is it possible to see the code of generated custom ATM using API ?
                    * Could you please send me a link of custom free strategies/ATM strategies like I saw for indicators
                    (to investigate some samples and reuse some logic)

                    Thank you.

                    Comment


                      #11
                      Was my request just ignored? ((

                      Comment


                        #12
                        Sorry for my late reply akushyn, Ninjatrader comes with a few samples for automated strategies already preinstalled, you can review their code in your NinjaScript editor (Tools > Edit NinjaScript Strategy). Those can serve as basis for further custom development, augmented by the samples we have here on our forums such as the one I pointed to earlier.



                        All forum shared / community scripts could be seen here - http://www.ninjatrader.com/support/f...splay.php?f=37

                        There's some more advanced ones already present that also would for example include the technique to enable a script on the fly via buttons from the toolbar, a technique which would not be fully documented by us but should be helpful for one of the questions you asked earlier.

                        You can also trigger ATM strategies in your script, however please keep in mind you would then not be able to backtest. A full sample of this technique is also installed with NT under SampleATMStrategy.
                        BertrandNinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by f.saeidi, Today, 10:19 AM
                        1 response
                        4 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by kujista, Today, 06:23 AM
                        5 responses
                        15 views
                        0 likes
                        Last Post kujista
                        by kujista
                         
                        Started by traderqz, Yesterday, 09:06 AM
                        2 responses
                        17 views
                        0 likes
                        Last Post traderqz  
                        Started by traderqz, Today, 12:06 AM
                        3 responses
                        6 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by RideMe, 04-07-2024, 04:54 PM
                        5 responses
                        28 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Working...
                        X