I have some problems with tradeSignal.m function
It seems to be a mistake there: le assume we have
pop = [ 1 0 0 1 0 0 0 0 1 1]
,which means not to use indicator1, and return True if indicator2 == 1 and indicator3 == 0
signals = [ 0 1 0], which must satisfy the conditions of pop.
Now, I run tradeSignal(pop, signals) and get 0.
So there is a mistake. I'm thinking of line 50 and 57. But first we should declare
line 46: filteredSignals = ind(:,ind2use);
line 51: A = eval(['(filteredSignals(:,1) == pop(r,',idxstr,'));']);
line 57: B = eval(['(filteredSignals(:,',num2str(i+1),') == pop(r,',idxstr,'));']);
Now, test of corrected function
signals =
[0 0 0;
0 0 1;
0 1 0;
0 1 1;
1 0 0;
1 0 1;
1 1 0;
1 1 1];
s = tradeSignal(pop, signals)
s =
0
0
1
0
0
0
1
0
Hi is just wanted a sharpe question :)
%%
% Develop a trading signal and performance measures. We'll assume 250
% trading days per year.
s = zeros(size(BundClose));
s(lead>lag) = 1; % Buy (long)
s(lead<lag) = -1; % Sell (short)
r = [0; s(1:end-1).*diff(BundClose)]; % Return
sh = sqrt(250)*sharpe(r,0); % Annual Sharpe Ratio
Hi Stuart,
if I am to use minute data(NOT DAILY as used in the example) does that mean i have to adjust the sharpe annual scaling as well?
i.e. sqrt(250*60*11)
Comment only