CobraMetrics

This Library was made to ease the implementation of the "Coded Metrics Table" for strategy evaluation, as well as the plotting asthetics for it's "Equity Curve" that is used for indexing.
Moreover, it will boost your code's efficiency by reducing it of somewhere around 200 lines.
curve(disp_ind)
Call this function in a plot() to get a certain curve of your strategy, depending on your "disp_ind" input.
Parameters:
disp_ind
Returns: curve of your selection
cleaner(disp_ind, plot)
Call this function in your Strategy's plot() lines to filter out your Strategy plots when displaying equity or any other curve.
Parameters:
disp_ind
plot : the variable you want to plot.
cobraTable()
Call this function to get the "Cobra Table" of your strategy
Special thanks to ShauryaM14 for the cell calculatons.
Simply copy paste the following into your strategy script
I have decided to add the following metrics on top of the usual ones since they provide you with a clearer POV of your strategy,
to decide if it fits your trading\investing style. Although, they are not included in the evaluation of a ⚡💫 𝙎𝙎𝙎𝙡𝙖𝙥𝙥𝙚𝙧 💫⚡.
Net Profit Long\Short Ratio - Theoretically, a good strategy has a fair balance between both sides of its trading directions. Clearly this is subjective since most assets are assymetrical and some people challenge the idea of a strategy trading both ways. Still, it gives useful insight.
Max Consecutive Wins\Losses - Checks for consistancy in the strategy
Max Flat Days - Gives an approximation of how fast\slow the strategy is. Are you patient enough to wait that long till your strategy fires? Irrelevant for fully perpetual strategies (Those which are always in a position, switch from one direction to the other. The alternatives are called semi perps)
Total Months in Profit\Loss - Are you able to financialy withstand that long in a loss? Are you able to manage your capital correctly in the winning period to minimize potential losses?
Updated customization, corrected calculation of some metrics to work on different timeframes (hopefully I did it right).
This one will be slightly harder to achieve slapper status, good luck.
1. Addressed the visual overlapping of cells on smaller screens, such as laptops. (Even works on mobile lol)
2. Added the option to switch display between "Full" and "Simple" layouts, can also hide the table completely.
3. Added the functionality to change the position where the table will be anchored.
4. Increased the variety of timeframes the anual metrics such as Sharpe, Sortino and Omega will be calculated correctly.
5. Added Net Profit % metric. (Friendly reminder to optimize for efficiency)
Omega Ratio correction update.
Slapper Value = 1.35
GL
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.