Saturday, September 27, 2008

2nd Prog

// my second AFL program - 27th Sep 2008
// base on countertrend return to normalcy

// buy when price high deviate from 20EMA
// sell when price high come back to 3EMA

// comparing high, 3EMA and 20EMA to tell trend
Downtrend = (High < EMA(Close, 3)) AND
(EMA(Close, 3) < MA(Close, 20));

// conditions for buy and sell signals
Buy = (High < 0.98 * EMA(Close, 20)) AND Downtrend;
Sell = Cross(High, EMA(Close, 3));

Thursday, September 25, 2008

First Prog

// my first AFL program - 25th Sep 2008
// base on trading along the major trend

// buy on decisive testing of 40EMA in an uptrend
// sell next day at opening after breaking 20EMA

// 40EMA crossing up and down signals
EMACrossUp = Cross(Close, EMA(Close, 40));
EMACrossDown = Cross(EMA(Close, 40), Low);

// time taken for testing of 40EMA from above
EMATestTime = BarsSince(EMACrossDown);
DecisiveEMATest = EMATestTime < 10;

// comparing 20EMA with 10 days ago to tell trend
Uptrend = EMA(Close, 20) > Ref (EMA(Close, 20), -10);

// combining 3 conditions for buy signal
Buy = EMACrossUp AND DecisiveEMATest AND Uptrend;

// using breakdown of 20EMA for sell signal
Sell = Cross(EMA(Close, 20), Close );

Wednesday, September 24, 2008

40EMA

Here's a simple way to tell shortterm tradable trend. Observe what happens AFTER price breaks 40EMA. Eg SGX 40EMA at 645. IF price hold above 645 for next 2-3 weeks, market has probably reversed.

I told my friends dont bother look at market until mid oct. Using principle of price symmetry, IF trend is to turn, market needs at least that amount of time to secure 40EMA.

AFL

Amibroker Formula Language
AFL has similar features to commercial development languages. Decision making using loops and boolean logic, data manipulation using arrays, modular design using function calls, etc.

Generation of trade signals is accomplished using arrays of price history and system conditions (true or false). Through the use of in-built functions and self-designed algorithm, my objective is to tell "when to buy, when to sell, when to wait".

AFL Function Categories
Basic price pattern detection
Composites
Date/Time
Indicators
Information / Categories
Lowest/Highest
Math functions
Miscellaneous functions
Moving averages, summation
Statistical functions
String manipulation
Trading system toolbox
Exploration / Indicators
File Input/Output functions
Low-level graphics
Referencing other symbol data
Time Frame functions

Wednesday, September 17, 2008

Timeline

Sep - learn amibroker language (practice examples)
Oct - background and literature review (strategies)
Nov - development and backtesting (research core)
Dec - development and backtesting (develop core)
Jan - algorithm optimization (refine parameters)
Feb - results and conclusion (future directions)

Updated Oct:
There may be some change to timeline as I am on business trips often next 3 months. I stick to above schedule where possible. If quality is compromised I will extend Project B.

Updated Dec:
Completed
Sep - learn amibroker language (practice examples)
Oct - background and literature review (strategies)
Nov - development and backtesting (research core)

Pipeline
Jan - development and backtesting (develop core)
Feb - algorithm optimization (refine parameters)
Mar - results and conclusion (future directions)

Tuesday, September 16, 2008

About Me

RallyArtist started trading in the fading bull market of 2007. The harsh bear market that followed inspire him to build an intelligent trading program to analyze stock price movements.

Hosting a thread in Channel NewsAsia stocks forum, he posted the system's buy call on market in mar'09 to see STI advance 1000 points six months later. After a sell call in jan'10 and correction, he posted a buy once again at STI 2750 to see it breaking new grounds.

Using technical analysis, he won Citibank stock challenge '08, and came in second for Macquarie warrant hotshot '09.

Monday, September 15, 2008

Project B

This blog is dedicated to building an intelligent trading system ~ codename Z. A system helps to increase profitability by reducing discretionary and emotional handicaps of traders. about me

Resource (input)
1. 6 months of my time (part-time since I hold a day job)
2. books, online resources, trader friends, real trades
3. a flair for creativity and a never-give-up attitude

System (process)
Amibroker 5.10 Professional - chosen over Metastock as AFL (Amibroker Formula Language) offers powerful programming to facilitate backtesting and algorithm development.

Result (output)
An intelligent trading system with the following features:

1. Takes EOD data as input and generate buy/sell/wait signals as output

2. Ability to analyze market conditions for backtested-profitable entry setups

3. A potential AI self-learning algorithm for action / result / review / adjust cycle

Updated May:
Results suggest points 1 and 2 are met. Point 3 is more challenging, self-learning hmm.. Let's work it out in future.