Hull moving average crossover strategy

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #201868 quote
    Bastrucco
    Participant
    New

    Hello everybody

    As an idea i have combined a simple hull moving average crossover strategy with the Bbandstop Indicator from Nicolas, the SAR and a Trailing. The strategy shows passable results on the Nasdaq Tech cash.

    Further tests, combination and optimization ideas would be appreciated.

    The indicators are included in the itf. file.

    Thank you already for further improvements

    //Risk Management
    PositionSize=1
    // TIME RESTRICTIONS
    TimeOfDayCriteria = TIME >= 153000 AND TIME <= 220000
    
    LongCondition ,ShortCondition = CALL "OMX_HllMvAgInd"[25*12,50*12]
    BBandCondition = CALL "PRC_BBands Stop"[20,2,1]
    GraphonPrice BBandCondition as "BBand" coloured (0,0,255)
    if showentrycondition then
    GRAPH LongCondition as "longcondition" coloured (0,255,0)
    GRAPH Shortcondition as "shortcondition" coloured (255,0,0)
    endif
    Bbandlongcondition = close > BBandCondition
    Bbandshortcondition = close < BBandCondition
    
    GRAPH BbandlongCondition as "longcondition" coloured (0,255,0)
    GRAPH -Bbandshortcondition as "shortcondition" coloured (255,0,0)
    
    DownPeriod = SAR[0.02,0.02,0.2] > CLOSE[0]
    UpPeriod = SAR[0.02,0.02,0.2] < CLOSE[0]
    
    If LongCondition AND UpPeriod THEN
    Buy PositionSize CONTRACTS AT MARKET
    //SET STOP PLOSS ABS(close - S1)
    SET STOP %LOSS 2
    ENDIF
    
    IF ShortCondition AND DownPeriod THEN
    SELLSHORT PositionSize CONTRACTS AT MARKET
    SET STOP %LOSS 2
    ENDIF
    
    IF Shortonmarket AND Bbandlongcondition THEN
    EXITSHORT AT MARKET
    endif
    
    IF longonmarket AND Bbandshortcondition THEN
    EXITSHORT AT MARKET
    endif
    
    activtateTrailingStop = 1
    IF activtateTrailingStop THEN
    takeStdOverNCandles = 5*12*4// 4 Hours
    SigmaClose = STD[takeStdOverNCandles](CLOSE)
    trailingstart = SigmaClose*TrailSTA // 66%
    trailingstep  = SigmaClose*TrailSTE //33%
    
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    IF LONGONMARKET THEN
    IF newSL=0 AND CLOSE-TRADEPRICE(1)>=trailingstart*PIPSIZE THEN
    newSL = TRADEPRICE(1)+trailingstep*PIPSIZE
    ENDIF
    // SHIFT TRAILING STOP
    IF newSL>0 AND CLOSE-newSL>=trailingstep*PIPSIZE THEN
    newSL = newSL+trailingstep*PIPSIZE
    ENDIF
    ENDIF
    
    IF newSL>0 THEN
    SELL AT newSL STOP
    ENDIF
    ENDIF
    
    #201924 quote
    JS
    Participant
    Senior

    IF longonmarket AND Bbandshortcondition THEN
    EXITSHORT AT MARKET ??????
    endif

    For your LONG -positions to close use:

    IF longonmarket AND Bbandshortcondition THEN
    Sell AT MARKET
    endif

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

Hull moving average crossover strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Bastrucco @bastrucco Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JS
3 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/03/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...