Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Rentonn - Airbnb clone 1.0
VisualNEO for Windows 18.08.31.0
SentiVeillance SDK Trial 7.0.191272
dbForge SQL Complete 6.1
Uber for E-Scooters 1.0
ODBC Driver for MySQL 2.4
dbForge Schema Compare for MySQL 4.4
dbForge Studio for MySQL 8.1
dbForge Query Builder for MySQL 4.4
dbForge Data Compare for MySQL 5.5
Aqua Data Studio 19.5
ConyEdit for Windows 1.1.1
GetOrgChart 2.5.3.0
Database Workbench Pro 5.6.0
.Net VCL for Delphi 1.0.0.0
Top Code
MCU 8051 IDE 1.4.7
Project and Process Management Software 1.0
MATLAB Support Package for Arduino (aka ArduinoIO Package) 1.0
Panel Method Based 2-D Potential Flow Simulator 1.0
Online Vacation Rental Booking Website Script 4.3.0
Taxi Management System - Vaama Taxi 1.0
Ticket Booking System 1.0
Ping Pong Game Code Script 1.1
GUI for fuzzy based Washing Machine 1.0
Bessel Derivative Zeros 1.0
Hotel Management - Full Board Version 6.55
CreatiBe - Responsive HTML Template 1.0
Java Pattern Processor rc
Billing System 1.0.1
Simple Hill-Climbing 1.0
Top Rated
Paste phpSoftPro 1.4.1
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
ATN Mall 2.0
WeBuilder 2015 13.3
Backtesting Code for Algorithmic Trading Strategy 1.0
File ID: 80915






Backtesting Code for Algorithmic Trading Strategy 1.0
Download Backtesting Code for Algorithmic Trading Strategy 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 399.4 KB
Downloads: 19
Submit Rating:
Backtesting Code for Algorithmic Trading Strategy 1.0 Description
Description: %Author: Moeti Ncube
%This is code that can be used to backtest a trading strategy. The example strategy used was partially used in the development of a medium-frequency algorithmic trading strategy; this is a some of the backtesting coding we use to analyze tick data.

This code can be used to backtest a trading strategy for a time series that has the price vector in the first column and trading indicator in
second column. I will be using NG futures contracts for trading and will track pnl in terms of ticks (NG trades in ticks, so .001 ticks on ICE would be about $70/contract, $10/contract on NYMEX)

Over 17 days this strategy on this dataset would make about $1060 on NYMEX, or $7427 on ICE.

Data is stored in the first column and a (proprietery) indicator, that basically tracks the speed of market, is stored in second column.

%This code can be adjusted to incorporate another dataset/indicator as long as it assumes the basic strategy outline I will describe here. This is actually a simplification of my real strategy. For example, my real Buy/Sell indicator updates to be vt=max(v1,....vt-1) whereas here I make it static.

%Buy/Sell Indicator:
Whenever the indicator is less than value "v1", you buy one contract at the current price in market. Whenever indicater is greater than value "v1' you sell one contract at
current price in market.

%Profit Target:
%If the weighted average long/short position is "pt" ticks in the money you close out your position, make "pt" and strategy starts over from current price/ind.

%Stop Loss:
If the weighted average long/short position is "st" ticks out of the money, your strategy depends on you double down indicator "dd", If dd=0, you take the loss the first time this happens and strategy starts over. If dd=1, you add 1 contract to your long/short postion and obtain a new weighted average long/short price. Now, If your new long/short position becomes "pt" ticks in the money you double your profit to "2*pt", however if it becomes "st" ticks out of the money, you double your losses to "2*st"; Unless dd=2, in which once again you would buy another contract for potential "3*pt" gain or "3*st" loss.

%val(d,:) (matrix)
Here I use intraday data from 17 days in the market, val provides output from each day of the [pnl,percent profitability, sharpe ratio, number of trades]

%dtrades{d}
Here I track the profit or loss realized on each trade on a given day 'd'

License: Shareware

Related: priceind, quotstquot, starts, Close, Money, depends, Double, dd3d1, postion

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 399.4 KB

Downloads: 19



More Similar Code

Files used in the webinar - Algorithmic Trading with MATLAB Products for Financial Applications broadcast on November 18, 2010. This webinar can be viewed at http://www.mathworks.com/wbnr52491.

The download includes an additional demo, not shown in the webinar, that shows how to generate C-code from MATLAB.



These are the files and some of the data that I used in my recent webinar on Algorithmic Trading. Data has been shortened for size reasons. Included are:
MARISA
Nearest Neighbour model
Trailing stop-loss code
an illustration of...



This is the code for calculating solid angle C, surface pressure ps, and field pressure pf coming out from a pulsating cylinder with radius of r and normal velocity vn in an unbounded two dimensional acoustic domain using the solution of Helmholtz...



This Xsl template generates Java code for mapping objects to an Oracle database. You supply an Xml file with the details of the table, and Java Class to generate for dealing with that table. An XSL processor, like Xalan, is used to read the...



This Sourceforge project is used to host the underlying Drupal code for the Climate Change and Adaptation Strategy (CCAS) website created by the Greater London Authority. The website was commissioned by the GLA Intelligence Unit.



Open Source Code Demo of MATLAB Coder converting Hello World M script to C++ file

This is a simple demo of this powerful to demo the conversion of Matlab's M script file to a C++ file for your trading or target platform.



Accounting source code for Delphi. Databases supported are Firebird 1.5 and Interbase 6.5. Reportbuilder is used for the report engine. Reasonably priced for C/S! Multiple currency, GL, AP, AR, Job Costing and Inventory. More features planned...



These files are the MATLAB code for "Imperialist Competitive Algorithm (ICA)" which in some papers is referred by "Colonial Competitive Algorithm CCA".

Evolutionary optimization methods, inspired from natural...



PHP-CSL is an open source application written in PHP. It has been designed to let users store pieces/snippets of code for future reference.

It supports unlimited Libraries, Categories and Snippets. PHP-CSL was originally designed to...



Domain specific language for automated trading (robot) using opentick-ruby (for realtime quotes) and ib-ruby (for orders)

User Review for Backtesting Code for Algorithmic Trading Strategy
- required fields
     

Please enter text on the image