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

examples of strategy

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

    examples of strategy

    Hi.
    I need a compete example of strategy (template) which works without creating "Order overfill" problems.

    I have seen different strategies with different approaches (some of them cancel/nullify the orders in `OnOrderUpdate`, some of them change things and cancel positions in `OnExecution` and etc..).

    Is there any standard/recommended example? (with both Short/Long positions in example and correctly handling them without "ORDER OVERFILL" alike problems).

    #2
    Hello TazoTodua,

    Thank you for your note.

    Order overfill is the result of working two orders on both sides of the market close enough that a price spike up and down in say a half second, results in both orders being filled. A strategy which would not create an order overfill problem would be one that either doesn’t work both exit orders at the same time or works both orders a distance greater than what you could expect the market to fluctuate in a short period of time.

    You could see the following post covering overfills,



    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Alan.
      I asked the examples of strategies if there are any (complete and perfect).
      please point me them, because I cant solve the situation with only theorical explantion. HOwever, the explanation is very good, but i dont know how to solve that (or why i have to manually expect the fluctuatio distance of stocks when i dont care of them within strategy. strategy should be applied on any chart without such pre-estimations..

      Comment


        #4
        Hello TazoTodua,

        You could see the SampleSMACross or SampleMultiTimeFrame strategies preloaded on NinjaTrader for a strategy which would not be at risk of overfills as the strategy only uses market orders to enter and exit.

        A strategy which enters long then works a profit target and stop loss within 2 ticks of entry price is going to be at risk of an overfill in say Crude Oil. However that same strategy with 20 ticks for the profit target and stop loss is going to be less likley to get an overfill, and with 200 ticks for PT and SL even less likley.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Alan,
          to say frankly, the answers are useless.
          please, it seems you are unable to help me in this case, and if another support person could give me a hint/help, I'll be glad.

          I knew those simplest strategies, but I ask again, then I have a complex strategy, with multiple LONG and SHORT orrders, with user-defined STOP-LOSS,PROFIT TARGET, TRAILING STOPS and etc..

          so, I need a professional strategy example of handling them.

          (once again - "is less likely" or "more likely" are useless. We need to have a decent code, which doesnt have a "chances" to fail or not. that's why I've asked several times, that i need a complete example , which doesnt depend on the fluctuation. That's what the perfect code should handle using order-variables or etc..).

          however, always glad that you help me.! thanks!

          Comment


            #6
            Originally posted by TazoTodua View Post
            Alan,
            to say frankly, the answers are useless.
            please, it seems you are unable to help me in this case, and if another support person could give me a hint/help, I'll be glad.

            I knew those simplest strategies, but I ask again, then I have a complex strategy, with multiple LONG and SHORT orrders, with user-defined STOP-LOSS,PROFIT TARGET, TRAILING STOPS and etc..

            so, I need a professional strategy example of handling them.

            (once again - "is less likely" or "more likely" are useless. We need to have a decent code, which doesnt have a "chances" to fail or not. that's why I've asked several times, that i need a complete example , which doesnt depend on the fluctuation. That's what the perfect code should handle using order-variables or etc..).

            however, always glad that you help me.! thanks!
            Whereas I shall apologize because I am not attaching any code, I will point out that you can handle overfills yourself, by trapping them and acting accordingly.

            You will have to use the unmanaged approach to order handling; in which case you must handle all processing errors properly, as the safety net of NinjaTrader order handling will be completely absent.

            ref: https://ninjatrader.com/support/help...reoverfill.htm


            The HasOverfill property of the order will give you information about an overfill.

            ref: https://ninjatrader.com/support/help...-us/?order.htm
            Last edited by koganam; 05-01-2018, 03:03 PM.

            Comment


              #7
              Hello TazoTodua,

              I do not have any unmanaged examples which handle overfills. In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients.

              You can also contact a professional NinjaScript Consultants who would be eager to create or modify a script at your request or assist you with your script. Please let me know if you would like our business development follow up with you with a list of professional NinjaScript Consultants who would be happy to create this script or any others at your request.

              Please let us know if you need further assistance.
              Alan P.NinjaTrader Customer Service

              Comment


                #8
                Well, I havent requested anything much, just a particular example.

                Koganam, should people use unamanaged and complex mechanisms to setup a simple strategy that has stoploss,profittarget and LONG+SHORT trades? for that simple strategy, should i have to ivent quite complex unamanged approach?
                hm..
                ok thanks anyway.
                (referenced link was is for NT8, i will search for NT7)

                Comment


                  #9
                  Originally posted by TazoTodua View Post
                  ...

                  Koganam, should people use unamanaged and complex mechanisms to setup a simple strategy that has stoploss,profittarget and LONG+SHORT trades? for that simple strategy, should i have to ivent quite complex unamanged approach?
                  hm..
                  ok thanks anyway.
                  (referenced link was is for NT8, i will search for NT7)
                  Unfortunately, yes. Order handling is the same regardless of how complex your entry conditions, or trade management, may be. Ultimately, we are making orders to buy and sell equities in a market that has imperfect control mechanisms, regardless how robust, or not, such mechanisms may be. The size and complexity of the trade scheme is really not a consideration as to what one should do when one's money is at risk.

                  NT has made an effort to provide some kind of safety cutouts, in an approach that is managed by NT itself. If those cutouts are onerous, then we shall have to abandon them, and handle everything ourselves.

                  I apologize for not noticing that your inquiry was about NT7, rather than NT8. I should pay better attention.

                  Comment


                    #10
                    Another example would be if NT is handling the profit tgt and stop but additionally there are other rules for exits, the coded rules can execute at the same price and time as the NT exit and cause problems. The problem is that there isn't a way to know where the NT target/stops are, if they are executing, etc.
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment


                      #11
                      koganam, so i cant I just create variables to save the state of orders or somehow avoid overfill error messages? hm.. very anoying..

                      Comment


                        #12
                        Originally posted by TazoTodua View Post
                        koganam, so i cant I just create variables to save the state of orders or somehow avoid overfill error messages? hm.. very anoying..
                        All of that is part of creating your order management system. Sure, the ability exists to ignore overfills. I do not see why anyone would want to do so though. Do I misunderstand your question?

                        Comment


                          #13
                          Sorry, it was my mistake.
                          I dont mean HIDE it, i mean to do correct way, which will avoid me of overfills.

                          i think there should be a way... like checking with variables, if any exit is processing and not fire new entries or etc...

                          Comment


                            #14
                            Originally posted by TazoTodua View Post
                            Sorry, it was my mistake.
                            I dont mean HIDE it, i mean to do correct way, which will avoid me of overfills.

                            i think there should be a way... like checking with variables, if any exit is processing and not fire new entries or etc...
                            I probably gave you some pseudocode for that in this response on the other thread that deals with the same Overfill issue, on which you posted: https://ninjatrader.com/support/foru...47&postcount=2

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by funk10101, Today, 12:02 AM
                            0 responses
                            3 views
                            0 likes
                            Last Post funk10101  
                            Started by gravdigaz6, Yesterday, 11:40 PM
                            1 response
                            7 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by MarianApalaghiei, Yesterday, 10:49 PM
                            3 responses
                            10 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by XXtrader, Yesterday, 11:30 PM
                            0 responses
                            4 views
                            0 likes
                            Last Post XXtrader  
                            Started by love2code2trade, 04-17-2024, 01:45 PM
                            4 responses
                            28 views
                            0 likes
                            Last Post love2code2trade  
                            Working...
                            X