Up Down Range Trading on Daily Charts SA 40

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #9518 quote
    CarelDavids
    Participant
    New

    Hey Guys / Girls

    I have been playing around with a trading system based on range (High – Low) based on the SA 40 index (as I am South African I wanted to trade what I know).

    The trading strategy is simple.

    A Buy Stop is placed at 10% of “Yesterday’s” range above “Yesterday’s” high.

    A Sellshort Stop is also placed at 10% of “Yesterday’s” range below “Yesterday’s” low.

    The reason I placed Yesterday in quotations is that PRT evaluates the code at the end of each bar. Thus to determine “Yesterday’s” range we have to evaluate today’s Highs and Lows and place stop orders which activate at the start of the next Bar.

    I have also added a trailing stop loss. The results look good, however I am a bit worried that PRT paints a rosy picture due to the backtest being on a Daily timeframe. It may be that in real time trading, the trailing stop loss causes the system to stop out prior the point indicated in the backtest.

    I haven’t had a look at Backtesting on the DAX or FTSE just yet and will look into that in the next few weeks.

    Opinions and comments are welcome.

    //-------------------------------------------------------------------------
    // Main code : UP DOWN Range(R10 Micro)(1d)
    //-------------------------------------------------------------------------
    DEFPARAM CUMULATEORDERS = false
    //SET VARIABLES
    STARTDAY = 1 //ONLY TRADE MONDAY TO FRIDAY
    ENDDAY = 5
    NoContracts = 2 //START WITH 2 NUMBER CONTRACTS
    MAXLOSS = 75 //MAXIMUM POINT LOSS
    UPM = 0.1 //MULTIPLIER TO RANGE FOR LIMIT ORDERS
    DNM = 0.1 //MULTIPLIER TO RANGE FOR LIMIT ORDERS
    //SET LEVEL FOR LIMIT ORDERS
    IF DAYOFWEEK > STARTDAY AND DAYOFWEEK <= ENDDAY THEN //ON DAYS THAT ARE NOT MONDAY
    PREVRANGE = HIGH-LOW
    LIMITPRICE = MAX(OPEN,CLOSE) + (UPM*PREVRANGE)
    SHORTPRICE = MIN(OPEN,CLOSE) - (DNM*PREVRANGE)
    UPTREND = CLOSE > OPEN //DETERMINE IF IN AN UPTREND
    DNTREND = CLOSE < OPEN //DETERMINE IF IN AN DOWNTREND
    ELSIF DAYOFWEEK = STARTDAY THEN //ON MONDAY LOOK AT FRIDAY
    PREVRANGEMON = HIGH[1]-LOW[1]
    LIMITPRICE = MAX(OPEN[1],CLOSE[1]) + (UPM*PREVRANGEMON)
    SHORTPRICE = MIN(OPEN[1],CLOSE[1]) - (DNM*PREVRANGEMON)
    UPTREND = CLOSE[1] > OPEN[1] //DETERMINE IF IN AN UPTREND
    DNTREND = CLOSE[1] < OPEN[1] //DETERMINE IF IN AN DOWNTREND
    ENDIF
    //ENTERING TRADES
    IF DAYOFWEEK >= STARTDAY AND DAYOFWEEK <=ENDDAY THEN
    //SET ORDER FOR LONG POSITIONS
    IF NOT LONGONMARKET AND UPTREND THEN
    BUY NOCONTRACTS CONTRACTS AT LIMITPRICE STOP
    ENDIF
    //SET ORDER FOR SHORT POSITIONS
    IF NOT SHORTONMARKET AND DNTREND THEN
    SELLSHORT NOCONTRACTS CONTRACTS AT SHORTPRICE STOP
    ENDIF
    // STOPS AND TARGETS
    SET STOP $TRAILING (NoCONTRACTS*MAXLOSS*POINTVALUE)
    //SET TARGET PPROFIT 7*MAXLOSS
    ENDIF
    
    ellejoe thanked this post
    up-down-range-pic-14661659878pcl41.jpg up-down-range-pic-14661659878pcl41.jpg
    #9521 quote
    Nicolas
    Keymaster
    Master

    Hello,

    Thanks a lot for sharing your trading strategy on our site. I have moved your post from Library to the forum instead, because unfortunately, you were right, the backtest paint a “rosy” picture of what would happen really, because of the trailing stop.

    ProBacktest don’t know when your trailing stop triggered inside candlesticks, so the best favourable condition is taken. This is something that will be changed in the next major update of the platform = ProBacktest will be more accurate with what would happen in real time.

    Don’t hesitate to share other ideas or ask questions 🙂

    #30049 quote
    Vincenzo2017
    Participant
    Junior

    Hi CarelDavis and Nicolas,

    thank you for your contribution!

    Do you have some update on this strategy? Now PRT take in consideration the trailing stop loss as in reality? Or there is a way to avoid this “bug” ?

    I tested on various index and on various period and always receive a huge profit. Do you think that in reality there will be too much difference from the backtest?

    (I mean if current backtest give me +1000 %, how much would be in reality?)

    Thank you in advance

    #30051 quote
    Eric
    Participant
    Master

    run it on demo a couple of months

    and then compare with backtest

    #30955 quote
    CarelDavids
    Participant
    New

    Hey Vincenzo2017

    I have not had a look at this Strat in the ProRealTime 10.3 software. I have been busy setting up some currency strats. I will backtest it and let you know. I agree with Eric that the return seems unbelievable. I will run a live test on my demo account as Suggested for a month and let you know what I come up with.

    #30956 quote
    CarelDavids
    Participant
    New

    Thanks Eric I will Backtest for a month on live demo account and then we should see if it is truely working.

    #30964 quote
    Nicolas
    Keymaster
    Master

    Did you backtest with real spread value and in tick/tick mode? I know that SA40 spread is quite high.

    #30968 quote
    CarelDavids
    Participant
    New

    Hey Nicolas

    At that stage I didn’t backtest with a spread. Yes the spread on the SA40 can be high sometimes more than 15. I did backtest in PRT 10.3 with a realistic spread and in tickmode and the results look vastly different. Nowhere near the returns shown above and in fact seems to drain the account. PRT also states that it doesn’t have tick data for all the bars. Even if I only backtest between the last 100 000 ticks on the daily chart. (I have attached the screen grab showing their error screen). Maybe there is still some work for the PRT team. I will still run the live test so will report back

    PRT-Error.jpg PRT-Error.jpg
    #30998 quote
    Nicolas
    Keymaster
    Master

    Tick backtest is the only way to backtest to get a result near to what you could expect in a real live trading environment. That’s what I pointed to you in my last year post:

    ProBacktest don’t know when your trailing stop triggered inside candlesticks, so the best favourable condition is taken. This is something that will be changed in the next major update of the platform = ProBacktest will be more accurate with what would happen in real time.

    Full history in ticks are not available for all instruments and that seems to be the case for South Africa 40.

    #31026 quote
    Vincenzo2017
    Participant
    Junior

    Hello everybody, thank you for your suggestion and special thanks Nicolas for your patience! 🙂

    Now I found your previous post about this subject and also wathced your video on youtube.

    We hope that finally those backtest in tick by tick mode, will give a result close much as possible to reality.

    Thanks!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Up Down Range Trading on Daily Charts SA 40


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 9 replies,
has 4 voices, and was last updated by Vincenzo2017
8 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/17/2016
Status: Active
Attachments: 2 files
Logo Logo
Loading...