MTF Strategy 2 hrs and 2 min

Forums ProRealTime English forum ProBuilder support MTF Strategy 2 hrs and 2 min

Viewing 2 posts - 1 through 2 (of 2 total)
  • #174726

    I have created this strategy based on 2 time frames MACD on 2 hrs and Supertrend on 2 mins, its not working with me, I believe it needs to be corrected, could you please help in adjusting it.

    // VARIABLES

    SL = 4

    stepfactor1 = 1

    stepfactor2 = 0.25

    RR = 2

    timeframe(2 hour, updateonclose)

    MCD = MACD[12,26,9](close)

    timeframe(2 minutes)

    DM = DEMA[14](close)

    PST = Supertrend[2,10]

    // Conditions to enter long positions

    IF MCD > 0 AND DM CROSSES OVER PST THEN

    BUY 1 CONTRACTS AT MARKET

    SET STOP   pLOSS   SL    //5

    TP = RR * SL

    SET TARGET pPROFIT TP   //10

    ENDIF

     

    // Conditions to exit long positions

    If DM CROSSES UNDER PST THEN

    SELL AT MARKET

    ENDIF

     

    // Conditions to enter short positions

    IF MCD < 0 AND DM CROSSES UNDER PST THEN

    SELLSHORT 1 CONTRACTS AT MARKET

    SET STOP   pLOSS   SL    //5

    TP = RR * SL

    SET TARGET pPROFIT TP   //10

    ENDIF

     

    // Conditions to exit short positions

    IF DM  CROSSES OVER PST THEN

    EXITSHORT AT MARKET

    ENDIF

     

    // Stops and targets : Enter your protection stops and profit targets here

    //====== Trailing Stop mechanism – start =====

     

     

    trailingstart = (stepfactor1 * SL ) / pointsize

    trailingstep = (stepfactor2 * SL ) / pointsize

     

    //resetting variables when no trades are on market

    if not onmarket then

    priceexit = 0

    endif

     

    //case LONG order

    if longonmarket then

     

    //first move (breakeven)

    IF priceexit=0 AND close-tradeprice(1) >= trailingstart*pointsize THEN

     

    priceexit = tradeprice(1) + trailingstep*pointsize

     

    ENDIF

    //next moves

    IF priceexit>0 THEN

    P2 = close-priceexit >= trailingstart*pointsize

     

    IF P2 THEN

    priceexit = priceexit + trailingstep*pointsize

    ENDIF

     

    ENDIF

    endif

     

    //case SHORT order

    if shortonmarket then

     

    //first move (breakeven)

    IF priceexit=0 AND tradeprice(1)-close >= trailingstart*pointsize THEN

     

    priceexit = tradeprice(1) – trailingstep*pointsize

     

    ENDIF

    //next moves

    IF priceexit>0 THEN

     

    P2 = priceexit-close >= trailingstart*pointsize

     

    IF P2 THEN

    priceexit = priceexit – trailingstep*pointsize

    ENDIF

     

    ENDIF

     

    endif

     

    //exit on trailing stop price levels

    if onmarket and priceexit>0 then

    EXITSHORT AT priceexit STOP

    SELL AT priceexit STOP

    endif

    //====== Trailing Stop mechanism – end =====

    #176287

    I can’t spot anything wrong.

    I can only suggest that you set a higher SL, as it seems a bit too small.

    Check IG’s website to know what the minimum SL is, to prevent your strategy when run in demo/real (not when backtesting) from being stopped.

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

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