Monday, October 11, 2010

QuoteTracker to ZeroLine Trader Automated Trade System

I have written a perl script which enables you to make automated trades based off of signals generated in Quotetracker.(Thanks to Boogster for the original script)
This automated Trade System works the same way my Bracket Trader Automated System for QuoteTracker works, so I have made 1 video detailing how to setup Zeroline Trader to enable automated trades. I Like Zeroline Trader over Bracket Trader for the Automated Trade system because Zeroline Trader has more options to configure strategies and you can setup the automated trade system to trade multiple symbols very easily.

Here are some Tips-
Make Sure your Page is named "Futures" in ZeroLine Trader and your email template is setup to trade the Contract based on the Data Row ID in ZeroLine Trader

How to setup the Order Email template in QuoteTracker-

For reference on how to setup the ATS, you may want to watch my other videos.
Boogster made a very detailed post on how to make an ATS and I decided to make a tutorial video following his guide. If you have a broker that accepts API connections like Interactive Brokers, then you can make this Automated Trading System for Free. Here are the downloads you'll need-

  • Medved Quotetracker
  • - Free Charting Software
  • ZeroLine Trader
  • - Trade Management Software
  • Mailenable
  • - Free Mail Server
  • ActiveState Perl
  • - Free Scripting Software
  • HPT's ZeroLine Trader Perl Script
  • - An email client that checks your email and enters a trade into ZeroLine Trader when a new alert is found in QuoteTracker
  • Interactive Broker’s TWS Demo
  • - A Free Demo account with Interactive Brokers
  • Visual C++ 2005 from Microsoft
  • -This is software required by the InteractiveBrokers API to register properly

    The Videos below were made as a tutorial for setting up QuoteTracker to Bracket Trader as a complete Tutorial. If you had trouble getting the ATS to work for ZeroLine Trader, these other Tutorial videos I made for Bracket Trader ATS may help you, as the only difference between the ATS between the two applications is the Order configuration and Perl Script. The old Perl Script used for BracketTrader will not work for ZeroLine Trader, you must download the new one above.

    HPT's ATS Tutorial Part 1 - Downloading Software Setup

    Part 2 - Installing and Configuring software

    Part 3 - Setting up Quotetracker & ATS Email Tempelate

    Part 4 - Bracket Trader Setup & Live Trade

    Part 5 - ATS Exit Signals & IB Demo Account

    Example of ATS Exit signal working

    I would like to give a special thanks to Boogster for his work on the ATS perl script, Jerry for his awesome charting software QuoteTracker, and Hong for his excellent Trade Management software ZeroLine Trader.


    Unknown said...

    Hi, great blog!!

    I was playing around the tutorials and find that ZLT hasn´t the "Monitor for extra orders" like Bracket Trader has. I'm correct? Is there any similar way to get it in ZLT?


    HPT said...

    No, ZLT does not have this function. Bracket Trader is not 100% on this function either, so you always need to monitor on your own for extra orders. YOu may want to setup IB to text or email you when an order is filled if you are away from the computer.

    Gianluca said...

    Hi HPT,

    First up I must say, thanks for the instructional video’s on ATS setup. You’ve made my journey far more reachable than if I had to go it alone (given my lack of computer savvy). Congratulations on the job with the hedge fund too. They're not easy to get.

    I’ve set up the QT/BT/IB configuration and have it working smoothly. Am currently trying to configure ZLT instead of BT as, I agree with you on the flexibility it provides.

    I have run into an early snag I hope you can assist with. The one thing I changed in the ZLT script was to introduce the code for EUR.USD as follows:

    } elsif ($order[1]=~/^.*IDEALPRO:#EUR.USD.*$/) {
    $symbol= "EUR";
    $shares = $DefaultCurrencySize;

    and to set $DefaultCurrencySize to $20,000.

    When I run the orders, the alerts are sent through, but the order size sent through by the script is only 1 (not the 20,000 I set in the pearl script); I.e. the script sends through “BUY,1,MARKET,Futures,1;” (I set everything up on the Futures tab). Attempts to debug the script did not work (e.g. hardcoding $shares to = 20000). So I was wondering if you could give me a hint as to what could be wrong?

    Also, as a side question, is there a simple way to ensure that ZLT only allows one buy order to be executed per time i.e. ensures that if an alert is sent though but QT, ZLT doesn’t send the order if a position is already open (as per brackettrader)?

    PS. Can relate to your posts on the blow ups. I’ve had a few and have been afraid to trade large since. Hoping use of an ATS will help me eliminate the fear over time.

    Gianluca said...

    Further to my last comment HPT, i was able to determine that the order size of 1 is orginating from this part of the script:

    sub sendtofile {
    my(@order) = split(";",$_[0]);

    #print "DEBUG: 1) $order[0]; 2) $order[1]; 3) $order[2] 4) $order[3] 5) $order[4]\n";


    When I replaced my($shares)=1; with my($shares)=""; the script now sends through “BUY,"",MARKET,Futures,1;”. The only problem is I do not know why or how I can get it to read the correct position size.

    HPT said...

    At the top of the perl script there is = my $DefaultCurrencySize=1;
    I would hard code EUR share size in by declaring it as variable at the top.
    Underneath my $DefaultCurrencySize=1;
    add another line-
    my $DefaultEurSize=20,000;

    Next edit the elseif statement for Eur from -
    } elsif ($order[1]=~/^.*IDEALPRO:#EUR.USD.*$/) {
    $symbol= "EUR";
    $shares = $DefaultCurrencySize;

    To this-
    } elsif ($order[1]=~/^.*IDEALPRO:#EUR.USD.*$/) {
    $symbol= "EUR";
    $shares = $DefaultEurSize;

    Hopefully that does the trick. Otherwise it may need to be coded differently.

    HPT said...

    Also, in response to the question regarding ZL sending multiple orders without having a check function for open position is something the developer has to add/fix with ZLT. I asked him if he could add it a couple years ago. I don't what has happened since. So, I guess the solution is to use BT. From what I've seen, using MultiCharts may be the cheapest solution as opposed to ninjatrader for automation with interactive brokers. Multicharts will synch to your IB account.

    Gianluca said...

    Thanks very much for the quick reply. Unfortunately, that fix did not work. I’ve now drawn as blank as to what else I could try to fix it, but at least I can get going with bracket trader. Thanks for suggesting MultiCharts. QT support have indicated that they will be discontinuing support (in a couple of months), and for citizenship reasons I’m excluded from being able to sign up to TD Ameritrade (I have the same problem with Fidelity and Wealthlab – the software I originally developed my systems on). So I need another trading software package. I’m really disappointed as QT was ideal for my start up circumstances and I have spent months getting ready for all this. Even though I’ve long since determined that IB was the best broker, I’m now considering Tradestation (despite the expense) as it provides an integrated solution. If you have any further suggestions / pointers I would be extremely appreciative.

    PS. Love the blog. A real person’s experience beats a book off the shelf.

    HPT said...

    I've used Tradestation a few times over the years. Choosing your broker really depends on your trading style. If you are automated and make only a few trades a day, then tradestation may be a good choice. If you make more than 50 trades a day trading futures, then cost from commissions will be a concern and you may want to look elsewhere. Ultimately, it all comes down to cost, and in my experience, the largest cost is commissions and the cost of slippage. Also being able to program the strategy you want. With Tradestation I decided to leave because I was focusing on a strategy that was based off of indicators that looked at every tick of multiple data series, and at the time TS didn't have the ability to perform this. That doesn't mean it won't work for others. I think TS and most of these retail platforms used for automation may be good for traders that have strategies that aren't reliant on speed execution, ie trades that are longer than 15min holding time as opposed to 1-2 min scalps trades where entry needs to be executed with 1 second.

    Gianluca said...

    Thanks for that feedback HPT. I'll search for alternatives to tradestation. Whilst my trades will not be a short term as yours, at least when I get started, I plan to make a lot. Always preferred IB. Will enlist more experienced code savvy friends to develop a Matlab solution if need be. I did like the idea of ZLT managing multiple trades whilst only needing one instances running per time, I might have another look at the pearl script in a week or so when I have a fresher head. Thanks again.

    Unknown said...

    Adding some of your suggested points about Trade Management software to our Trading solutions. Thanks for the blog!

    Subscribe via email

    Enter your email address:

    Delivered by FeedBurner