Position Sizing – constant cash

This script invests the same ammount of money with every trade. This is especially useful when backtesting a strategy. If you would always trade 1 contract, the absolute level of the market would impact your backtest results.
Investing the same ammont of money automatically overcomes this effect. To avoid rounding errors select the amount to be invested 100*Maximum of market in backtest.

This script overrides the tradesignal money management setting defining the standard size to be traded. If your strategy says how may shares to buy or sell, this script will not override your strategy.


Meta: Synopsis("Invests the same amount of money in every trade");
Inputs: invest(100000);
Variables: con;

con=round(invest/close,0);

SetDefaultQuantity(maxlist(1,con));

Save code as strategy

Leave a comment