STRATEGYPROFIT

Category: ProBacktest

STRATEGYPROFIT is a built-in variable in the ProBuilder language used to track the cumulative profit or loss in money generated by the closed trades of a currently running trading strategy. This variable is essential for analyzing the effectiveness of a strategy over time by providing real-time feedback on its financial performance.

Syntax:

myCurrentProfit = STRATEGYPROFIT

Example Usage:

To utilize the STRATEGYPROFIT variable, you can assign its value to another variable to keep track of the strategy’s profit. Below is a simple example:

DEFPARAM CumulateOrders = true  // Cumulating positions
myCurrentProfit = STRATEGYPROFIT
IF myCurrentProfit > 1000 THEN
  SELL 100 SHARES AT MARKET
ENDIF

In this example, the strategy checks if the current profit exceeds 1000 units. If it does, it triggers a sell order for 100 shares at the market price. This demonstrates how STRATEGYPROFIT can be used to make decisions based on the profitability of the strategy up to that point.

Additional Information:

  • The STRATEGYPROFIT variable only includes profits from trades that have been closed; open positions are not included in this calculation.
  • This variable is particularly useful in strategies where the future trading decisions depend on the success of past trades.
  • It is important to set DEFPARAM CumulateOrders = true if you want to keep positions open across multiple bars and cumulatively calculate the profit.

Understanding and utilizing STRATEGYPROFIT can significantly aid in the management and adjustment of trading strategies based on their historical performance.

Related Instructions:

  • POSITIONPERF probacktest
  • Logo Logo
    Loading...