Need a program for a breakout trading method

Discussion in 'Automated Trading' started by Sam Mcgee, Oct 29, 2008.

  1. I doubt this idea would backtest succesfully in any platform. You'll be left to optimize or think about that 1 point. It's very easily curve fitted in TS for sure, which is exactly what TS does quite well. Your success thus far with it is more likely luck, unless you've been doing it more than 6 months now.
     
    #11     Oct 29, 2008
  2. I would agree with bolinsky on the point about backtesting... I do think though that to have a shot to make this strategy work in a 100% automated sense, a lot of it would be about stock selection and the situations you chose to apply it.

    I have the sense now when you're trading it, you don't trade every market, correct? if you're very selective about applying it and can formalize this method, this would be the key to making automation successful here.
     
    #12     Oct 29, 2008
  3. rickty

    rickty

    tradelink,

    I've just downloaded your software; looks interesting.
    May I suggest you implement an interface with the
    Open E Cry brokerage. They have an extensive C# API
    which is well documented, so I would imagine it would
    be a relatively easy thing to do.

    Feel free to send me a PM if you have any questions
    or if you would like some help with this.

    Richard

     
    #13     Oct 29, 2008
  4. Tums

    Tums

    Sam:

    Here's the code in EasyLanguage.
    This is not the buy/sell program... this code only draws the arrow on the chart, so that you can evaluate your concept.

    Don't be overwhelmed by the number of lines of codes... the logic is simple
    most of the code is about drawing the arrows LOL.

    Code:
    input:
    threshold(1),
    arwc_offset(1),
    arwc_size(7),
    arwc_textsize(10);
    
    var:
    Low_Breakout(false),
    High_Breakout(false),
    id_arwc(-1);
    
    
    Low_Breakout = (high[1] + threshold) < high[2] and (high[3] + threshold) < high[2];
    High_Breakout = (low[1] - threshold) > low[2] and (low[3] - threshold) > low[2];
    
    if Low_Breakout and high > high[2] then 
    begin
    	plot1( high[2], "BO", red);
    	id_arwc = arw_new( date, time, low - arwc_offset, false);
    	arw_setcolor(id_arwc, blue);
    	arw_setsize(id_arwc, arwc_size);
    	arw_setstyle(id_arwc, 10);
    	arw_settext(id_arwc, "Buy");
    	arw_settextsize(id_arwc,arwc_textsize);
    	arw_settextcolor(id_arwc,Blue);
    	Arw_SetTextAttribute(id_arwc, 1, true);
    end
    else
    
    if high_Breakout and Low < low[2] then 
    begin
    	plot1( low[2], "BO", red);
    	id_arwc = arw_new( date, time, high + arwc_offset, true);
    	arw_setcolor(id_arwc, red);
    	arw_setsize(id_arwc, arwc_size);
    	arw_setstyle(id_arwc, 10);
    	arw_settext(id_arwc, "Sell");
    	arw_settextsize(id_arwc,arwc_textsize);
    	arw_settextcolor(id_arwc,red);
    	Arw_SetTextAttribute(id_arwc, 1, true);
    end;
    
    
    This is how the chart looks like.

    <img src=http://elitetrader.com/vb/attachment.php?s=&postid=2151918 border=2>
     
    #14     Oct 30, 2008
  5. Run this scenario on current historical data:

    long ll_num_of_bars, ll_count, i, j
    boolean lb_entrypoint_found
    decimal ldc_high_found, ldc_high1[], ldc_high2[], ldc_entry_high
    datetime ldt_timeperiod_found, ldt_timeperiod1[], ldt_timeperiod2[], ldt_entrypoint_period

    ll_num_of_bars = ?
    ll_count = 0
    lb_entrypoint_found = False

    For i = 1 to ll_num_of_bars
    ll_count = ll_count + 1
    ldc_high1[ll_count] = high(i)
    ldt_timeperiod1[ll_count] = timeperiod(i)
    Next

    Sort ldc_high1[] array in Ascending order

    For j = 1 to ll_num_of_bars
    If ldc_high1[1] > ldc_high[j] + 1.00 Then
    ldc_high_found = ldc_high1[j]
    ldt_timeperiod_found = ldt_timeperiod1[j]
    End If
    Next




    Run this similar scernario on historical data at least 2 bars later:
    ll_count = 0
    ll_num_of_bars = ll_num_of_bars + 2

    For i = 1 to ll_num_of_bars
    ll_count = ll_count + 1
    ldc_high2[ll_count] = high(i)
    ldt_timeperiod2[ll_count] = timeperiod(i)
    Next

    Sort ldc_high2[] array in Ascending order

    For j = 1 to ll_num_of_bars

    If ldc_high_found < ldc_high2[j] Then
    If ldt_timeperiod_found < ldt_timeperiod2[j] + 2 timebars Then
    ldc_entry_high = ldc_high2[j]
    ldt_entrypoint_period = ldt_timeperiod2[j]
    lb_entrypoint_found = True
    Exit
    End If
    End If

    Next

    If lb_entrypoint_found is False Then rerun the 2 code snippets (above) at a later time period.

    But, if lb_entrypoint_found is True Then the most recent high
    is in ldc_entry_high and the timestamp associated with that high
    is in ldt_entrypoint_period.


    * Note all of the above is just pseudo-logic, not any particular programming language.
     
    #15     Oct 30, 2008
  6. In the last month it would have worked great. I used it whenever I was home this month and took an IB simulated account from $10,000 to $100,000. You can't cheat with the simulated account. You can only take large risks trading a large number of contracts, something I'd not normally do with real money.

    I agree, there are large periods where it works well and other times where it won't. In 2006 where the market didn't move a lot, the method wouldn't have worked well. It needs to be combined with filters or other methods to make it more consistant. That's why I thought I'd post it to get some discussion going. I could share it with others and at the same time I might get some ideas to improve it.
     
    #16     Oct 30, 2008
  7. A breakout trading system is a subset of trend catching systems.

    Breakout trading systems work great when there are strong trends and otherwise lose money.
     
    #17     Oct 30, 2008
  8. That looks great Tums. I'll have to try the program in my Multicharts. It looks like there are multiple entries each day. I guess I didn't make it clear or specify that there should only be one entry per day, either the first long or short presented. Then it exits at the end of the day.

    With thirty minute bars, starting at 9:30, a setup can't occur until after 11:00 am. That works perfect for my shift schedule, if I have to work nights, I can sleep till 11 before I need to look for a setup. Once I'm in a trade, I can set up an automatic timed exit at the market for 4:10 pm and go back to bed for another nap.
     
    #18     Oct 30, 2008
  9. Tums

    Tums

    The purpose of this code is to sift out all the occurrences of such a pattern in a chart... so that you can visually assess the probability of such a trading concept.

    You can then build more logic to it to filter out the noise...
    e.g. take only long trades when the moving average is going up?
     
    #19     Oct 30, 2008
  10. I did try as best I could with manual testing to exit at a reversal and some other ideas. I found that exiting the end of the day worked best. I also tried using some fixed stops but that made it worse. With Easylanguage I could test it for a lot of different strategies until I found what worked best.
     
    #20     Oct 30, 2008