Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AvgProfit == Average Net Profit?

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

  • aventeren
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello,

    Yes, the gross profit will only include winning trades and the gross loss will only include losing trades.

    I am not quite sure what you mean by defining the slippage. What code are you using to set this? How is this code being used in the script?
    Thanks for the clarification on .GrossProfit and .GrossLoss.

    In the NinjaScript Language Reference > Strategy > Slippage, it shows an example where Slippage can be defined within Initialize() like this:

    Code:
    protected override void Initialize()
    { 
        Slippage = 2; 
    }
    But where is the defined Slippage then applied (i.e. what TradePerformance metric)?

    Thanks,

    Aventeren

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello,

    Yes, the gross profit will only include winning trades and the gross loss will only include losing trades.

    I am not quite sure what you mean by defining the slippage. What code are you using to set this? How is this code being used in the script?

    Leave a comment:


  • aventeren
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hi aventeren,


    For the net profit I think you would also need to subtract any loss.
    Code:
    netProfit = Performance.AllTrades.TradesPerformance.GrossProfit - Performance.AllTrades.TradesPerformance.GrossLoss - Performance.AllTrades.TradesPerformance.Commission;
    Thanks, Chelsea.

    Could you please confirm that .GrossProfit only includes "winning" trades and .GrossLoss only includes "losing" trades?

    Also, if we have defined slippage in Initialize(), how can we make sure that slippage has been properly deducted--and more importantly, where was it deducted (if at all)?

    Thanks!

    Aventeren

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi aventeren,
    Originally posted by aventeren View Post
    Thanks for the clarification.

    So to return net profit for all trades, I would use something like the following?

    Code:
    netProfit = Performance.AllTrades.TradesPerformance.GrossProfit - Performance.AllTrades.TradesPerformance.Commission;
    For the net profit I think you would also need to subtract any loss.
    Code:
    netProfit = Performance.AllTrades.TradesPerformance.GrossProfit - Performance.AllTrades.TradesPerformance.GrossLoss - Performance.AllTrades.TradesPerformance.Commission;

    Leave a comment:


  • aventeren
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello aventeren,

    Thanks for your post.

    The .AvgProfit does not include commission. You can access the commissions with:
    Performance.AllTrades.TradesPerformance.Commission .
    Thanks for the clarification.

    So to return net profit for all trades, I would use something like the following?

    Code:
    netProfit = Performance.AllTrades.TradesPerformance.GrossProfit - Performance.AllTrades.TradesPerformance.Commission;

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello aventeren,

    Thanks for your post.

    The .AvgProfit does not include commission. You can access the commissions with:
    Performance.AllTrades.TradesPerformance.Commission .

    Leave a comment:


  • aventeren
    started a topic AvgProfit == Average Net Profit?

    AvgProfit == Average Net Profit?

    Howdy--

    Simple question: Does .AvgProfit return net profit, including deducts for commission and slippage if "Apply commission to PnL calculations" is checked in the Tools > Options ? General tab, a single side commission value is included in the Tools > Options > Commissions "Futures - Simulator" section (i.e., $2.50, which would be $5.00 roundtrip) and a Slippage value is included in Initialize() (i.e., "Slippage = 2;")?

    Here is the NT .AvgProfit documentation:

    AvgProfit
    Definition
    Returns the average profit of the collection.

    Property Value
    A double value that represents the average profit of the collection.

    Syntax
    <TradeCollection>.TradesPerformance.<TradesPerform anceValues>.AvgProfit


    Examples
    protected override void OnBarUpdate()
    {
    // Print out the average profit of all trades in currency
    Print("Average profit of all trades is: " + Performance.AllTrades.TradesPerformance.Currency.A vgProfit);
    }

    If in fact .AvgProfit is average net profit, I might suggest that the NT documentation is amended to reflect that this is a net number if commission and/or slippage is included (per above?).

    Thanks for your help,

    Aventeren

Latest Posts

Collapse

Topics Statistics Last Post
Started by cmoran13, 04-16-2026, 01:02 PM
0 responses
36 views
0 likes
Last Post cmoran13  
Started by PaulMohn, 04-10-2026, 11:11 AM
0 responses
23 views
0 likes
Last Post PaulMohn  
Started by CarlTrading, 03-31-2026, 09:41 PM
1 response
162 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by CarlTrading, 04-01-2026, 02:41 AM
0 responses
96 views
1 like
Last Post CarlTrading  
Started by CaptainJack, 03-31-2026, 11:44 PM
0 responses
152 views
2 likes
Last Post CaptainJack  
Working...
X