Does this system have an edge or is it just the last year?

Viewing 15 posts - 1 through 15 (of 36 total)
  • Author
    Posts
  • #29612 quote
    victormork
    Participant
    Veteran

    I created this basic beginner code for the EURUSD 1H and added a trailing stop function which Nicolas had posted on the forum. The result looks okay but my concern is that it’s starting first after 2015 (1 pip spread). Any takes on what I could do differnet. And how is the performance before 2013? Short trades has been far more profitable than long trades during the backtest. Maybe not a surprise since the longer trend has been to the downside.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions to enter long positions
    indicator1 = CCI[8]
    c1 = (indicator1 CROSSES OVER -240)
    indicator2 = BollingerBandWidth[20](close)
    c2 = (indicator2 > 0.003)
    indicator3 = TRIX[12](close)
    indicator4 = Average[9](indicator3)
    c3 = (indicator3 > indicator4)
    
    IF (c1 AND c2 AND c3) AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator7 = CCI[8]
    c5 = (indicator7 CROSSES UNDER 140)
    indicator8 = BollingerBandWidth[20](close)
    c6 = (indicator8 > 0.003)
    indicator9 = Average[9](TRIX[12](close))
    indicator10 = TRIX[12](close)
    c7 = (indicator9 > indicator10)
    
    IF (c5 AND c6 AND c7) AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stoploss
    SET STOP pLOSS 55
    trailingstart = 50 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    #29955 quote
    victormork
    Participant
    Veteran

    C1 should be changed to cross over -150 in order to include long trades too.

    #29968 quote
    GraHal
    Participant
    Master

    Looks good Victor, I like the low Drawdown!

    I’ve always found EUR/USD difficult to trade manual or Auto, but you seem to have nailed it!

    Have you got Walk Forward test on your Platform yet? Interesting how your Bot works on Walk Forward.

    I’ll come back with any improvements, but somehow I don’t think I’ll find any! 🙂

    Cheers
    GraHal

    #29978 quote
    GraHal
    Participant
    Master

    I’ve set it going Live, partly to test out my ‘negative equity / loss limiter’.

    Settings as below

    If STRATEGYPROFIT < 175 AND POSITIONPERF < - 0.0004 then
    Exitshort at Market
    Sell at Market
    Endif

    GraHal

    #30034 quote
    victormork
    Participant
    Veteran

    Finally a reply! I thought it was a bit strange that no one reacted on what I thought was a pretty good attempt on this pair. Can you please tell me a bit more about the idea behind your loss limiter? It looks very interesting!

    I got the Walk Forward test available on my demo account today so I have not yet had time to try it out on this system. I’m currently testing the system on my demo account and hopefully I’ll take it live afterwards.

    #30047 quote
    Nicolas
    Keymaster
    Master

    Since you are “mirroring” the conditions for short trades, is it normal that indicator9 and indicator10 variables are different than the long ones?

    You should also only declare the same indicator only once, it is unnecessary to declare them for each side.

    #30048 quote
    GraHal
    Participant
    Master

    Yes it can be disappointing when nobody replies, I experience this also. I noticed it had been a few days with no response so I thought I’d check it out.

    Normally I’m very cautious and run on Demo first, but with my loss limiter coded in for added negative equity protection, I thought I’d set it going Live @ £1 per point.

    If you want to know more re the Loss Limiter then please read below. Loads of background reading also on the ‘bad beginnings’ thread (3rd line of link below).

    https://www.prorealcode.com/topic/negative-equity-loss-limiter-help-please/

    I’ll let you know when your Bot triggers in Live for me.

    Regards
    GraHal

    #30063 quote
    victormork
    Participant
    Veteran

    @Nicolas –  when I mirror the conditions for long and short I normally have the long a bit lower and the short a bit higher for a better result. In this case there’s an error in the buying condition as I pointed out later on. It should be “cross over -150” (almost the same as cross under 140) and not -240.

    @GraHal – Thanks for the link, I’ll check it out! The draw down visible on the picture I uploaded is smoothen out with the correct buying condition so I’m hoping that the real test will be okay. Let’s have a review after a few trades.

    #30198 quote
    GraHal
    Participant
    Master

    Triggered … see short trade attached.

    I’m probably going to stop the Bot if it goes back up much past the LH at 10,794 (IG times by 10K so 1.0794) as this would indicate a reversal of the current downtrend.

    It be interesting to see what your Bot does in Demo?

    GraHal

    #30226 quote
    victormork
    Participant
    Veteran

    I’m short too on my demo and I’ll let it run to see how the exit is handled. If you are stopping now I can congratulate you to 60 pips 🙂

    #30238 quote
    GraHal
    Participant
    Master

    Yeah I stopped the Bot right after that big drop at 13:00 ish GMT … 61 pips, there was a pullback so I didn’t get max pips, but a profit is a profit! 🙂

    So far so good and the entry point was logical also!

    Cheers
    GraHal

    #30239 quote
    Nicolas
    Keymaster
    Master

    I think we should put this one into the Library, to drain more people here.
    So now you already have good results even with long trades too?

    #30241 quote
    GraHal
    Participant
    Master

    Sounds good to me!

    #30264 quote
    victormork
    Participant
    Veteran

    Hi Nicolas, Yes the long trades was solved buy updating the entry criteria.

    The system closed the position on 1.07708 (about 45 pips profit) and has now opened a new short. You can put the code in the library but I’m afraid I don’t have time at the moment to rewrite it more nicely were every indicator is specified only once. I have attached the correct code and I have updated this one with an additional criteria on

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions to enter long positions
    indicator1 = CCI[8]
    c1 = (indicator1 CROSSES OVER -150)
    indicator2 = BollingerBandWidth[20](close)
    c2 = (indicator2 > 0.003)
    indicator3 = TRIX[12](close)
    indicator4 = Average[9](indicator3)
    c3 = (indicator3 > indicator4)
    indicator5 = TRIX[15](close)
    c4 = (indicator5 < 0.015)
    
    IF (c1 AND c2 AND c3 AND c4) AND not daysForbiddenEntry THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator7 = CCI[8]
    c5 = (indicator7 CROSSES UNDER 140)
    indicator8 = BollingerBandWidth[20](close)
    c6 = (indicator8 > 0.003)
    indicator9 = Average[9](TRIX[12](close))
    indicator10 = TRIX[12](close)
    c7 = (indicator9 > indicator10)
    c8 = (indicator5 > -0.015)
    
    IF (c5 AND c6 AND c7 AND c8) AND not daysForbiddenEntry THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Stoploss
    SET STOP pLOSS 55
    trailingstart = 50 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF

    both long and short which prevents from entering positions following the shorter trend when the price is in an oversold or overbought stage. This only excluded 10 trades out of 400+ so I think it’s acceptable.

    #30289 quote
    GraHal
    Participant
    Master

    Victor, nice work with latest changes … gives about £450 more profit over 100,000 x 1H and lowers the Drawdown by £120 … keep em coming matey! 🙂

    Thank You
    GraHal

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

Does this system have an edge or is it just the last year?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
victormork @victormork Participant
Summary

This topic contains 35 replies,
has 5 voices, and was last updated by victormork
8 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/23/2017
Status: Active
Attachments: 7 files
Logo Logo
Loading...