Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entering too many contracts with Tradestation order

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

    Entering too many contracts with Tradestation order

    I have something like the following.

    VARS: entryP(0), ccN(0), eFlag(true);

    if NTMarketPosition("") = 0 then begin
    entryP = Close;
    eFlag = true;
    NTCancel("LL");
    NTCancel("LPT");
    NTCancel("LStop");
    end;

    // I used this code b/c a thread on Ninja's website said NTMarketPosition is unreliable on partial fills.
    ccN = NTFilled("LEn") + NTFilled("LL");

    NTBuyMarket("LEn", 1);

    if NTMarketPosition("") > 0 then begin
    if eFlag then
    NTBuyLimit("LL", 3, entryP-10);
    eFlag = false;

    if ccN >= 4 then
    NTCancel("LL");

    NTSellLimit("LPT", ccN, entryP + 10);
    NTSellStop("LStop", ccN, entryP - 20);
    end;

    In this case, sometimes it will enter many more than 3 contracts on the add on. It has entered as many a 15 contracts. Could this be a Ninja setting, or am I overlooking something else?

    Thanks for your help!

    #2
    This is all occurring in simulation mode.

    Comment


      #3
      You need to debug your code.

      if NTMarketPosition("") > 0 then begin
      if eFlag then
      NTBuyLimit("LL", 3, entryP-10);
      eFlag = false;

      See why your eFlag is not stopping the additional NTBuyLimit()s.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Josh,

        Thanks for your response. I don't set eFlag anywhere else. Also, it will fill the order multiple times on each bar. When I look in the log, it is only buying one contract at a time eventhough the order specifies 3.

        Comment


          #5
          Hi sgordon77, do you happen to use IntraBar order generation in TradeStation? Does the same happen with the provided NTSample strategy?
          BertrandNinjaTrader Customer Service

          Comment


            #6
            No, I do not use intrabar execution in Tradestation. I can try the NTSample strategy, but I have not yet. As I recall, this strategy does not do multiple entries is the same direction, could this be part of the problem?

            Comment


              #7
              This occurred again last night. The strategy was supposed to buy 3 contracts as an "add on", but it bought 4. I am running the exact same thing in TS, and it work fine (I do NOT have the email connection to Ninja setup). I have the TS orders and the Ninja orders in the same strategy, but I don't see how that could be realted.

              For example:
              Buy next bar at market;
              if NTConnected("") then
              NTBuyMarket("LEn", 1);

              Comment


                #8
                Also, this same behavior also occurred when I was using an ATM strategy and NTCommand to place/modify the orders.

                Comment


                  #9
                  Hi sgordon77, are you testing this with a flat Sim 101 account position in NinjaTrader?

                  Please attach your full TS test code so I can run this on my end here. Thanks!
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Yes, I am. If the strategy has a position, I match it using the DOM.

                    I will send you the code in a few hours in a PM.

                    Comment


                      #11
                      Okay thanks will look out for it.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        I have a quick question and I didn't want to start a new thread for what will probably be a simple answer.

                        If I use Tradestation with Forex.com and Rosenthal Collins Group which are both Ninjatrader supported brokerage partners, will I be able to trade on those accounts using Ninjatrader?

                        Many thanks

                        Comment


                          #13
                          Hello,

                          If the broker uses one of these data feeds, you can trade with it if you have a live license:


                          However, for TradeStation, you will not have access to live trading. This link will help:
                          DenNinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by geddyisodin, 04-25-2024, 05:20 AM
                          8 responses
                          60 views
                          0 likes
                          Last Post NinjaTrader_Gaby  
                          Started by jxs_xrj, 01-12-2020, 09:49 AM
                          4 responses
                          3,285 views
                          1 like
                          Last Post jgualdronc  
                          Started by Option Whisperer, Today, 09:55 AM
                          0 responses
                          5 views
                          0 likes
                          Last Post Option Whisperer  
                          Started by halgo_boulder, 04-20-2024, 08:44 AM
                          2 responses
                          22 views
                          0 likes
                          Last Post halgo_boulder  
                          Started by mishhh, 05-25-2010, 08:54 AM
                          19 responses
                          6,189 views
                          0 likes
                          Last Post rene69851  
                          Working...
                          X