Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

double value for entry price and int value for entry bar

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

    #16
    Please see our reference sample on using a DataSeries object to store calculations:

    MatthewNinjaTrader Product Management

    Comment


      #17
      Hey Koganam

      It's not that I am enamored, it's that I don't know a better way to capture the exact entry price. I could set it to the entry condition price, but that may or may not be the "actual" price. So if you had a condition: if(Flat) EnterLong(); How would you capture the entry price to a double without Position.AvgPrice, using the Managed Approach?
      thanks

      Comment


        #18
        Hey Mathew

        Thanks for the link, but I know how to set a dataseries object, but what I am unclear on is how to set it to a single entry price that holds that value unchanged? How do you capture the value of the entry price:
        if(Flat) EnterLong();

        Comment


          #19
          Ken,

          I feel like data series is going to be overkill. If it's the price of a specific order you're looking for, I think you should switch to IOrders.


          // declare separate IOrder objects
          Code:
          		private IOrder myfirstEntry = null;
          		private IOrder mysecondEntry = null;
                          private double entryPrice =0;
          // enters first entry and store the fill price for only that order
          Code:
          			if(myCondition && Position.Quantity == 0)  // i've used position quantity as an alternative to checking for flat - you can do whatever you want here
          			{
          				myfirstEntry = EnterLong("first");
          			}
          
          			entryPrice = myfirstEntry.AvgFillPrice;
          // allows additional entries with separate IOrder object
          Code:
          			if (my condition && Position.Quantity > 0)  
          			{
          				mysecondEntry = EnterLong("second");
          			}
          MatthewNinjaTrader Product Management

          Comment


            #20
            Mathew

            I can not used IOrders. There are internal issues with OnExecution that caused problems in my strategy that Bret was aware of but never resolved the problem. So as a consequence I do not use Advanced Managed Approach any more and I am trying to simplify my coding. Even though this also seems to have it's drawbacks.

            In any event my goal remains the same to capture a single entry price value as described using Managed Approach.

            Comment


              #21
              Originally posted by kenb2004 View Post
              Hey Koganam

              It's not that I am enamored, it's that I don't know a better way to capture the exact entry price. I could set it to the entry condition price, but that may or may not be the "actual" price. So if you had a condition: if(Flat) EnterLong(); How would you capture the entry price to a double without Position.AvgPrice, using the Managed Approach?
              thanks
              Understood. However, if you are using Limit orders, then the price that you set as the entry price will be the entry price or better: with limit orders, only favorable slippage is possible, and to that we certainly cannot object . Are you not using Limit orders?

              That having been said, then just use the code I gave you, but do substitute the AvgPrice at entry. That code is already written to store that entry price in an independent double variable. IOW, for your initial entry, the AvgPrice will be the entry price. You store that in another variable, and what happens to AvgPrice after that is apropos of nothing.

              Comment


                #22
                Koganam

                Yes, I always use limit orders. Thanks for your input...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by warreng86, 11-10-2020, 02:04 PM
                6 responses
                1,357 views
                0 likes
                Last Post mathewlo  
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                3 views
                0 likes
                Last Post Perr0Grande  
                Started by elderan, Today, 08:03 PM
                0 responses
                5 views
                0 likes
                Last Post elderan
                by elderan
                 
                Started by algospoke, Today, 06:40 PM
                0 responses
                10 views
                0 likes
                Last Post algospoke  
                Started by maybeimnotrader, Today, 05:46 PM
                0 responses
                14 views
                0 likes
                Last Post maybeimnotrader  
                Working...
                X