• 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

AvgPrice or UnrealizedPnL from Unique Entries

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

    AvgPrice or UnrealizedPnL from Unique Entries

    In using a managed approach you can EnterLong(Condition 1) and EnterLong(Condition 2) as well as ExitLong from each by name. However I've not found much information on being able to get the AveragePrice or UnrealizedPnL from say only (Condition 1). How do I specify which unique entry to get this information from?

    Example:
    EnterLong(10, Cond1) "Buy 10 due to Cond1 rules"
    EnterLong(10, Cond2) "Buy 10 due to Cond2 rules"

    Cond2 entry has an UnrealizedPnL of 10% while Cond1 is 1%.
    So ExitLong Cond2 shares while leaving Cond1 shares open.

    Using Position.AveragePrice and Position.GetUnrealizedProfitLoss(PerformanceUnit.P ercent, Close[0]) is only used for the overall position and not unique entries.
    Is there a method for doing this?

    Thanks,

    #2
    Hello antrux,

    All entries contribute to the position.

    The position has an AverageEntryPrice as this is the average price of all entries that have contributed to that one position. The positions are not distinguished or separated by entry. You would need to track this information using variables.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Using a variable it would be easy to say record the current close with a unique name however even with Limit orders that value will most likely be different than that Close[0] value.

      So what would you recommend to use to derive that more accurate value to store?

      (Cond 2 ShareQty) * (What?) = (Total Cost of Cond 2 Entry)

      (Close[0] * (Cond 2 ShareQty)) / (Total Cost of Cond 2 Entry) = var1

      (var1 * 100) - 100 = (UnrealizedPnL% of Cond 2)

      Comment


        #4
        Hello antrux,

        You could have a list of Order objects that holds each entry order when the position is not flat or a list of doubles if you just want to save the prices and not the orders themselves. You could then compare the entry price from the <order>.AverageFillPrice or the saved price to the current Close[0] price to see how far the price has traveled since that specific entry price. A custom calculation with the point value and tick size and this would give you the profit per entry instead of for the entire position.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Gunter, Today, 12:18 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by aslane, Today, 02:27 PM
        0 responses
        4 views
        0 likes
        Last Post aslane
        by aslane
         
        Started by dadarara, Yesterday, 06:38 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by jvanelli, Today, 01:19 PM
        1 response
        2 views
        0 likes
        Last Post jvanelli  
        Started by TrendFollowingCapital, Today, 05:45 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X