A simple "3 Candles – SMA20" strategy

Forums ProRealTime English forum ProOrder support A simple "3 Candles – SMA20" strategy

This topic contains 0 replies, has 1 voice, and was last updated by avatar Doctrading 1 year, 8 months ago.

View all attachments
Viewing 1 post (of 1 total)
  • #29134

    Hello all,

    As you can imagine, I am currently overwhelmed by my work, and by the demands of my readers, who want a few backtests of strategies, or help to develop their personalized indicators on the ProRealTime platform.

    As far as possible, I try to answer all the requests, in the order in which they have been formulated (I’m 2 months late for some!) However, I will respond to a more recent request today because it is easy to satisfy.

    The coding request vas very simple.

    For buying, we look for the SMA20 to be increasing, with 3 closes which are lower each time. Then we make a “buy stop” order at the highest of the last candle.

    Stop loss = take profit = high – low of this candle

    So I chose to test this strategy on the CAC40. Initially, the results were not very good with this demand. There were also backtesting errors with the stop loss and take profit hit on the same candle, which is why I doubled the distance to stop loss and take profit. The strategy was positive, but not very effective.

    I chose to couple it with another strategy :

    We buy directly when there are 3 closes lower each time ; AND we also enter the top of the third candle. I also added the inverse rules to the sale.

    Certainly, this strategy will not make you rich ; But it has the merit of showing that with extremely simple trading rules, we can be positive. I am convinced that it can be frankly improved, with adjustments, money management, etc.

    For example, I did not test the fact that we can go back on 3 candles of the same color, I only tested this way. Be careful, however, because this strategy uses several simultaneous orders : do not abuse with the leverage. 

    Defparam cumulateorders = true
    MM20 = average[20](close)

    // ACHAT
    ca1 = MM20 > MM20[1] and close > MM20
    ca2 = close < close[1] and close[1] < close[2]

    IF ca1 and ca2 THEN
    amplitude = high – low
    buy at market
    buy at high stop
    ENDIF

    // VENTE
    cv1 = MM20 < MM20[1] and close < MM20
    cv2 = close > close[1] and close[1] > close[2]

    IF cv1 and cv2 THEN
    amplitude = high – low
    sellshort at market
    sellshort at low stop
    ENDIF

    set stop loss 2*amplitude
    set target profit 2*amplitude

    Attachments:
    1 user thanked author for this post.
Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or