function drawExp(hist_dates, hist_close)

dates = hist_dates;

vout = indicators(hist_close, 'ema', 13)
exp = vout(:,1)

exp_out = fints(dates, exp);
close_out = fints(dates, hist_close)
p1 = plot(close_out, 'r');
set(p1,'LineWidth',2)
hold on
p2 = plot(exp_out, 'g')
legend('Close', 'Exponential weighted moving')
set(p2,'LineWidth',2)
hold on

ylabel({'EMA13'})
xlabel({'Timeline'})

NumTicks = 18;
L = get(gca,'XLim');

set(gca,'XTick',linspace(L(1),L(2),NumTicks))

% set(get(gca,'XLabel'),'Rotation',270)
dateaxis('x', 2)

%price = fts2mat(fints(dates, data));
%pom = fints(dates, data);
%price = fts2mat(pom);

%Calculate the exponential weighted moving average moving average.
%exp = tsmovavg(price,'e',window_size)

%---------TRITYDENNI
%fileID = fopen('ema3.txt','wt');
flag = 'calm'

for i = 3:length(exp)    
    last_value = exp(i)
    pre_last_value = exp(i - 1)
    pre_pre_last_value = exp(i - 2)
    today = dates{i}
    
    %pokud hodnoty rostou, je trend rostouci
    if (pre_pre_last_value < pre_last_value && pre_last_value < last_value)
        flag = 'increasing trend'
    %analogicky pokud klesaji, je trend klesajici   
    elseif(pre_pre_last_value > pre_last_value && pre_last_value > last_value)
       flag = 'decreasing trend'
    else flag = 'calm'
    end
 
 %nbytes = fprintf(fileID,'day : %s, pre_last_value : %f, last_value : %f, flag - %s\n', today, pre_last_value, last_value, flag)
end
%fclose(fileID);


%---------DVOUTYDENNI
%fileID = fopen('ema2.txt','wt');
flag = 'calm'
filename = 'EMAdata.xlsx';

for i = 2:length(exp)    
    last_value = exp(i)
    pre_last_value = exp(i - 1)
    today = dates{i}
    
    %pokud hodnoty rostou, je trend rostouci
    if (pre_last_value < last_value)
        flag = 'increasing trend'
    %analogicky pokud klesaji, je trend klesajici   
    elseif(pre_last_value > last_value)
       flag = 'decreasing trend'
    else flag = 'calm'
    end   

    A = {'day', today, 'pre_last_value' , pre_last_value, 'last_value', last_value, 'flag', flag}
    sheet = 1;
    xlswrite(filename,A,sheet,strcat('A',num2str(i)));

 %nbytes = fprintf(fileID,'day : %s, pre_last_value : %f, last_value : %f, flag - %s\n', today, pre_last_value, last_value, flag)
end
%fclose(fileID);