function varargout = UI_CPPI(varargin)
% UI_CPPI M-file for UI_CPPI.fig
% UI_CPPI, by itself, creates a new UI_CPPI or raises the existing
% singleton*.
%
% H = UI_CPPI returns the handle to a new UI_CPPI or the handle to
% the existing singleton*.
%
% UI_CPPI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UI_CPPI.M with the given input arguments.
%
% UI_CPPI('Property','Value',...) creates a new UI_CPPI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before UI_CPPI_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to UI_CPPI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% editenddate the above text to modify the response to help UI_CPPI
% Last Modified by GUIDE v2.5 21-Mar-2007 11:05:25
% Begin initialization code - DO NOT EDITENDDATE
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @UI_CPPI_OpeningFcn, ...
'gui_OutputFcn', @UI_CPPI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDITENDDATE
function InitControlAndStructures(handles)
CPPI_Data.TransactionThreshold = 0.03;
CPPI_Data.SmoothingFactor = 0.8;
CPPI_Data.TransactionCost = 0.005;
CPPI_Data.Multiplier = 5;
CPPI_Data.Floor = 95;
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
% Initalize the sliders
set(handles.sliderMulti ,'Value',CPPI_Data.Multiplier);
set(handles.sliderTransactionThreshold ,'Value',CPPI_Data.TransactionThreshold * 100);
set(handles.sliderSmoothing ,'Value', CPPI_Data.SmoothingFactor);
set(handles.sliderTransactionCost ,'Value', CPPI_Data.TransactionCost * 100);
set(handles.sliderFloor ,'Value',CPPI_Data.Floor);
% Now update the text box accoridng to this
set(handles.editMulti ,'String',num2str(CPPI_Data.Multiplier));
set(handles.editTransactionThreshold ,'String',num2str(CPPI_Data.TransactionThreshold*100));
set(handles.editSmoothing ,'String', num2str(CPPI_Data.SmoothingFactor));
set(handles.editTransactionCost ,'String',num2str(CPPI_Data.TransactionCost*100));
set(handles.editFloor ,'String',num2str(CPPI_Data.Floor));
% --- Executes just before UI_CPPI is made visible.
function UI_CPPI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to UI_CPPI (see VARARGIN)
% Choose default command line output for UI_CPPI
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes UI_CPPI wait for user response (see UIRESUME)
% uiwait(handles.CPPI);
InitControlAndStructures(handles);
% --- Outputs from this function are returned to the command line.
function varargout = UI_CPPI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function txtPriceFile_Callback(hObject, eventdata, handles)
% hObject handle to txtPriceFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of txtPriceFile as text
% str2double(get(hObject,'String')) returns contents of txtPriceFile as a double
% --- Executes during object creation, after setting all properties.
function txtPriceFile_CreateFcn(hObject, eventdata, handles)
% hObject handle to txtPriceFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in btnPricefile.
function btnPricefile_Callback(hObject, eventdata, handles)
% hObject handle to btnPricefile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on slider movement.
function sliderMulti_Callback(hObject, eventdata, handles)
% hObject handle to sliderMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
CPPI_Data.Multiplier = get(hObject,'Value');
set(handles.editMulti,'String',num2str(CPPI_Data.Multiplier));
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
PbCompute_Callback(handles.PbCompute,'',handles);
% --- Executes during object creation, after setting all properties.
function sliderMulti_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function editMulti_Callback(hObject, eventdata, handles)
% hObject handle to editMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editMulti as text
% str2double(get(hObject,'String')) returns contents of editMulti as a double
% --- Executes during object creation, after setting all properties.
function editMulti_CreateFcn(hObject, eventdata, handles)
% hObject handle to editMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function sliderSmoothing_Callback(hObject, eventdata, handles)
% hObject handle to sliderSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
CPPI_Data.SmoothingFactor = get(hObject,'Value');
set(handles.editSmoothing,'String',num2str(CPPI_Data.SmoothingFactor));
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
PbCompute_Callback(handles.PbCompute,'',handles);
% --- Executes during object creation, after setting all properties.
function sliderSmoothing_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function editSmoothing_Callback(hObject, eventdata, handles)
% hObject handle to editSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editSmoothing as text
% str2double(get(hObject,'String')) returns contents of editSmoothing as a double
% --- Executes during object creation, after setting all properties.
function editSmoothing_CreateFcn(hObject, eventdata, handles)
% hObject handle to editSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function sliderTransactionThreshold_Callback(hObject, eventdata, handles)
% hObject handle to sliderTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
CPPI_Data.TransactionThreshold = get(hObject,'Value')/100;
set(handles.editTransactionThreshold,'String',num2str(100 * CPPI_Data.TransactionThreshold));
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
PbCompute_Callback(handles.PbCompute,'',handles);
% --- Executes during object creation, after setting all properties.
function sliderTransactionThreshold_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function editTransactionThreshold_Callback(hObject, eventdata, handles)
% hObject handle to editTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editTransactionThreshold as text
% str2double(get(hObject,'String')) returns contents of editTransactionThreshold as a double
% --- Executes during object creation, after setting all properties.
function editTransactionThreshold_CreateFcn(hObject, eventdata, handles)
% hObject handle to editTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function sliderTransactionCost_Callback(hObject, eventdata, handles)
% hObject handle to sliderTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
CPPI_Data.TransactionCost = get(hObject,'Value')/100;
set(handles.editTransactionCost,'String',num2str(100 * CPPI_Data.TransactionCost));
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data );
PbCompute_Callback(handles.PbCompute,'',handles);
% --- Executes during object creation, after setting all properties.
function sliderTransactionCost_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function editTransactionCost_Callback(hObject, eventdata, handles)
% hObject handle to editTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editTransactionCost as text
% str2double(get(hObject,'String')) returns contents of editTransactionCost as a double
% --- Executes during object creation, after setting all properties.
function editTransactionCost_CreateFcn(hObject, eventdata, handles)
% hObject handle to editTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in PbCompute.
function PbCompute_Callback(hObject, eventdata, handles)
% hObject handle to PbCompute (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
[CPPI_Data.CPPI_Path , CPPI_Data.TradedAmount, CPPI_Data.PercentageOfTradingDates,CPPI_Data.DynFloor,CPPI_Data.Exposure, CPPI_Data.ExpPercentage] = ...
GetCPPIPath(CPPI_Data.dates,CPPI_Data.Prices,...
CPPI_Data.Multiplier, CPPI_Data.Floor,...
CPPI_Data.SmoothingFactor,CPPI_Data.TransactionThreshold,...
CPPI_Data.TransactionCost);
hold(handles.Axes_CPPI_Path,'off');
plot(handles.Axes_CPPI_Path,CPPI_Data.dates(2:end),CPPI_Data.CPPI_Path,'-r','LineWidth',1.25);hold(handles.Axes_CPPI_Path,'on');
plot(handles.Axes_CPPI_Path,CPPI_Data.dates(2:end),CPPI_Data.DynFloor,'-g','LineWidth',1.25);
plot(handles.Axes_CPPI_Path,CPPI_Data.dates(2:end),100 * ret2price(price2ret(CPPI_Data.Prices(2:end))),'-k','LineWidth',1.25);
legend(handles.Axes_CPPI_Path,{'CPPI Path','Dynamic Floor','Underlying'});
datetick(handles.Axes_CPPI_Path,'x','mmmyy');
grid(handles.Axes_CPPI_Path,'on');
plot(handles.Axes_CPPI_Exposure,CPPI_Data.dates(2:end) ,100 * CPPI_Data.ExpPercentage);datetick(handles.Axes_CPPI_Exposure,'x','mmmyy');
grid(handles.Axes_CPPI_Exposure,'on');
legend(handles.Axes_CPPI_Exposure,{'% of Exposure'});
set(handles.editPerformance,'String', [num2str((CPPI_Data.CPPI_Path(end) - 100) ) ' %']);
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
% --- Executes on slider movement.
function sliderFloor_Callback(hObject, eventdata, handles)
% hObject handle to sliderFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
CPPI_Data.Floor = get(hObject,'Value');
set(handles.editFloor,'String',num2str( CPPI_Data.Floor));
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
PbCompute_Callback(handles.PbCompute,'',handles);
% --- Executes during object creation, after setting all properties.
function sliderFloor_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function editFloor_Callback(hObject, eventdata, handles)
% hObject handle to editFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editFloor as text
% str2double(get(hObject,'String')) returns contents of editFloor as a double
% --- Executes during object creation, after setting all properties.
function editFloor_CreateFcn(hObject, eventdata, handles)
% hObject handle to editFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPrices_Callback(hObject, eventdata, handles)
% hObject handle to editPrices (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editPrices as text
% str2double(get(hObject,'String')) returns contents of editPrices as a double
% --- Executes during object creation, after setting all properties.
function editPrices_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPrices (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile('*.xls','Select the file containing price series');
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
[CPPI_Data.Prices, CPPI_Data.dates] =SimpleXLsReader(FileName);
set(handles.editStartDate,'String', datestr(min(CPPI_Data.dates),'dd/mm/yyyy'));
set(handles.editEndDate,'String' , datestr(max(CPPI_Data.dates),'dd/mm/yyyy'));
set(handles.editPrices,'String' ,FileName);
setappdata(handles.CPPI,'CPPI_Data',CPPI_Data);
function editStartDate_Callback(hObject, eventdata, handles)
% hObject handle to editStartDate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editStartDate as text
% str2double(get(hObject,'String')) returns contents of editStartDate as a double
% --- Executes during object creation, after setting all properties.
function editStartDate_CreateFcn(hObject, eventdata, handles)
% hObject handle to editStartDate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editEndDate_Callback(hObject, eventdata, handles)
% hObject handle to editEndDate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editEndDate as text
% str2double(get(hObject,'String')) returns contents of editEndDate as a double
% --- Executes during object creation, after setting all properties.
function editEndDate_CreateFcn(hObject, eventdata, handles)
% hObject handle to editEndDate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: editEndDate controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider7_Callback(hObject, eventdata, handles)
% hObject handle to sliderMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider7_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit10_Callback(hObject, eventdata, handles)
% hObject handle to editMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editMulti as text
% str2double(get(hObject,'String')) returns contents of editMulti as a double
% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject handle to editMulti (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider8_Callback(hObject, eventdata, handles)
% hObject handle to sliderSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider8_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit11_Callback(hObject, eventdata, handles)
% hObject handle to editSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editSmoothing as text
% str2double(get(hObject,'String')) returns contents of editSmoothing as a double
% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject handle to editSmoothing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider9_Callback(hObject, eventdata, handles)
% hObject handle to sliderTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider9_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit12_Callback(hObject, eventdata, handles)
% hObject handle to editTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editTransactionThreshold as text
% str2double(get(hObject,'String')) returns contents of editTransactionThreshold as a double
% --- Executes during object creation, after setting all properties.
function edit12_CreateFcn(hObject, eventdata, handles)
% hObject handle to editTransactionThreshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider10_Callback(hObject, eventdata, handles)
% hObject handle to sliderTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider10_CreateFcn(hObject, eventdata, handles)
% hObject handle to sliderTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit13_Callback(hObject, eventdata, handles)
% hObject handle to editTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editTransactionCost as text
% str2double(get(hObject,'String')) returns contents of editTransactionCost as a double
% --- Executes during object creation, after setting all properties.
function edit13_CreateFcn(hObject, eventdata, handles)
% hObject handle to editTransactionCost (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit14_Callback(hObject, eventdata, handles)
% hObject handle to editFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editFloor as text
% str2double(get(hObject,'String')) returns contents of editFloor as a double
% --- Executes during object creation, after setting all properties.
function edit14_CreateFcn(hObject, eventdata, handles)
% hObject handle to editFloor (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function editPerformance_Callback(hObject, eventdata, handles)
% hObject handle to editPerformance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of editPerformance as text
% str2double(get(hObject,'String')) returns contents of editPerformance as a double
% --- Executes during object creation, after setting all properties.
function editPerformance_CreateFcn(hObject, eventdata, handles)
% hObject handle to editPerformance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uiputfile('*.xls','Please select a file for export');
filename = [pathname filename];
CPPI_Data = getappdata(handles.CPPI,'CPPI_Data');
StrDates = datestr(CPPI_Data.dates(2:end), 'dd/mm/yyyy');
CellDates = cellstr(StrDates);
CellDates = [{'Dates'};CellDates];
CellPrices = [{'Prices'};num2cell(CPPI_Data.CPPI_Path)'];
xlswrite(filename, [CellDates CellPrices]);
% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete(handles.CPPI);