Crossmomentum strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18605 quote
    AlcoAlco
    Participant
    Senior

    Hi guys,

    I’m trying a simple strategy I use sometimes in manual trading.
    It makes sence to me and it works on backtests on dax and dow 1H timeframe. I think it has a great potential if we put trailing stops in the code, but I don’t know how.
    It still has a couple 0 bars, so if someone could test it with the tick by tick mode, it make things more clear.

    For buy:
    Simple moving average needs to cross over the momentum and momentum needs to be positive.
    Directional movement indicator needs to be positive and > 23
    EMA 8 has to be above 89 ema

    For sell the opposite.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = Momentum[12](close)
    c1 = (indicator1 >= 0)
    
    indicator2 = Momentum[12](close)
    indicator3 = Average[20](Momentum[12](close))
    c2 = (indicator2 >= indicator3)
    
    indicator4 = DIplus[14](close)
    indicator5 = DIminus[14](close)
    c3 = (indicator4 >= indicator5)
    
    indicator6 = DIplus[14](close)
    c4 = (indicator6 >= 23)
    
    indicator7 = ExponentialAverage[8](close)
    indicator8 = ExponentialAverage[89](close)
    c5 = (indicator7 >= indicator8)
    
    IF c1 AND c2 AND c3 AND c4 AND c5 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator9 = Average[20](Momentum[12](close))
    indicator10 = Momentum[12](close)
    c6 = (indicator9 CROSSES OVER indicator10)
    
    IF c6 THEN
    SELL  AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator11 = Momentum[12](close)
    c7 = (indicator11 <= 0)
    
    indicator12 = Average[20](Momentum[12](close))
    indicator13 = Momentum[12](close)
    c8 = (indicator12 >= indicator13)
    
    indicator14 = DI[14](close)
    indicator15 = DI[14](close)
    c9 = (indicator14 >= indicator15)
    
    indicator16 = DIminus[14](close)
    c10 = (indicator16 >= 23)
    
    indicator17 = ExponentialAverage[8](close)
    indicator18 = ExponentialAverage[89](close)
    c11 = (indicator17 <= indicator18)
    
    IF c7 AND c8 AND c9 AND c10 AND c11 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit short positions
    indicator19 = Momentum[12](close)
    indicator20 = Average[20](Momentum[12](close))
    c12 = (indicator19 CROSSES OVER indicator20)
    
    IF c12 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 25
    SET TARGET pPROFIT 50
    

    Maybe someone could give me some advice or could adapt the code.
    Have fun šŸ™‚

    Alco

    momentumcross.png momentumcross.png
    #18643 quote
    NicolasNicolas
    Keymaster
    Legend

    Thanks for sharing your intraday trading strategy!

    To add a trailing stop (PRT embedded one), just replace your line 69 with this one instead:

    SET STOP pTRAILING 25
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Crossmomentum strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Alco @alco_aarts Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
9 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/15/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...