If I had concluded something I wouldn't be asking here...
Ok, gonna do some reading.
Alain
@Alain
Posts made by Alain

RE: sharpe ratio wrong?

RE: sharpe ratio wrong?
I didn't include any riskfree rate. Or say I set it to zero.
So you're right, there are for sure some differences in my calculations compared to the analyzer. You think if I change these two things (# days/rate) it would give me the "right" sharpe ratio ? 
RE: sharpe ratio wrong?
So my guess now is that it's exactly this part of the parameters which causes the issue:
 list itemfactor (default: None)
If None, the conversion factor for the riskfree rate from annual to the chosen timeframe will be chosen from a predefined table
Days: 252, Weeks: 52, Months: 12, Years: 1
Else the specified value will be used
I should probably specify that it should use 365 days?

RE: sharpe ratio wrong?
Question number 1:
I have read it several times... probably i didn't understand it. Or I didn't find an answer to my problem.
Question number 2:
I am trying to calculate an annual sharpe ratio for a bitcoin strategy using hourly charts.
Question number 3:
Yes you're right. Equity curve of my strategy:
Performance:
Strategy long startdate: 20150101 00:00:00 enddate: 20180601 00:00:00
Sharpe Ratio calc: 3.84
Return: 4461.33%
Annualized Return: 205.93%
Sharpe Ratio: 0.65
Max Drawdown: 29.26%
MAR: 7.04
Number Trades: 135; Number Longs: 135; Number Shorts: 0
Win/Loss Ratio 0.88; Long Win/Loss Ratio: 0.88; Short Win/Loss Ratio: nan
Mean Return: 3.33%; Mean Ret per Long: 3.33%; Mean Ret per Short: nan%
AverageHoldingBars 124.61You see 2 different sharpe ratios: "Sharpe Ratio: 0.65" is what I receive from the analyzer. "Sharpe Ratio calc: 3.84" is what I calculated with my own implementation.
Question number 4:
I use 365, because it's Bitcoin... so traded every day of the year.
Thanks!!

sharpe ratio wrong?
Hello!
I've been using the result from the sharpe ratio analyzer for quite some time simply as follows:
cerebro.addanalyzer(btanalyzers.SharpeRatio, _name='mysharpe')
My data is hourly... but i don't think i need to take that into consideration in the sharpe ratio parameters, right?
A week ago someone who is more advanced in trading than me saw my equity curves and said there's no way the sharpe ratio is correct. So I implemented it by myself:def get_sharpe(thestrat, f_result, total_days): daily_ret_1 = thestrat.analyzers.dailyret.get_analysis().values() len_list_daily_rets = len(daily_ret_1) #to only get relevant data without max period etc daily_ret = list(daily_ret_1)[(len_list_daily_retstotal_days1):] mean_daily_ret = mean(daily_ret) daily_ret_array = np.array(daily_ret) daily_volatility = np.sqrt(sum((daily_ret_array  mean_daily_ret)**2)/(len_list_daily_rets1)) annualized_volatility = np.sqrt(365)*daily_volatility cummulative_return = list(thestrat.analyzers.timeret.get_analysis().values())[0] annual_return = (1 + cummulative_return) ** (365. / total_days)  1 sharperatio = annual_return / annualized_volatility f_result.write("Sharpe Ratio calc: {:.2f} \n".format(sharperatio))
I got completely different results..
Has anyone an idea why that is? Did I miss a parameter when adding the analyzer?Thank you!

RE: Plot (matplotlib?) Problem
thanks @RobinDhillon, gonna check it out.

RE: Plot (matplotlib?) Problem
@robindhillon Alright, so I added the following lines:
import matplotlib
matplotlib.use('PS')
then it worked. (when i directly save the plots they still don't look nice.. but that's not so important) 
RE: Plot (matplotlib?) Problem
Hey @RobinDhillon Thanks for your answer. I had everything running with anaconda, but the plots didn't look as nice as they should (i pointed it out in an earlier post here). So I deinstalled everything conda related and switched to pycharm. Now I have the problem mentioned above.
So I now installed matplotlib as described on their site: python m pip install U matplotlib
Is this what you mean by "reinstalling it from the source itself" ? Or should I do what is written in the "Installing from source section" ? on this site https://matplotlib.org/users/installing.html . can it be that complicated ? :O
Thanks 
Plot (matplotlib?) Problem
Hi!
Whenever I try to plot something I get the following error:Would be amazing if anyone here has a solution to that problem.
Thanks. 
RE: plot size question
same result unfortunately... also updated matplotlib, de and reinstalled anconda, but nothing helps so far.