Wednesday, December 17, 2008

Free eBook for everyone! - How to find free books online

Yet another effective way of minimizing capitol depreciation by NOT paying for books.

If you have been reading this blog for a while you might remember the post about how to find books on line for free. How to find free ebooks is the topic once again. The post was on Tools for trading education. Read it after this post for a complete understanding.
Recently I wanted to read a book and did a quick search for the title. (This post will not use specific book names in the text as there are often searches done to find websites that show others where to find this material. I will give you the tools, you find it yourself!!)
To find almost anything you want, use the Google advanced search. Check out the screen shot below that shows how I searched for the book. Here is the Google advanced search.

... and the results, see the "visited" link?

Here is the link to the advanced search page results from Google, a link for an ebook, go to the second page down near the bottom. You will quickly find a link to the pdf.

Here is yet another trick if you have made it this far. Right click on the google link and select "copy shortcut". Paste that into the address bar of your browser and then remove the last part of the link that is the file name. Then hit enter. This will, in most cases, show you the contents of the directory. In this case, you are presented with a long list of books you might be interested in reading. All you need know is a cold beer and a large monitor. Enjoy!

Wednesday, December 10, 2008

Tipster Trendlines - v2.1 being finalized

I've just sent the latest code (v2.1) to three others who offered to help get it all working. For the most part it works fine, just needs some calculations for the risk panel. I've tried to make it determine risk based on user selection of stocks, futures, or forex.

There are a few other brand new features too.

With the extra help, this shouldn't take to long.

Tuesday, December 9, 2008

How to Trade from Work

Don't want IT to know what your doing online? Trading, cruising porn, chatting, whatever you want to do, do it like you were sitting in front of your home computer. All IT can see is that you are accessing a remote computer, they won't know what your doing. It's your own proxy server!!

Use Windows Remote Desktop. This video takes you through a high level of setting this up. Sorry for the crappy quality.

Here is a resource for
Remote Desktop Q&A.

An excerpt from the above:

Q. What port does Remote Desktop use? Does everything go over port 3389?

A. Port 3389 is the only port you need to open. Windows will attempt to stream sound through User Datagram Protocol (UDP) first. If no port is available for UDP, sound will stream through a virtual channel in Remote Desktop Protocol, which uses port 3389.

Q. How do I connect Windows Desktop Client to a remote port other than 3389?

A. In the Computer field in the Remote Desktop Client connection dialog, specify the port in either of the following ways:
• Computer name, colon, port number
Example: TSComputer: 22229 • IP address, colon, port number
Example: 22229

Monday, December 8, 2008


Interesting chart pattern on the USDCAD. Triple top with an ascending wedge. A triple top gives it a bearish feel but the pattern is not valid until it breaks lower support. The ascending wedge gives it a bullish overtone. Since we don't have volume to add to the clues, we can only use price action. Notice the buyers were not waiting to buy shown by the lower lows. Also the lower lows get closer together, so they are also not waiting as long to jump in. On the other hand, look how fast price jumped off the top resistance line, telling us all kinds of sellers came in, plus its a big super fat round number (1.3000).

Buy on a break over 1.3 with tight stops, it either goes like a f'n canon, or fakes out and reverses back into the channel.

On a break out, you could also put in a short stop order below the 1.3000 line to catch the fake out on its way back to the bottom of the channel.

This is the type of pattern I would use breakkouts on, not channel trading. The converting to USD might be over, then again it might not. Use price action to guide you. Don't enter at the middle of the channel, enter at the top or bottom, this allows you to use tight stops, control risk, and have an edge.

Wednesday, December 3, 2008

Trading from work

There is a poll on the right side of the blog, "Do you trade from work?"
Do you? Take the poll.

If we take these results, we can see that 54% of the responders want or actually do access there trading account from work. Here is what I'm getting at; Does anyone want to see a video of how you can do this without the IT department knowing what your doing? There is nothing illegal here. You just have to know how technology works to be able to avoid the "tracking logs". Make no mistake, you will be a part of the log, but it wont show up that you are using TWS or WebTrader, or continually accessing your brokers web page.

You may be think, he is using a proxy server. No, that's not it, but close. So, do I have your attention? Take the poll first, then leave a comment.

Currently, this is what the poll looks like:

Tuesday, December 2, 2008

Good Reading and Video

In my opinion, support and resistance with momentum are the way to trade. It involves the alignment of the trend on multiple time frames. You may have heard this before and it is difficult to put it to use. But it is like anything else, you need to practice. Practice makes you remember the rules. We have all heard that we should find something we are comfortable with and stick to it with discipline. If this is your style, all you need to do is pick the smallest time frame from which you want to trade. Use three time frames. I like to use the weekly, daily, and hourly to pick where I will enter.
The following video by Brian Shannon will help you understand this concept. If you want more reading, buy his book. He doesn't over complicate things, he makes it gumby pokey easy to understand. In case you don't know this because you've been living under a rock for 2 years, Shannon was the head of training at MarketWise for some time. They are a very good trading training firm in the US. Previously I have mention Sam Seidens work who also works for them. Shannon is a full time trader now. Buy his book. It is good for any type of trading, even forex. (If you use this link, I actually get paid a dollar or two).

In addition to this, if your interested in forex, read this PDF. It explains things pretty well at a high level. The "rules" and description of discipline and money management are honest, not a bullshit bunch of crap that is usually written.
One more thing before the video. Read this post to understand more about support and resistance. It explains the Gap & VWAP. The VWAP is the volume weighted average price.

The video below is timeless. I watched it three times to memorize the info. If you can memorize it, you will do better. Think of your job, and how you just "know" what to do day in and day out. You know it becuase you have done it so many times. Use a demo account, that will help memorize the info and required action. Again, watch the video a few times.

Wednesday, November 26, 2008

Tipster Trendlines - Update

This page is out of date, click "Tipster Trendlines" at the top of the page.

A quick update on the code; I haven't had much time to work on the code, not to motivated with the market jumping all over the place. I'm spending most of my "market" time evaluating my RRSP holdings. I'm also testing a strategy on the simulated account for longer term forex trades, s swing trade time frame from a day to a few weeks.

I hope to have the code ready in a week or two. Is anyone willing to test and give me feedback?

To qualify you need to know how to program in Amibroker, I'm looking for some help to test and tweak the code. Any takers? Drop me a line at my email, in the top right under "What this Blog is all about"

Monday, November 10, 2008


A video of a set up I am playing tonight. It looks like the USD buying might be over, or paused for now. If the markets break out, the USD probably wont move any higher. In any event, this trade is basically a small scalp that demonstrates my Tipster Trendline code for amibroker.

By the way, go see Brant's videos at if you want another view of the market.

Wolfe Wave - look for them

A while back I received an email from a reader (Michael) who stated that he uses wolf waves as one of his tools, and with some success. I have done some reading on wolfe waves and understand them to some extent, and I've even noticed the pattern a few times while trading. They are, like most patterns, obvious after the fact to the extent that you know if they were profitable or not.

The way I interpret the pattern is that it is a counter reaction to an over reaction. In other words, when price moves to fast in one direction, it often moves back quickly in the opposite direction. The catch is the entry in the wolfe wave. It gives you a relatively low risk entry to reward ratio. I see the pattern quick often in the volatile forex market. Take a look back on your charts and see if you can spot some of these. Better yet, slowly scroll forward and draw the lines as the pattern emerges, see if you get faked out or if you profit. And the same goes for any pattern, understand why it works and what the emotions are that are behind it and you will see it better.

I asked the reader if he would like to have a post here on wolf waves so we could better understand the pattern. Michael recommends a book called "Streetsmart" as it explains the pattern very well.

Here is Michael email (edited slightly):

There are two types of wolfe: one for going up, one for going down. so long and short. The key of the analysis is to discover 5 points and the last point 6th is the target

For Long:
Point 1 and 3 are the downside points, the 3rd must be lower tha 1st
Point 2 and 4 are the upperside points, the 4th must be lower than 2nd and higher than 1st.
When the trend goes to form the 5th point, which is lower the all the previous 4 points, and then begins to move up, you trace a line from 1st to 4th point, which gives you a projection to another point, the 6th point, which is the target.

So if the movement is right, price should go up and you make a huge gain. The stop can be placed below the lowest low, and now you can see the profit potential.

For Short, it is just contrary of this. I have enclose several pictures so you can see what I mean, one picture is worth a thousand words.

Sunday, October 26, 2008

Tipster Trendlines - things to come

The "free" version is no longer available. Go to the Tipster Trendlines 2.1 post for additional information.

Here is a short video showing you what I'm working on next for the Tipster Trendlines code. The code is not yet 100%, when it is, I'll post it. If you have any comments on what is being planned for the next version, leave a comment.

The new version will feature drop down menu's and trigger buttons right on the chart.


Wednesday, October 22, 2008

What do you think is going on?

This post is not meant as investment advice, it's purpose is to spark some comments and discussion.

What's your opinion on what the market is doing? Why all the volatility? Why the melt down? Why is the US dollar going nuts? What's up with the huge drop in oil? Why are great high dividend yield blue chip stocks taking a hit? Here are my thoughts;

Liquidity seems to be the issue. Investors were, and still are worried that the firm they have their money invested in will go bankrupt, or worse, the firm they have there money in has invested in some other firm that goes bankrupt. Either way your funds would be locked up in a bankruptcy and that's not liquid. This has caused people (or those on wall street) to cash out, stocks, commodities, everything. You never saw this coming did you? Wall street did, that's why there was a huge drop to begin this mess. Read the user groups on the early questions on the put volume of some of those firms that bit the dust. People were trying to figure out if they were buying or selling puts. Looks like they were buying puts and made a huge, huge killing on the firms that went tits up.

Why is gold not going up since it is the safe haven? Cash. Everyone wants cash. The biggest cash nation, rather richest nation is the USA. That's where the credit crunch started. Funds are liquidating investments world wide causing all indexes to fall from the massive selling. Once they sell a stock in a foreign country they must then convert the currency back to USD. The USD is going full tilt in an uptrend. I think you can almost compare currencies to see where the biggest exchange of funds is happening to some extent. In Canada, the oil and commodity prices are also killing us, that impacts the Canadian dollar. Why are the commodities dropping such as metals and gold? Liquidation.

This is going to be a long healing process, not a quick snap back to the market. The volatility is probably due to huge amounts of money being moved around, not the norm for the market. To end this, the mass amounts of cash has to be moved to the US and invested elsewhere.

So what is next?
When the time comes, when all the cash is back at home in the USA, who knows what will move. The first sign will be the indexes stabilize, then slow decline in the USD, then accelerated decline of the USD against the Canadian dollar, oil will rise, and whatever the US giants invest in will rise. If a recession is coming, look for a rise in recession proof stocks. The USD will cease to rise since there will be no more buyers.

What am I going to do? I'm going to try to ride the USD higher. When it snaps the uptrend, short away. But be careful and manage risk. The market will start to settle down and into a trend when the normalcy again, weather its a bear or bull market.

That's my theory. What's yours?

Saturday, October 18, 2008

Globe and Mail and the way forward

This is a look at the past, the present, and the future.

A while back I was contacted by the Globe and Mail and asked to participate in the "Me and My Money" column. The column is below, click to enlarge. The paper version has a fairly large picture of me playing my guitar, very cool.

Larry MacDonald also mentioned me in his own blog, where he discussed day trading on the TSX. Anyone else out there day trade the TSX? Technically, I'm not day trading since I don't watch the screen during the day. I put my order in at night, it could trigger the buy and sell in the same day, thus called a "day trade". Below the article I describe what has changed since then.

Page 1

Page 2

Something has changed since the article was written. I have moved all of the RRSP accounts that hold mutual funds to a discount brokerage. IB does not offer RRSP, LIRA, or RESP accounts so I went elsewhere.

Why did I do this?:

First of all, I had my funds in RRSP's for the same reason most other people do, not enough time to manage it and for the long term I felt the pro's would do a better job. For the most part this might be true. The single issue I have with this is their ability to exit when they smell something rotten, such as a declining 50 day MA, even worse with a declining 200 day MA. Even if they knew a few US firms were about to implode, how could they liquidate a fund of that size? Who cares. I know I could liquidate my holdings in a blink of an eye and not cause any market movement.

The long term plan:
First of all, cash is a position. Decide for yourself when to get in and get out, before your emotions take control. Here is my plan. After reading a book about a guy who purchased solid dividend paying companies, and retiring, I decided to go on my own. I will only purchased companies with that meet certain criteria, the top two are "must pay dividends" and "from the chart". There is more to the dividend research than that, just like there is more to the "chart" than that. Basically, dividend paying companies in an uptrend, or at support.

How has it worked so far? Pretty good. In the past few weeks some of the fund transfer was complete so I went on a search to find some stocks on the TSX. (I wasn't about to buy on the US exchange as the CDN dollar has been beaten up lately). One of the stocks that I set up an order for was BMO. All four stocks had limit orders set up, set up at prior support. I figured it could take up to 4 weeks to get a fill if the market was going to be ranging. To my surprise, the very next day the market got killed. All four orders were filled. Scary you might say. It turned out pretty good. Patience to wait for the price was a key, after all, it's long term. Here's a chart, my fill price is the white horizontal line.

BMO.TO - Weekly

BMO.TO - Daily

Notice that there is a triple bottom, and each bottom on the weekly chart has less volume, that's good. As far as risk management for this trade there are two options.

First, if the price breaks that support - get out quick, usually a fourth test of a horizontal line is like a hot knife through butter.
Second, set the stop at my break even while considering any dividends received, perhaps setting the stop a little lower for breathing room. I'm looking at the close prices before I place a stop order.
Third - never sell. Strange thing to say but at the white line it is 7.5% yield. Better than a sharp stick in the eye.

So lets sit back and see which way the market heads. The path of least resistance is down. To be back in an uptrend we need higher lows and higher highs. Or we could range for a long, long time. If you want to see what a bottom looks like (it's hardly ever a V on a daily chart), check out today's video at Also take a look at this Bear Market Post to gain perspective. Yo be your own judge. If your confused, put your money under your mattress and wait for the bullets to stop flying. Cash is a position. If you know what your doing, follow your trade plan.

One more thing - I almost have a working version of an updated tipster trendlines with more bells and whistles. This one has trigger buttons and drop down menus right on the chart. Should be ready in a week or so. Is anybody using version 1.0 or 1.1 of the code to trade with?

Saturday, October 4, 2008

Chart Trading Question

A reader emailed a question about the tipster trendline chart trading code that I thought would be beneficial to others if I posted it. I'm not offering any advice or opinion on the set-ups profit potential, only how the code works and IB's order triggers.

"I attached a graphic, in which you can see, on 1st of Oct. I wanted to short IMS, on breakout of the bottom of the previous candle, but as you can see the candle of 1st of Oct, is a strong up candle. My stop order of sell should not trigger, and my buy stop (which is my stop loss) is set to 12.39$, so what happen in IB."

Line BS is the buy stop order. The price must go below this level for the order to trigger. This is the "Parent" order.

Line ST is the stop loss order. This is a child order, child of Parent order "BS". This order is will not trigger until the Parent order triggers (BS).

Line TA is the target order. This is a child order, child of Parent order "BS". This order will not trigger until the Parent order triggers (BS).

So in this example, if the BS order was a "DAY" order and not a "GTC" (Good 'Till Cancelled) order, at the close of Oct 2 the order BS has not triggered, therefore ST and TA will not trigger. At the close of the day the orders will automatically disappear from TWS and you would not have a position.

How does this work in TWS? To see how this works, left click on the coloumn titles of your order page inside TWS. You need to add a field called "OCA" (One Cancels All). The Parent order (BS) will be blank. The two child orders (TA and ST) will have the same numbers in the field.

When you set up a bracket order manually within TWS, this is basically what TWS is doing for you. You can also do it manually. Try it manually to learn something. You can also use this technique to capture a breakout of a range, such as a squeeze in price, if you want to catch a move to the upside or downside. I haven't played with this type of order very much but I'm sure it can be done so that when you get a break in one direction, the orders for the other direction are cancelled.

Friday, September 26, 2008

Risk Management

Risk is job 1. Patience is job 2. What the hell does that mean?

Patience is important for entries and exits, jumping into trades to early, not waiting long enough for the price to run, can be counter productive to the outcome of the completed trade. I think this goes without saying but it's harder to do in real time than most think. This post is not about patience, I mention it only as a comparison to risk being job 1. Risk can be managed, and should be to avoid your "hope" that price will follow.

There are poeple who make a killing from "pump and dump". The people who buy once its hyped, and do not sell even though the price keeps declining, are 'hoping' and are not controlling risk. You would think that the stock is purchased prior to the pump by the insiders. It is, but it is also shorted at the crest when no more buyers show up. Watch the volume, that shows you how many people are at your party. When the party gets lame, leave and look for a new one. Easier said than done for most. Use bracket order to control your risk, thats one method.

Rather than write about what I mean by risk, here are some posts on the topic.

The 2% Rule
Position Sizing - Bull Trapper
Position Sizing - Trader Mike
Position Sizing Spreadsheet

Another source is a book called "Trade your way to Financial Freedom", or "Technical Analysis using Multiple Time frames" . To search for books that may be available on the net in pdf, take a look at this post "Tools For Trading Post".

I developed a screen that shows me how much to risk based on the account balance.
I use some afl code in Amibroker I developed with the help of some code from the Amibroker Knowledge base web site. The starting code had nothing to do with risk. It is using Amibrokers new graphics commands and allows you to put buttons and graphics on the screen, the same area as the price plot. The code is a bit rough around the edges but I post it so you can at least have basic functionality. I plan on making it much more robust shortly. The final version will not be shared though, unless the is a contibuton made.

There is two parts to this code. First, a chart to draw lines. Second, a pane that has code to display risk, profit, etc. The first chart with the lines writes the static variables of entry, stop, and target as well as the ChartID and order of lines (long or short set up). The second retrieves the variables and some information from your Interactive Brokers account and computes a bunch of information automatically for you.

Here is a video that explains what it all is and the code. I also explain some of the basic of the bracket order; how it triggers, how it cancels, etc.

Part 1 - To use the code, you need to draw 3 (horizontal) lines on your charts to define entry, stop, and target. That code can be found on the post titled "
Tipster Trend lines Post"

Part 2 - The second chart, or pane, or code snippet is right here. "
Risk Management Code"

Wednesday, September 24, 2008

Michael'sScreen Shot

Here is a screen shot from Michael. His version of "nothing special" is a simple screen.

I have heard that the two most valuable assets for a trader is screen time and discipline. Screen time is your ability to see price action without indicators. Over time I have noticed that you get a better feel for charts and price action by simply watching it live. Try this to see what I mean; look at a chart of the S&P or QQQQ every half hour throughout the day, keep notes every half hour on what you see and where price might go next. Note support and resistance lines. What you get from this is a timeline. You understand how long it takes for things to happen. If you can't do this at work, than watch a different market such as Australia stocks, Forex, or Gold.

Michael writes:
This is my screen shot, as you can see it is nothing special, I use at most two indicator like PPO and ADX for detect HDIV and DIV and pattern like Wolfe Waves.

Michael is also preparing a guest post on Wolf Waves, we look forward to that post.

Short Interest

If you use Short Interest as part of your strategy, I draw your attention to a recent comment.

"If you're doing this sort of thing for a living, then you need more timely information. Here's a site that provides that for a nominal cost:

He also states that he does not how good the info is. I haven't done any digging but as far as I know the short interest for stocks is release twice per month by the NASDAQ exchange and I'm not sure about the NYSE. Therefore, I doubt the info is more timely than anywhere else, but it might be for other exchanges. If anyone knows, please share.

Tipster Trendlines

Thanks to Murthy for additional code for the Tipster Trendlines, trading from the chart.
He has added functionality that tells you if your lines are off the viewable chart area along with some other functionality.

A new version of Tipster Trendlines is available.

The "free" version is no longer available. Go to the Tipster Trendlines 2.1 post for additional information.

Pete's Screenshot

Pete sent me his screen shots. He shows us one EOD and one Intraday screen. He's trading index fuures on these charts. From his description, it looks like he's visited DayTraderRockStar. Pete, great set up, good job. This is an example of simple uncluttered screen. This is very close to a template I'm working on at the moment for futures. I'm currently working on my "Radar Screen" that has overall market Ticks, Puts/Call ratio, and Trin as well as some of the majors.

Instead of me re-writing what he has sent me here it is;

I would also recommend for some really great information on trade setups for trading futures intraday. The two charts I'm sharing are rather new for me. I just configured them a couple weeks ago when I started doing a little intraday trading.

The intraday setup chart is pretty simple. I use the real-time quote window on the bottom to select the security I want to view. The 15 and 5 min charts are linked so they show the same ticker. I use a 20 period EMA along with a 200 period MA. Those horizontal lines you see are pivot levels. I have since refined the code to calculate weekly and daily pivots on an intraday chart automatically. I just love the flexibility Amibroker offers.

The EOD setup is an example of my pivot point calculations (shorter lines at far right), and I have a few longer trend lines which are there to remind me of weekly and monthly support/resistance levels.
I have been working all summer long on developing a trading system. For now I don't have anything to show in that area as it is still a work in progress.

Thanks again for sharing and also for providing an environment for others to share.

Thursday, September 18, 2008

New Feature

A new feature has been added to the right sidebar. You may have seen this on other blogs, the "Recent Comments" list. It takes the most recent comments from all posts and sorts them by when the comment was made. I guess it could also double as a text messaging type chat. So next time you post a comment, no matter what post, it will be displayed under the recent comments header.

Monday, September 15, 2008

Screen Shots

A call to all users of charting software!

Often we read about trading systems and methods, risk management, triggers, market indicators, and the list goes on. As I read through blogs and trading books that talk about set-ups, triggers, stops I often ask myself "everything is being presented except the final piece of the puzzle", usually this is the entry and initial stop placement. Sure, once the trade gets going there is an entire different approach; when to take profits and how soon to move the stop. I wonder what the screen looks like that these guys are trading from? How do they arrange the windows to make it easy to monitor the things they need to monitor. I've seen pictures of huge desk's with multiple monitors. What's on these screens? Have you ever watched videos on Youtube by the "Suck My NASDAQ" guy? He's a day trader that makes pretty good calls but he never gives you details and never shows you his screen. Until we see what he is looking at, we cannot tell his source of info, or what he's using to form his "opinion". Not that we need too.

I thought I would use this blog to post some screen shots of various users. I don't know what exactly it will generate in terms of ideas or education, but it will be interesting. My screen has developed over the years moving averages and a bunch of indicators to only a few screens. I only use indicators I understand. My current screen for day trading has a 5 minute, 1 minute, risk screen, and pivot points. For end of day trading I use two screens which I have shown on previous videos, one that has moving averages and order entry (where I draw horizontal lines for entry, stop, and targets), and the other is the risk screen.

How to do a screen shot (screen capture)

Method 1: This is the method I use. Maximize your application that you want to capture. Press the "Prt Scr" key (above the "Home" key). Open up your email application and "paste" the image. If you want to trim it first, open up your Microsoft Paint or something similar (I use a really old version of Paint Shop Pro) and edit the image.

Method 2: Use other software the capture, Paint Shop Pro also does this (I use a really old version, simple but effective). You could also use something like screen Hunter 4.0 (Freeware).

The problem with looking at other peoples code and screen captures is that you tend to want to try it all to find the silver bullet. I've tried so many formulas and set-ups that I eventually figures out what I wanted. You don't know what you want or can have until you know the boundary's of what is available, then you find yourself satisfied. I'm down to using different types of moving averages, stochastics, ATR, and TTM on bar charts (I found that I don't like candlestick charts). I also found I prefer blue and red bars. This took hours of looking at charts to find my ultimate preference. So a word of caution when you look at screen shots, before you ask "how did you do that, can you share the code?", consider if it would really be useful to your trading game. On the other hand, perhaps you need to immerse yourself in all that's available in order to find what works for "you".
I would like to post screen shots of other users, doesn't matter what software you use. Please email me your screen shots to tsxtrends @ gmail dot com (fix the email address, it is modified to prevent spam engines). It would also be helpful to have a small description to help people understand “why” and "what" they are looking at.
Here is a screen shot of my EOD screens (using my IB simulated account). I'll post my other screens later next week.

Above: Main screen with MA's. Watch the videos for additional info on this screen.

Screen Shots by David W
He writes:
"I have lots of screens and indicators that I have tested and tried over the last few years – and now tend to use 2-5 indicators, CCI, and a price chart. In other words I have my favorites. This is a great idea because I got to this point looking at other peoples screens and setups. Would only take a few minutes for the screen shot. Also this is exactly how I am documenting my system – screen shots and descriptions in Word. Further, If I like someone’s idea – I add it to my future plan section in my Trading Plan. "

Thursday, August 28, 2008

Tipster Trendlines

This page is out of date, click "Tipster Trendlines" at the top of the page.

The "free" version is no longer available. Go to the Tipster Trendlines 2.1 post for additional information.Trading from the chart - what a concept!

AFL code to trade from your Amibroker Chart

I've had many emails asking me for the code that I use to trade stocks from the Amibroker chart as seen in this chart trading example video post. I've decided to release the code since that is the spirit of the Internet I enjoy most. I was using separate files but to make this easier I've rolled them up, now there are only two files. Before you grab the files, please watch the quick video.

Make sure you test this yourself, all types of trades, Long, Short, at MKT, at LMT, at STP. And always make sure you double check the order entry in TWS before your transmit the order. I take NO responsibility if your a hammerhead and don't check your orders before you send transmit to the exchange.

  • - put this file in your default include directory. This is usually /Amibroker/Include/
  • - put this in your "custom" folder, or where ever you like, it will work from anywhere.
Click on the file names above, when the window open press "CNTL-A" to select all, then "CNTRL-C" to copy. Paste the code into a text editor like "Notepad" and save with an "afl" extension.
(BTW, donation button is on the right)
What it will do and won't do
  • Use this code to place bracket orders with trend lines drawn right on the Amibroker chart.
  • It does NOT allow you to use Amibroker to sell or cover, only place bracket orders.
  • Lines should be called BS - Buy or Short, TA - Target, ST - Stop (case insensitive)
  • Once you place the order and transmit, you need to manually adjust the target and stop inside TWS, the code does NOT do this for you once your order is placed.
  • You must have Amibroker 5.0 or above for the coloured bar to appear at the top of the chart.
  • Put the file "" in your include directory.
  • Put the file "" in your custom directory
  • Right click on the TipsterTrendlines" in the "Charts" sidebar and click "Insert" or "Insert Linked"
  • You can run "Debugview" to see what the program is transmitting to TWS. Debugview is in your windows directory.
  • You need to install IBController for Amibroker to communicate with TWS, it's available on the Amibroker website.
  • Make sure you set up TWS API interface under "global" config, and set trusted IP to
Potential Issues
  • This code uses GetChartID and therefore might give you odd results if you open another chart with the same code and place trend lines with the same labels (BS, ST, TA). It might place an order for the wrong symbol, I have not tested this. To get around this either consider using the actual chart ID (available in the parameters window)
  • There is no code to keep from placing multiple orders. If you hit "Buy" twice, you will place two orders, so be careful.
  • The code also does not check for waiting or pending orders.
  • This code works for stocks only, or other instruments with 2 decimal places. Forex uses 4 decimal places, so if you try Forex, you order is rounded, therefore do not use with Forex.
  • In the future I may add additional functionality such as that listed above. If you have improvements on the code please let me know about the improvements.
  • Check for pending or waiting order to prevent multiple orders from being transmitted
  • Make display bar used as buttons (transmit, auto-trade on off, Long, Short, Close, Reverse, Cancel Order
  • Drop down menus can also be added And lastly, if you like the code, please post a comment to this post.

Monday, August 25, 2008

Stock data from Yahoo

Here is a sample of data that is retrieved from Yahoo! for MDCO, on the Nasdaq. This is the data source that I use for the short interest scan.

Trading from the chart with Amibroker

I've had a few inquiries about the code for chart trading with Amibroker. I will be posting the code soon. Should be up in the next week or so.

Sunday, August 24, 2008

Weekly Nasdaq Scan

Keep an eye on these stocks as the week progresses. This scan includes the short interest ratio and the increase in shorts from the last reporting period. Short positions are reported bi-monthly, see the link on the right for more information, it takes you to the NASDAQ Short Interest page. As a stock reaches new highs the shorts will start to feel the pain and some are forced to cover for a variety of reason, including margin calls. This gives the upward move more fuel, try to ride the tide. Here is the spreadsheet for the Nasdaq SI Scan Aug 24 2008.
Compared to last week, there are allot fewer shorts that show up on this list, and the number of stocks that have increased in shorts are far less. Does that signal a turn around?

Wednesday, August 20, 2008

SDS Update

Here is an update to the SDS trade posted yesterday.

Monday, August 18, 2008

Another example of trading with trendlines

I thought I would take the "potential" set-up Brian Shannon spoke of in his video today to show the "Trading with Trendlines" code I have written for Amibroker, interfaced with Interactive Brokers TWS platform. Both the set-up video by Alphatrends and my own video are below.


Trading with Trendlines


I've added a new poll on the right side of the blog, "Do you trade from work?" This assumes you have a regular day job. Please take the poll, I'll be doing a short video soon on trading from work.

Do you have a questions that would be appropriate for a poll, that would give you a better sense of what other trader are doing? Perhaps "do you use a moving average crossover as part of your trading system?" If you have any suggestions, I'd like to hear them.

Saturday, August 16, 2008

NASDAQ scan for upcoming week

This scan includes short interest as well. Watch the video for details. All the stocks are longs and all are on NASDAQ. You can also get the excel file for the NASDAQ Scan Aug16 2008.

Monday, August 11, 2008

A nice toy, just say it!

If you use the command "Say" in AFL, or some other kind of audio alerts, check this site out;
This site lets you type in the text, listen to it, and download it. Easy and painless. You can select different voices as well. It sounds tons better than other text to speech engines I've heard, and it sure beats the basic voice Microsoft gives you (Amibroker uses the Microsoft engine when you call the "say" function, look it up in AFL help)

I use the "Lauren" voice to tell me all about the orders I submit, or if there are data errors, etc. Why stop there? You can use these sounds as part of your windows sounds scheme too.

So when you boot up your computer after dinner to plan the day for tomorrow, this is what you could hear.

Sunday, August 10, 2008

Software Applications for Trading

Here's what you need to interface between Amibroker and TWS to trade with trend lines and auto trade. I also do a scan of the TSX and update an earlier trade.

Scan of NASDAQ and short interest

Tonight I ran a scan of the NASDAQ looking for stocks that are in one of two categories, the same criteria used in the last video I posted. There is one addition, I have added the short interest to the output (not used in the filter, just displayed on the output)

1. 10 day MA > 20 day MA > 50 day MA and 50 day MA rising
2. 10 day MA < 20 day MA < 50 day MA and 50 day MA falling

Other filters are in there as well, simple things like today cannot be the highest high in the past 5 days, the 20 day avg volume has to be more than 200K, today cannot be the lowest low over the past 5 days. This is trying to catch a basic pull back, or a stock correcting over time in a range. Here is the link to the spreadsheet with the scan. In the video I explain the san results.

Saturday, August 9, 2008


DAX, QQQQ, SPY, IWM, TSX Stocks, Forex, whatever you trade, price patterns and understanding why price moves is probably better than memorizing patterns. Take a look at a MACD divergence and a price chart that uses the same MA's as the MACD. Find a divergence. Look at the patterns of higher highs and lowers lows. Notice that you can see these if you look. I find the most use for indicators is to filter my scan results.

Here is an interesting concept that I have looked at, it comes from some forum somewhere. I believe it has merit.

Crossover systems will generally do well when traded intraday, not so good when traded of daily prices. By substituting different filters based on the most recent action of the chosen market, you can use their basic rules (idea) forever. You can program this to be self adjusting (auto optimize).

As part of my exploration scan for trending stocks, I use the double stochastic, it filters out stocks that aren't pulling back quite to where I would like to see. This is a good use for an indicator, not as sole selection criteria. Support and resistance, and a dose of anticipation.

Friday, August 8, 2008

Using Multiple Trading Systems

Some info I found while surfing. I don't use neaural nets but I can relate to using multiple systems to increase trading frequency. The system should be non-correlated. It's a good read.

First find out what is going on in the market you want to trade in the timeframe you plan on holding a position. If you want to day trade with one trade per-day then find out all the different ways the day has played out in the past. Ex. trend day, two-way day, reversal day, etc.

Once you've done this you should have an idea of which type of day is most common and which is most profitable. Then define something which could be of value to trade one of the market types. An example might be in a reversal day to find out how often the market makes a low of the day in the first 15 min. of the session. If it happens often enough to be of interest then you go on to the next step.

Take every period for which the target is found and create a table of outputs with 1 for the target and 0 for non-targets. Then pre-process all the inputs into the target and convert them to binary inputs. (A common mistake is to take open, high, low, and close data -- analog and assume you can find relationships with the target). For ex. yesterday close > day before yesterday close. If found mark the input as a 1 if not present mark it as a 0. Do this for as many identifies as you can. This may present a hundred or more binary inputs leading to the target for each day of the data.

Then you'd pass the data into a backprop neural net and have it train on the data. (You’ll need to set aside some data for out of sample testing). Once it's trained to hit at least 90% correctly test the NN on the out-of-sample data. If you hit at least 85% correctly then you can do one of two things. If you're a discretionary trader, setup the NN and pre-process the inputs every day and use the net to predict whether tomorrow has the target (in this example the low of the day is within 15 min. of the start of the session). If so use it to trade to the upside as long the net remains 85% correct. If you're a systems trader then go back to the net and look at the weights of the net to see which of the binary inputs were most important in hitting the target. Use the inputs to create a back testable system based on the patterns. A system might be when xyz pattern exists then buy next bar above the lowest bar as long as the time is within the first 15 min. of the day. Set the stop to one tick below the low.
If the system tests profitable enough to be of interest then move on to the next step.

Next, take the trades and test them against random trades pulled from the same year (the edge test). Rank the trades versus random for each year of the back test. If the trades score consistently above the 70th percentile then you can guess you've found an edge-based system. If not, then you have to assume you've found a temporal characteristic in the data that can be exploited for some period of time.

If its edge based then all you need to do is adjust the trades for market volatility and apply a money management strategy. Check the trades on a periodic basis to ensure the edge continues and plan what to do with your next million. If it's not edge based you can still trade it but you need to setup an objective bailout method such as running a monte carlo sim and determining the bailout point to be say the 95% level of the predicted max drawdown point. Your trading would be more defensive using a non-edge based method as well. Maybe you'd split the trade size in half and have a 15 min. or 10% of daily range as a filter to adding the second position (letting the position prove itself) as long as the volatility was large enough to justify the scaled entry.

Every model I've worked on has gone through the same process. Look at the behaviour’s present in a market; characterize them by creating a rule and checking the fit until all behaviour’s are noted. Then start looking to see if there is a component to the behaviour that is non-random. If so, develop a system to mine it and create a way to monitor the behaviour to ensure it's persistent over time. For example, one of the behaviour’s widely known is the trend day in the SP market. It can be identified just by visually inspecting a chart. I characterized it as a low/high within 10% of the low/high of the day and the close within 20% of the high/low of the day. With the definition I can see how many of these days have persisted over the years (averages about 25 day’s per-year). Then I can see if there is a way to identify these days in advance (realizing I'm going to also be capturing some false days as well).

The algorithm used to adjust the number of contracts traded to volatility is calculated by the range (high - low), then average it for the past ten days. I use ten because I want my model to cut back on size pretty quickly if the volatility jumps. Then I divide the highest historical 10 day volatility (approx. 48 pts.) by the current volatility (ex. 8 pts) to come up with a multiplier (ex. 6). The model would then apply 6 contracts for the next trade. This is not the final size used to trade. It's just used to adjust the model for volatility levels so I measure one period against another without volatility being a consideration.
By doing so, I can see if the same level of opportunities persist from period to period. I can also use these normalized trades to feed into money management models as well as Monte Carlo tests to estimate future performance and drawdowns. If you were to use trades from say 2000 and 2004 for the SP market in a Monte Carlo test without normalizing volatility you'd get a much distorted estimate of future performance.

Comment from reader:
Just to make sure I understand the big picture, this is all being done to increase frequency in the desired profitable time period, correct? So if I understand, sub-par models tested individually with low frequency can be morphed into an above-par model when combined with other non-correlated sub-par models (assuming they're not too sub-par), thus increasing frequency, consistency, and lowering the need for a higher profit factor? Thank you for presenting the information the way you did, I would not have made that connection otherwise (assuming I’m on the right track). Fascinating.

Trading System Development

Trading system development – The DUM method

D - Define

All systems are based on finding and pulling a fundamental truth about the market. Define what fundamental truth you'll be going after. Eg. All markets have a tendency to trend beyond random. Now you've got the definition that most technical-based hedge funds are derived from.

U - Understand

Determine the conditions under which the defined truth tends to occur. In the case of a trend tendency it could be when does the trend tendency begin beyond random? This will lead you to how to measure a trend. Since trends can occur randomly, how do I determine if a trend is beyond a confidence level of randomness? Does the trending tendency beyond random exhibit the same degree of persistence beyond one year? two years? 5 years? If not, is there some point at which the persistence beyond random occurs every year? If so, does it also persist at the same frequency for 5, 10, 50 different markets? If so, you've discovered a fundamental truth and you now understand what you need to know about the behaviour.

M - Mine

Once you understand the conditions under which the behaviour occurs, you write the code necessary to map the understanding of the behaviour. Is the code going to be all inclusive of many markets? or try to just go after the best of the best? Once mapped it's a mechanical process to determine how well it maps against the behaviour. After you're satisfied you've developed a satisfactory method for mining the behaviour, you can do an edge test to see if it happens beyond random. If not, use Monte Carlo sims to determine confidence levels for trading the method. Determine at what confidence level you'll stop trading. Examine the drawdown versus the profit. Is it worth risking any money on this? If so, allocate money using a money management scheme.

After you're done with this, you'll have your first system. Next, develop a complimentary system (non-correlated). Go through the same process for (a different type) a range bound system. Once you've gone through the mining stage, use the correlation test to weight the two systems. Apply the weights to the money management scheme and move on to your third system.

Trading with Amibroker

In this video I'll show you how I enter trades using Amibroker and the interface to Interactive Brokers TWS platform. I also briefly discuss how I find the stocks that I trade, using an Amibroker exploration. I wrote the interface code for two main reasons, to eliminate input errors using a graphical interface, and to speed up my order entry. IB's chart trader has it's use, but its not suited for what I want to do, not to mention its clunky and not customizable to my liking. Enjoy the video!
Update can be found here:

Wednesday, August 6, 2008

Short Interest and the Short Squeeze

The NASDAQ web site allows you to take a look at the short positions over the past year or so by semi monthly data. This data is posted twice a month and is also available on Yahoo. I download this into Amibroker, sort it, scan it, and out comes the short data. The filtering I do involves the positions of the moving averages. The 10 above the 20 above the 50. I'll look at each of these and buy on strength anticipating a break out with a tight stop in case the breakout fails.
Here is the data for the last part of July, the new number will be available in a few days. When the new numbers come out I'll post the scan again. I can also run the scan every weekend to see what stocks look like the might advance. If you don't know what a short squeeze is, Google it.

The thing to remember here is that the high short interest is not the only reason to get involved in the stock but it sure helps fuel it to new heights. This scan picks stocks that have momentum and are poised to advance. You can get the excel version by clicking the image.

Sunday, August 3, 2008


Check back frequently, I'll be posting scans for the TSX and the US markets. The TSX scans are based on momentum buys. The US market scans are for short interest. You can use the short interest scan to look at some charts and select those that look poised to move on a short squeeze.

Wednesday, July 23, 2008

Basic Rules

All the list of rules floating around, what do you belive, what do you use? What works? After spending a few years digesting lots of information I can now quickly read an article or blog post and know if it fits me, my style. There are a few very very basic rules that I remember each day. You should do the same. Make a top ten list. Revisted the list every now and then. Put the list on the wall. Modify it as you learn and progress. Here are two rules I have boiled down to one, once I learn to understand the first rule and was burned a few times, the second just made more sense.

Don't chase price. Do not chase price. All the books tell you that, but then they go on to tell you about indicators or other stuff. Want to prove it to yourself, run a system where you buy after a run, say 3 up bars and see what happens. You get hammered that's what happens. Why do we do it? It's not based on logic. This is one of the reasons I want to implement a mechanical automatic trading system to keep me from doing it. Yes, I have done it it and I look back and wonder what the hell I was doing.

Patience. Have patience. If we follow this rule, we don't have to worry about chasing price. This is rule #1.

I think the single most meaningful sentence I have read in any book or blog is "Most of your time trading is spent waiting". I hate waiting. Who likes to wait in line for a ride at the amusement park? Who like to wait in traffic. We are trained to not like to wait.

Learn to WAIT for the opportunity to appear. Sometimes the wait is short, sometimes long. LEARN TO WAIT. BE PATIENT. If you miss your entry, learn to trust that you will get another chance. If you miss your exit, just take what you can and be happy.

"What you do determines whether you lose. What the market does determines whether you profit." (Sun Tzu)

Wednesday, July 16, 2008

Price Patterns

We have all tried to use indicators to build a system, I have tried to use them to build an auto trading system and have found that it’s not worth the effort of looking for a great combination of indicators only. You need to use price action first and foremost. Support and resistance with a few other gems like a simple momentum and moving average are, to me, what works.

I have also found that indicators and patterns are just another way of looking at the same price action. Now that I've been staring at indicators for a long time and understand price action, and memorized patterns such as head and shoulders, bull flag, etc, understating basic price action has allowed me to forget about all that stuff. It's all just another way of saying higher high, higher low. If you read the book you might also have this "moment". After watching Alphatrends videos and reading Brian Shannons new book, the approach that makes the most sense to me is support and resistance, higher high, lower low, etc. For auto trading, the trick is to be able to program the rules as you apply them when looking at a chart, into software. Not so easy.

I trade Forex based on an auto trading system I developed, currently, no real money as there are still bugs. I also trade the TSX stocks (real money) based on the approach demonstrated in Brian Shannon's book. Each night I’ll perform a scan of the TSX and set up the trades for the next day. My approach has been altered somewhat since reading his book. The original was based on reading his blog and watching his videos. I have created code to scan for these stocks that are in stage 2 or 4. So far so good. Obviously it would be more profitable to check on the trades intra day and adjust the stops to protect profit. That doesn't seem to be the most damaging though. The entries are planned to be on a stage 1 to 2 short time frame but a morning gap usually kills me as it retraces. This doesn't happen all the time. TWS (IB platform) does allow conditional orders but not to the extent I need them. I need to look for a pullback to a level, then a break above another level (buy stop) to pull the trigger. To do this I will need to program Amibroker to follow the stock and place the order. That's my next project after I get this auto trading forex code working well enough to make some $. As for the TSX, its working out, but it would be more profitable if I had the code mentioned above implemented.


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.