Sharpe Ratio and Sortino Ratio Calculator for Day Trading Strategies

By Lawrence

image

After I explained in the article, How to Calculate Sharpe Ratio and Sortino Ratio Correctly on Day Trading Strategies, many readers have asked for example on how to calculate the Sharpe Ratio themselves given that all platforms are not reporting the correct values when developing day trading strategies without position sizing. So here it is, an indicator written for Tradestation that takes care of the calculation for you.

Installation

Download the indicator from the Software Store. It is free for premium members and $30 otherwise.

It is also not protected. Just import the code and you can start using the indicator. Feel free to modify the code to fit your need.

Inputs

Initial Capital – Default to $20,000. Enough for most future contracts day trading need.

Risk Free Rate – Default 2%. 2% is really still too much because you can’t get 2% interest from putting money in the banks. You can set it to 0.1% instead.

Days Per Year – Default to 252. It is the number of trading days per year. Technically some people prefer to use 52 weeks x 5 days = 260 days.

Target Return – Default to 5%. It is the expected return the trader / fund manager expected to get with almost no effort. e.g. investing into certain types of assets that generate 5% cashflow after operating costs.

Output Log – Default to false. The example output returns the date, closing price of the day and the equity value into the EasyLanguage Print Log window. You can then copy the text into Excel or other programs for other analysis.

How to Use the Indicator

Simply add the indicator to the chart with your trading strategies enabled and you will see a plot of the equity curve. Then you know the calculation is already done.

image

Then open the Easy Language Print Log window you will see the output.

image

Nothing fancy. You simply get the figures you need.

Customization

I heavily documented the code by using meaningful variable names so that you can easily see what I am trying to do in the code.

The indicator is done in a way with no need of additional support functions.

If you are interested in adding more performance ratios feel free to do so. If you do not mind sharing the code just post your ideas in the comment section below.

Share

Comments
  • sdattafx July 3, 2020 at 5:47 am

    Very grateful for this..

  • You must be logged in to comment. Log in