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 :

              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 cre8able, Today, 03:20 PM
                  1 response
                  9 views
                  0 likes
                  Last Post cre8able  
                  Started by fiddich, Today, 05:25 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post fiddich
                  by fiddich
                   
                  Started by gemify, 11-11-2022, 11:52 AM
                  6 responses
                  804 views
                  2 likes
                  Last Post ultls
                  by ultls
                   
                  Started by ScottWalsh, Today, 04:52 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post ScottWalsh  
                  Started by ScottWalsh, Today, 04:29 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post ScottWalsh  
                  Working...
                  X