The MA-RSI Winner

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #133058 quote
    Plaedies
    Participant
    Junior

    Hi All,

    This is my first strategy. Works really well on the 1HR timeframe on most Forex Pairs and most notibly on GBP/AUD.

    It uses the RSI indicator of 8 periods to identify volume at both 40 and 60 respectively to either go long or short. This is then paired with a Moving Average of 22 (Optimised) to look at crossovers for entering and exiting the trades.

    It uses a 4 Point/Pip Trailling Stop.

    What would I like to add?

    I would like to use an ATR at 20 periods to automatically calculate the Trailling Stop but I dont have the coding skills to add this.

    Short position example

    Current Timeframe Candle High price + (2*ATR) = Stop Loss

    Long Position Example

    Current Timeframe Candle Low Price – 2*ATR = Trailling Stop Value

    In the example above i’ve used 2 ATR. Ideally i would want this to be configurable or at least easy to change the number in the code as an integer.

    Appreciate any improvements, comments etc…

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = RSI[8](close)
    c1 = (indicator1 >= 60)
    indicator2 = ExponentialAverage[22](close)
    c2 = (close[1] > indicator2[1])
    
    IF c1 AND c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator3 = ExponentialAverage[22](close)
    c3 = (close < indicator3)
    
    IF c3 THEN
    SELL AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator4 = RSI[8](close)
    c4 = (indicator4 <= 40)
    indicator5 = ExponentialAverage[22](close)
    c5 = (close[1] < indicator5[1])
    
    IF c4 AND c5 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    indicator6 = ExponentialAverage[22](close)
    c6 = (close > indicator6)
    
    IF c6 THEN
    EXITSHORT AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pTRAILING 4

     

    Sebastian Arsjo thanked this post
    The-MA-RSI-Winner.itf The-MA-RSI-Winner-1.itf
    #133083 quote
    Nicolas
    Keymaster
    Master

    Hi, thanks for sharing. Did you made the backtests with spread included and with tick-by-tick mode?

    #133232 quote
    Plaedies
    Participant
    Junior

    Hi @Nicolas

    Hmmm, that may have stumped me…. I thought the backtest automated the spread cost within the backtest automatically based against the Forex pair brokerage fee. Clearly this isnt the case? I am using CFD’s to demo trade this. Also the Tick by Tick shows an error so unable to verify unfortunately.

    When I do add a an average 1.57 pip spread it does decline considerably although still well profitable against a £500 start it finishes at £5K over 4 years backtesting alyjough the tick by tick may change that

    is there an area within the forum to request assistance with coding the above Trailling Stop?

    Best wishes,
    Plaedies

    #133294 quote
    Nicolas
    Keymaster
    Master

    Tick by tick mode is mandatory when you want to test the stoploss to be triggered inside a candlestick, otherwise the results could be VERY different in live trading.

    That’s why I always suggest to use a soft coded trailing stop in strategies AND to backtest with tick-by-tick mode enable (always!). There are many examples of trailing stop codes in forums and in the strategies posted in the library.

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

The MA-RSI Winner


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Plaedies @plaedies Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Nicolas
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/24/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...