Thread: Could anyone back test this code for me?

Results 1 to 3 of 3

  1. #1

    Default Could anyone back test this code for me?

    I've just discovered automated trading and have been trying to put a system together on IG's Prorealtime. This one is for US30 on M30 T/F and is simplicity itself.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    x=45
    y=54
    a=40
    b=48
    // Conditions to enter long positions
    indicator1 = ExponentialAverage[x](close)
    indicator2 = ExponentialAverage[y](close)
    c1 = (indicator1 CROSSES OVER indicator2)

    IF c1 THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

    // Conditions to exit long positions
    indicator3 = ExponentialAverage[x](close)
    indicator4 = ExponentialAverage[y](close)
    c2 = (indicator3 CROSSES UNDER indicator4)

    IF c2 THEN
    SELL AT MARKET
    ENDIF

    // Conditions to enter short positions
    indicator5 = ExponentialAverage[a](close)
    indicator6 = ExponentialAverage[b](close)
    c3 = (indicator5 CROSSES UNDER indicator6)

    IF c3 THEN
    SELLSHORT 1 PERPOINT AT MARKET
    ENDIF

    // Conditions to exit short positions
    indicator7 = ExponentialAverage[a](close)
    indicator8 = ExponentialAverage[b](close)
    c4 = (indicator7 CROSSES OVER indicator8)

    IF c4 THEN
    EXITSHORT AT MARKET
    ENDIF

    // Stops and targets
    SET STOP pLOSS 75
    SET TARGET pPROFIT 150


    I can back test to August last year but no further. If anybody could test this going back 5 years or so I would be very grateful. The results so far are pretty good. Any suggestions for improvement are most welcome.
  2. #2

    Default

    Why can't you backtest prior to August? When you say "US30" do you mean the Dow 30? You could download years of historical data on that quite easily (such as Yahoo Finance, for example).

    Your algorithm appears to use an (exponential) moving average crossovers to generate buy/sell signals. Yes, that is "simplicity itself." Maybe too simple. If you're going to do algorithmic trading, I suggest reading Ernie Chan's book, "Algorithmic Trading - Winning Strategies and Their Rationale".
  3. #3
    AliceLit
    Guest

    Default

    I can't back test prior to August because that's as far back as the data goes on my spread bet platform on the 30 minute time frame. Yes I'm referring to the Dow. I think the years of historical data on Yahoo is Daily OHLC, but I will double check. It maybe too simple and that's why I'm trying to back test for a longer period of time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts