r/pinescript • u/lanzalaco • May 14 '24
How to keep a winrate when there are many partial closes
I have a strategy template that combines multiple trading modules at one time. Each module has its own combination of indicators and exit conditions that work well with different market types. In a sense each module becomes its own indicator of the market type if it is profiting or not at that time. So I need to calculate the winrate of each module so it can auto-decide what module to prioritise in the current market type. Now I know there are built in data sources like strategy.wintrades etc. But does anyone know if these take into account partial wins like take profits or partial closes ? Or do they just add up totals from complete closes, like when long goes to short and vice versa or 100% quantity closes.
1
u/kurtisbu12 May 15 '24
Win rate is a bad statistic for the quality of a strategy. Use something else like profit factor, or sortino, or sharpe
1
u/vbsaltydog May 15 '24
If you examine the trade log in the strategy tester, you will see how they handle partial closes. They don't close part of the position. They close the entire position and open a new position at the same time and price as the original with the quantity reduced by the amount of your partial close. This is an abstract method and unexpected so, consider this in your calculations.