Showing posts with label HSI / MHI. Show all posts
Showing posts with label HSI / MHI. Show all posts

Wednesday, January 13, 2010

Playback to Bracket Trader

There are two ways to backtest that I know of using Amibroker;
Use the backtester
use the playback feature

Backtester - This requires some coding, coding that isn't required when trading live with Amibroker, Bracket Trader, and TWS. You have to watch out for a whole basket of different issues that can creep into the test. It remains a valuable tool.

Playback simulation - This is a great tool for practicing discretionary trading. It's also a great tool for testing your Bracket trader (BT) interface / system. If it would just work! I searched high and low and the net for some information on how to do this, or code that I could simply drop into Ami that would "make it happen". The good news is that I've finally got it to work, and surprisingly it wasn't to difficult to code, but getting the bug out was an issue.

Ive used it to test several days of 1 minute HSI system with BT to get the stats from it. The last thing I just completed tonight was exiting positions near the close. Still a few issues to work out with that. Still, the most difficult part is finding a system that generates a profit, I'm looking for a winning ratio of 40% or better.

Is anyone else using Amibroker playback in this fashion?

I was contemplating doing a video on this and posting the code. Not sure I want to spend the time to do it though.

Tuesday, December 1, 2009

HSI System

I'd like to start by saying that the formatting of the text doesn't work very well, and I don't feel like sitting here screwing around with formatting.
Since the last post I've been working on a trading system aimed specifically at the Hang Seng HSI trading on the Hong Long exchange. While developing the signals and code to support the trading system I've also discretionary traded MHI, the mini version of HSI. In addition I've been chatting with Steve from California and Mr RiskAddict from Japan, as you can see in the chat window on the right. If you're interested in autotrading I suggest you visit Mr. Addict's blog. BTW, Mr Addict mentioned this trading system file, and I think you should read it.
My AFL code is organized into blocks like this;
Filters - setting available in the params window
  • allowable trading times
  • shorting and buying switches to allow me to turn ON/OFF shorting or buying
Backtest parameters including a ON/OFF switch in the params window

Systems
This is blocks of code that are the sub-systems that make up the entire system of auto trading code. In the params window I have the ability to turn the sub-systems ON/OFF as well as set the order type for each system individually. See screen shot below.

Plot
This code lets me turn ON/OFF the plotting of the signals and some moving averages.

Test
Code that allows an instant order to be sent out as well as a test for writing a cancel order to Bracket Trader (BT)

Bracket Trader Code block for writing the text file that BT reads. I just purchased BT, allowing me to add my own symbols and change the audio alerts.
Backtest plot and code
This chunk of code allows the plotting of backtest results and simulates scaling out with an initial order of 3 cars (contracts). The plotting code tells me why the position was exited, it shows different shapedigits depending on things like stopped out, trail hit, profit target, etc.

Title code

Debug code
Sends specific into to DebugView

The System
The actual "system" consists of a bunch of sub-systems which I'll explain briefly. Here's an interesting wrinkle though - if System 1 buys and has hit 2 targets and is trailing the 3rd car, then system 2 shorts, the short is ignored. Signals are only taken once I'm flat. I call this letting the profits run and I'm OK with that because I do get wrong signals.
The system buys 3 cars, has an initial stop, 3 separate targets and a trailing stop. Here is how it works for now, subject to change without notice;
Buy 3 cars
set initial stop at 15
1st target at 10
2nd target at 20
3rd target at 50
move stop to BE at 1st target
trail at 2nd target
While I've been watching this system fire off signals and debugging it in the fly it's been profitable on simulation but I don't trust it just yet (profitable doesn't count the buggy entry's at market when it shouldn't have fired off a signal but did). I still need to do a successful backtest. I have backtested but haven't been happy with the code result of scaling out, needs some work. I also need some data and I'm working on obtaining that. So far it all looks promising. If the system turns out to be 'not so good', I'll have code that I can simply insert another system, or add to it.
I am considering manually firing BT based on the codes, I'll try that on sim, I don't think I can match the speed of the auto system though, even with BT at my fingertips.
Sub-Systems
A brief description of each;
1 Find a trend and jump in
2 Find a channel, or a cycle, and jump in
3 Find the momentum and go the other way - fade it
4 Find a MA that has reverses and jump in
5 Find two indicators going the same way and jump in
Each one of the above has it's own set of filters, for example, #4 doesn't just blindly jump in, it looks for some other stuff.
I don't know if this post will help anyone, that isn't my intent. I needed to write it down to better digest it. If it helps you, great.

Friday, October 30, 2009

HSI / MHI Hang Seng

I've been searching the web for blog posts and forums to gain insight into the HSI. It seems some of the comments are dated. If you trade this I'd appreciate any feedback or information you can offer (what doesn't work, what works) from your experience. Here is what I have learned thus far;

It's technical intraday chart looks very technical and normal, the daily looks like its on crack, gapping all over the place. The opening gap break out seems to work well, gap and run. I've been using the first 5 to 8 minutes to gauge the direction and strength. Then I bottom fish and take the breakout for my position and let it ride. Last night worked perfect, huge gains, sold when the upwards trend line broke.

I also only trade the "morning session" up to about midnight EST, then its bedtime. The "afternoon session" seems to have a mind of its own, like a different day.

The first half of the morning session moves and trends, the second half can be choppy, the range (ATR) increases too. Just before each session closes the price goes nuts.

I've read that the market is heavily manipulated by technical traders? I'm not sure what that means, it looks like it has some structure on the 1 minute time frame.

Questions for you if you trade this;

  • What is your daily target (in points or dollars)
  • What is your daily loss limit?
  • Do you trade specific time of the market?
  • Do fibs work? I have noticed they work somewhat, good gauge of a pullback but I generally don't count on them.
  • Do pivot points work? My guess is not since the gaps are huge, perhaps weekly pivots?
So far the P/L is floating in the black a little above break even and that's OK with me. Since I'm new to the Asian market, I need to learn it before going to bigger positions.
Any input would be helpful for me as I am building my strategy and plan for trading this puppy.

I also open up the chat room just before the market opens, its been quiet. Anyone know of any chat rooms for the Asian market?

Monday, October 12, 2009

HSI - Mini Hang Seng, and the big brother MHI

I live near Toronto, eastern time zone, I work during the day (not in the finance or trading field). I have free time after dinner and do some short term trading. Forex doesn't do much from 7pm to midnight unless you want to play ranges and scalp. Scalping doesn't work for me. I was looking to trade something that moves a little less choppy, has some liquidity, shows the volume, and can be traded technically. From my research which includes reading forums and blogs I have found the Asian markets are a good place for that. I'm taking trades at night on the mini Hang Seng futures (HSI).

Other contracts I have looked at include the following;


SPI - S&P/ASX 200 Index (Australia)
APZ9-SNFE-FUT-AUD

mini Hang Seng Stock Index
(MHI) MHIV9-HKFE-FUT-HKD

MSCI Taiwan Index @ SGX
TWV09-SGX-FUT-USD

Be sure to adjust the symbol for the correct contract expiry before trading.


Of the above, I have chosen to concentrate on MHI. Here is the chart so far tonight, 1 minute time frame over several days.
As you can see it trends nicely and has the odd gap fill. Trading shuts down for lunch time in Asia and when the come back there can be huge swings in the opening price, so trade small. I typically trade 1 or 2 contracts, depending on the set up. Right now the P/L is up and down, I'm learning the instrument and as long as I stay afloat and break even over the week I'm generally happy for now.

Intraday - HSI


Daily Chart - HSI


UPDATE:

Mr. Addict blogs about his experience with trading this instrument, both discretionary and Auto trading. Very interesting read and to me, his blog shows that he checks his results, indicating a high level of interest in success. This is something I lack (the checking results part) but I'm working on keeping the trade journal up to date. I'm going to use another approach and use AFL to import my IB TWS generated trade log and plot the trades. Then my notes will make sense. Keeping a spreadsheet doesn't appeal to me, it to slow, I prefer scratching notes.

Mr. Addict contributed a very valuable comment for those that trade MHI or HSI and use IB as their broker. Here is his comment, I've inserted the approximate USD equivalent values beside the HKD value so you can easily relate.

Addict said...

Why don't you try the full size contract, i.e., HSI instead of MHI? The bundled commish on MHI is 34 HKD (4.38 USD) per round trip and it's worth 10 HKD (1.29 USD) per tick. So price has to move four ticks in your favor to break even.

With HSI, the commish is 60 HKD (7.74 USD) per round trip, but each tick is worth 50 HKD (6.45 USD). So price only has to move two ticks in your favor to at least break even.

Better yet, go unbundled and you pay only 20.30 HKD (2.61 USD) per round trip for trading HSI, and 13.16 HKD (1.69 USD) for MHI. With unbundled, you need only one tick movement in your favor to break even with HSI, and three ticks with MHI.

Disclaimer

The information presented on this site is for educational and entertainment purposes only. This site contains no suggestions or instructions that you must follow, do your own research and due diligence before committing your cash to the markets. Your on your own.