• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Getting multiple orders

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

    Getting multiple orders

    hello,
    Not sure if this is the correct forum.
    I have a strategy that I created. It has started to place multiple orders. But of course not every time. I'm executing ATM. as far as I can see i have the setting set to only allow 1 order per direction.
    When the problem happens it places about 30 orders, then a popup says that there has been too many orders placed.

    Please let me know what additional info you guys need from me. or do I need to open a tech support ticket?

    thanks
    John

    #2
    Hi John, ATM strategies started from within a NinjaScript strategy do not follow entry limits because these ATM strategies are run independently. You will need to add some code to prevent these multiple entries.
    AustinNinjaTrader Customer Service

    Comment


      #3
      ok, so i can create a variable when the trade executes. that would mean no more trades.
      Is there something that tells me the ATM is completed? round trip order completed?

      Comment


        #4
        John, please see this page for a complete list of ATM related functions - http://www.ninjatrader.com/support/h...gy_methods.htm. Basically, you'll have to monitor the ATM's stop and target orders for a fill to tell when the ATM is complete.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Thank you, i think that should work

          john

          Comment


            #6
            Austin,
            Since I posted my question, I see quite of few people ask this question.

            My new question is about calculation of PnL.
            In my script the PnL always = 0

            if (Performance.RealtimeTrades.TradesPerformance.Curr ency.CumProfit >= 150)
            return;

            This will print untill the order is filled
            Print("PnL is " + GetAtmStrategyRealizedProfitLoss("Trailing Stop").ToString());

            But a string is not an "int" so I can't use a statement like,

            Private int PnL = 0; // this is in the variable section

            PnL = (PnL + GetAtmStrategyRealizedProfitLoss("Trailing Stop"));
            if (Pnl >= 150)
            {
            return;
            }

            I've tied converting it to an int. but can't figure it out.

            my ATM order execution looks like this

            atmStrategyId = GetAtmStrategyUniqueId();
            orderId = GetAtmStrategyUniqueId();
            AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Limit, (High[0] + .1), 0,
            TimeInForce.Day, orderId, "Trailing Stop", atmStrategyId);
            AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,
            TimeInForce.Day, orderId, "Trailing Stop",
            orderId);

            Comment


              #7
              Hi John, I'm not 100% following here - are you attempt to mix the ATM strategy and NinjaScript performance classes?

              For retrieving PnL from the ATM's, please check into this sample we provide here :

              http://www.ninjatrader.com/support/f...ad.php?t=19148
              BertrandNinjaTrader Customer Service

              Comment


                #8
                having trouble importing that SampleATMPnL.zip, it says there is duplicate method name or a missing file.

                basically my problem is not being able to stop the strategy when the PnL is at +150

                Comment


                  #9
                  johne5, you can parse just about any string to any number (and a double would probably be more appropriate than an int here) with something like:
                  Code:
                  double PnL = double.Parse(myNumberThatIsAString);
                  AustinNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by shs232, Today, 10:02 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post shs232
                  by shs232
                   
                  Started by cary1267, Today, 09:37 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post cary1267  
                  Started by kattiehowe, Today, 09:01 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post kattiehowe  
                  Started by Irukandji, Yesterday, 06:24 AM
                  10 responses
                  75 views
                  0 likes
                  Last Post neoikon
                  by neoikon
                   
                  Started by malcolm, Today, 08:07 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post malcolm
                  by malcolm
                   
                  Working...
                  X