Strategy properties

Each Pine strategy has a number of properties that determine its behavior: 

  1. Initial Capital
  2. Base Currency
  3. Order Size
  4. Pyramiding
  5. Commission
  6. Verify Price For Limit Orders
  7. Slippage
  8. Margin
  9. Recalculate 

 They are available in the strategy settings, in the Properties tab:


Each of the parameters specified in the properties of the strategy can be changed by editing the arguments of the strategy() function call in the corresponding Pine script:

strategy(title, initial_capital, currency, default_qty_value, default_qty_type, pyramiding, commission_type, commission_value, backtest_fill_limits_assumption, slippage, process_orders_on_close, margin_long, margin_short, calc_on_order_fills, calc_on_every_tick)

Let's take a look at each input parameter in the Properties menu and its corresponding parameter in the Pine language:

1 - Initial Capital (parameter: initial_capital) represents the amount of funds initially available for the strategy to trade, in the currency defined in Base Currency. By default, this value is equal to 100,000. You may need to increase this value for trades to occur on certain symbols.

2 - Base Currency (parameter: currency) specifies the currency used for calculations. Results appearing in the Strategy Tester tab (profit, loss, drawdown, etc) are expressed in this currency. Available choices are:

Default, USD, EUR, AUD, GBP, NZD, CAD, CHF, HKD, JPY, NOK, SEK, SGD, TRY, ZAR. If the Default choice is selected, the strategy will use the default currency for this symbol and there is no currency conversion.

3 - Order Size (parameters: default_qty_value, default_qty_type). This requires a value and a calculation mode. Note that the calculated values can be subject to constraints due to the minimum tradable quantities for the symbol:

  • Contracts (argument: strategy.fixed) - the strategy will enter with the specified number of contracts/shares/lots.
  • Amount in currency (argument: strategy.cash) - the strategy will enter the amount specified in base currency.
  • Percentage of equity (argument: strategy.percent_of_equity) - position sizes will be calculated as a percentage of the available equity when the trade opens. You can specify a value greater than 100%.

4 - Pyramiding (parameter: pyramiding) specifies the maximum number of successive entries allowed in the same direction. When pyramiding is disabled, the strategy can only open one long or short position, even if entry conditions are met. Pyramiding only affects entries made using the strategy.entry() function. It has no effect on orders created using strategy.order().

5 - Commission (parameters: commission_typecommission_value). It is the amount paid in trading fees for each trade. A value and calculation mode must be supplied. Note that commission is applied on both entries and exits, and that when a percentage is used, the calculated commission will vary with the value of the transaction:

  • Percentage of the transacted value (argument: strategy.commission.percent) - imposes a commission on each order equal to the specified percentage.
  • Currency per contract (argument: strategy.commission.cash_per_contract) - imposes a commission on each contract.
  • Currency per order (argument: strategy.commission.cash_per_order) - imposes a commission on each order.

6 - Verify Price For Limit Orders (parameter: backtest_fill_limits_assumption) makes the conditions for entering a position using limit orders more strict. By default, this value is 0, i.e. limit orders are filled on historical data as soon as the price indicated in the order is reached. If the parameter is not zero, then limit orders can enter a position within the bar only if the market price has exceeded the level of the limit order by the specified number of ticks.

7 - Slippage (parameter: slippage) specifies the value in ticks to be added to the fill price of market or stop orders. It can be used to account for the spread.

8 - Margin For Long and Short Positions (parameters: margin_long, margin_short) the margin required to maintain the position. If there are not enough funds, then a margin call occurs, which forcibly closes part or all of the positions with a market order until there are enough funds to maintain the existing positions.

9 - Recalculate options specify how often the strategy should be recalculated. By default, the strategy is recalculated at the close of each bar, but using the options below, it can also be recalculated:

  • After Order is Filled (parameter: calc_on_order_fills) - allows the strategy to perform an additional intra-bar order calculation immediately after an order fills. That extra calculation happens on both historical and realtime bars.
  • On Every Tick (parameter: calc_on_every_tick). By default, strategies only calculate on the close of realtime bars. This parameter allows the strategy to calculate on each update of realtime bars, like a study would. Note that tick data is lost when the chart is refreshed, so strategies using this option will repaint. This parameter does not affect the behavior of strategies on historical bars. Also note that strategies using this feature will not show realistic results on historical bars, as they contain no tick data.
Accueil Screener d'actions Screener Forex Screener Crypto Calendrier économique A propos Caractéristiques du graphique Prix Parrainer un ami Règles de conduite Centre d'aide Solutions site web & courtier Widgets Solutions de cartographie Bibliothèque de graphiques allégés Blog & News Twitter