Pine Script_Calmar Ratio Custom Range

Forums ProRealTime English forum ProBuilder support Pine Script_Calmar Ratio Custom Range

  • This topic has 6 replies, 2 voices, and was last updated 1 day ago by avatarIván.
Viewing 7 posts - 1 through 7 (of 7 total)
  • #246216

    This indicator aims to provide a risk-adjusted return statistic for a security over a selected period. Return is measured as CAGR and risk as Max Drawdown. The ratio of these two gives the Calmar Ratio. It works on any timeframe or range.

    Calmar Ratio Custom Range on TradingView (open-source script)

    It would be great if someone could convert it to ProBuilder.

     

    #246329

    Here you have:

    #246347

    Now it’s better than the previous one.

    #246468

    Thank you Iván for the conversion — I have a few suggestions:

    • The indicator currently has 4 manual inputs, while the TradingView version uses just 2 and allows easy selection of  dates by directly clicking on the candles.

    • It only works on the daily timeframe; on others, it shows ‘n/d’ or this message: “Check the start date you entered. It might be that you don’t have enough bars loaded. Or maybe you entered a day/time when the market was closed.”

    In the Pine Script version, date selection is straightforward on any timeframe. It also offers the ability to divide the CAGR by the Max DD since inception.

    I recommend checking how it works on TradingView to see it in action.

    #246477

    If you want to perform the calculation from the beginning, then you need to add the boolean variable showbeg and change it depending on whether we want to select 2 dates or take all historical data.
    Regarding selecting dates from the chart by clicking on the candlestick, this is not possible in ProRealTime.

    #246495

    I understand that choosing start and end dates by candle is not feasible in ProRealTime. I also believe there might be a quicker way than using 4 inputs — maybe just 2 would be enough (with hours either predefined or detected based on the timeframe?).

    The next step would be to screen for it (calculating a rolling Calmar Ratio with a custom lookback period in ProScreener).

    This could help identify the best-performing stocks over the last 1M, 3M, or 6M periods (for example) on a risk-adjusted basis — similar to a momentum strategy, but adjusting raw returns by risk (where risk is = Max DD here).

    Let me know what you think about it.

    Note: Yesterday, when I was changing inputs on the daily timeframe, it was working fine. Now, it no longer works (even when trying with the previous code). I change the date, but nothing happens. I’m new to this platform, and I don’t really understand how it could work yesterday but not today…

    #246507

    Of course, you can set a predefined time and only modify the dates.
    You can adapt it however you want.
    Regarding the screener, when you start working on it, keep in mind that depending on whether you have the complete version or the premium version, you will be able to reference back 255 bars or 1024 bars, respectively.

Viewing 7 posts - 1 through 7 (of 7 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login