Into to Auto Trading Systems Lecture Notes c Yuewu Xu
Homework #2 Into to Auto Trading Systems Due date: September 24, 2020 (in class)
[email to dedicated address: autotrading50@gmail.com]
Important Note: All home works should be handed in hard copies. No late homework will be accepted. Answers should contain both the Matlab program, PLUS screen snap shorts to demonstrate correct running of the program.
Problem 1 (Writing Matlab Functions). Write a matlab function [A] = avg(X, m) that does the following:
It takes 2 inputs: daily stock price series, say Xt for t = 1; 2; :::; T ; and an integer m: The function returns the moving average A for the last m prices:
1 XT A=m Xt:
t=T m+1
Test run your function with a data of you choice (could be fake data) on the Matlab command to show it
works properly. [You will need to include printscreen in your HW to show it did work]
Remark : Please read the chapter in the Matlab Primer document on BB to learn how to write functions.
Problem 2 (Data Query in IBMatlab). Run the IBMatlab command in the Matlab Command Window to show that you can:
query stock price (pick your own stock) when the market is open 9:30AM – 4:00PM
query futures price (pick your own futures contract, such ES, YM, NQ contracts) when the futures market is open.
School of Business, Fordham University – Spring 2020
Into to Auto Trading Systems Lecture Notes c Yuewu Xu
Note: printscreen your command window for the results and command for the HW.
Problem 3 (Simple Order Execution in IBMalab). Pick a stock and a futures contract. Run IBMaltab command in the Matlab Command Window to show that you can:
BUY and SELL the stock when the stock market is open 9:30AM – 4:00PM BUY and SELL the futures contract when the futures market is open.
Note: Printscreen your command window for the results and command for the HW. Also, clear your positions in your account after the HW.
School of Business, Fordham University – Spring 2020