Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

protect myself by predefined ninja values

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

    protect myself by predefined ninja values

    Hi,

    I was testing a strategy where I placed a AtmStrategyCreate (so I can manage my own position manually.) at a limit order below or above the market.

    Because I made a thinking error it placed a limit order at every new OnBarUpdate. Next thing all orders where filled (300 cars) when price dropped.

    I did check ONE order per direction!

    Question: how can I protect myself against such thing in realtime trading?
    What happens if the strategy has the option "one order per direction" and having multiple limit orders at a price?

    Is there a global setting in Ninjatrader to set by default 'always no more than x number of buy/sell pending orders ? I mean to protect myself in any case, by strategy , atm or a manually error ...
    Last edited by Creamers; 06-17-2013, 10:32 AM.

    #2
    Hello,

    Do you have a sample script/example that replicates this so that I may test on my end?

    Strategies are located in (MY) Documents\NinjaTrader 7\bin\Custom\Strategy
    Last edited by NinjaTrader_Lance; 06-19-2013, 10:57 AM.
    LanceNinjaTrader Customer Service

    Comment


      #3
      Lance,

      See private message for code.

      I did set the strategy to entries per direction = 1 and setting it to AllEntries.

      Still getting multiple orders sometimes. It's possible to get filled with alot of contracts if a strategy is made faulty.

      Tell me, should the strategy "entries per direction = 1 and setting it to AllEntries" rule above the faulty code?

      How to protect myself against any 'wrong-thinking'

      Comment


        #4
        So that I make sure I have the entire script could you please attach and send the entire .cs file (not just a code snippet) to support [at] NinjaTrader [dot] com
        located in (MY) Documents\NinjaTrader 7\bin\Custom\Strategy

        In the subject line ATTN Lance
        In the body place: http://www.ninjatrader.com/support/f...ad.php?t=58476
        LanceNinjaTrader Customer Service

        Comment


          #5
          Send the strategy to support.

          Thx

          Beside the strategy code, could you explain in general how it should be set. ( not looking at the code ) to protect myself against multiple active orders ?

          --------------
          btw: think my problem in the code is ALMOST fixed :

          if((orderId.Length > 0) && FirstTickOfBar){

          Print("New Bar, canceling current pending order");
          AtmStrategyCancelEntryOrder(orderId);
          //orderId = string.Empty;
          };

          I comment out the //orderId = string.Empty; Now it cancels the pending order before entering a new order.
          ------------------


          Question still exists: How to protect myself globally in Ninjatrader (or by strategy) so that whatever happens, it only submits ONE order at a time to the market!!! ???

          If my strategy order gets filled it still submitting orders to the market...I did set one order per direction in the strategy.

          Think this thread looks like my problem:

          It's beginning to look like it the strategy does know i'm filled and thinks i'm flat.....
          Last edited by Creamers; 06-19-2013, 01:51 PM.

          Comment


            #6
            exact the same problem as TiggerTrader

            He has the exact same problem as I do !! :

            Comment


              #7
              Question still exists: How to protect myself globally in Ninjatrader (or by strategy) so that whatever happens, it only submits ONE order at a time to the market!!! ???
              You will have to ensure the script's logic prevents this through testing and debugging.


              If my strategy order gets filled it still submitting orders to the market...I did set one order per direction in the strategy.
              Entries per direction does not apply to ATM strategies

              If you have found an error and can create a reproducible situation with a simplified script (such as the SampleATM script) I will happily test on my end. Unfortunately I have not been able to reproduce an issue with the information provided
              LanceNinjaTrader Customer Service

              Comment


                #8
                Creamers:

                I have fixed this problem and sent my solution to NT PatrickH for him to give to their ppl to CHANGE the SampleAtm.cs file. Evidentally, they did nothing with it if the SamplATM is still broken.

                If you want a copy of the fix, let me know how you want it delivered, or email me directly at [email protected] (this would be fastest)

                Comment


                  #9
                  Tiggertrader,

                  Thank you very much. Like you told ninjatrader support, they should use your example instead or the sampleatmstrategy in ninjatrader that doesn't work properly.

                  Lance, test your own sample atm strategy on a fast tick chart and see for yourself. Try it on a realtime live trading account and you'll find out

                  Comment


                    #10
                    I wanted to let you know this is still being looked into and I will get back to you with more information tomorrow after I have tested in a live high volume environment
                    LanceNinjaTrader Customer Service

                    Comment


                      #11
                      Lance,

                      Thank you! Also look at PatrickH who has the working sample from tiggertrader.

                      Hope you find ŕ solution cause I think its a flaw in ninja otherwise I hope to hear your solution or explanation.

                      Comment


                        #12
                        Lance,

                        Any news? Did you try it on a faster chart, for example tickchart with cobc = false ?

                        Comment


                          #13
                          Hello Creamers,

                          What is occurring is that the OnBarUpdate() method can be called multiple times within the time it takes for the first CreateAtmStrategy() and GetAtmStrategyUniqueId() to process, so you can wind up with multiple positions.

                          Unfortunately, OnPositionUpdate() would not get around this as originally thought. As the OnBarUpdate() method can be called multiple time with CalculateOnBarClose = False before the position updated.

                          Have you contacted John for his strategy that implements the use of a boolean to work around this matter? If not, I can provide his sample.

                          Comment


                            #14
                            Yes, but it should not be John but Ninjatrader Patrick, do you tell Lance about this so he knows?

                            Now back to my original question:

                            Is it possible to protect myself against programmical failures in ninjatrader by setting global predefined settings?

                            Comment


                              #15
                              Hello Creamers,

                              Thank you for your response.

                              The example John was able to create is attached, it is the use of the boolean that resolves this matter.

                              There really would not be a method to avoid this if the position is not updated before your condition to enter is true again. I suggest reviewing John's example here for information on how to work around this item.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by dcriador, Today, 02:09 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post dcriador  
                              Started by nicthe, Today, 07:38 AM
                              4 responses
                              19 views
                              0 likes
                              Last Post bltdavid  
                              Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
                              30 responses
                              98 views
                              0 likes
                              Last Post cmtjoancolmenero  
                              Started by junkone, 04-28-2024, 02:19 PM
                              9 responses
                              96 views
                              1 like
                              Last Post junkone
                              by junkone
                               
                              Started by samish18, Yesterday, 12:20 PM
                              1 response
                              12 views
                              0 likes
                              Last Post WaleeTheRobot  
                              Working...
                              X