NASDAQ Mean Reversion

Forums ProRealTime English forum ProOrder support NASDAQ Mean Reversion

Viewing 15 posts - 16 through 30 (of 38 total)
  • #176079

    Attach BT for DAX 5M

    #176081

    Am working on a Low Volume Reversal next, will post a new thread for that one  🙂

    3 users thanked author for this post.
    #176129

    One thing you might want to look at is the section starting at line 73 above. In a 10 year backtest no trades have gone to 1600 bars so those values are doing nothing. This is also the case for the Breakout code you posted.

    This is the snippet I use for that function, closes very long-running positions whether they’re winning or losing. You have to optimise for b1 and b2 (b3, b4 for short).

    I tried to optomize the strategy with B1 and B2.
    I attach the results

    #176691

    //TS KD Mean Reverting v2.1 – Nasdaq 15 min – cfd 1 contract

    // spread 2 points

    DEFPARAM CUMULATEORDERS = FALSE

    PositionSize=1

    //——————————————————– SETUP

    avgHull=average[150,7] //150-7

    volBars=15 //15

    vol = Volume

    lowBars=10 //10

    c1 = close>avgHull // average Hull (filter)

    c2 = vol < vol[volBars] // volume

    c3 = close > lowest [lowBars] (low) // close – lowest low

    If c1 and c2 and c3 and openDayOfWeek <> 5 and tradeAllowed=1 then //TS LONG ONLY ENTRY

    Buy PositionSize CONTRACTS AT MARKET

    ENDIF

    //——————————————————— ADDED EXIT FILTERS

    myrsiM5=rsi[14](close)

    if myrsiM5<30 and longonmarket and close>positionprice then //RSI Exit

    sell at market

    endif

    if myrsiM5>70 and shortonmarket and close<positionprice then

    exitshort at market

    endif

    //—————————————————————-

    maxDailyLoss = 250 // Max Loss Intraday Exit (Euro)

    realPosition=positionPerf*positionPrice/pointSize*pointValue

    once tradeAllowed = 1

    if intradayBarIndex=0 then

    myProfit=strategyProfit

    tradeAllowed=1

    endif

    if (strategyProfit+realPosition) <= (myProfit-maxDailyLoss) then

    tradeAllowed=0

    endif

    ///——————————————————— MONEY MANAGEMENT

    SET STOP pLOSS 130 //SL 100 //SL (stop loss) – TP (take profit)

    SET TARGET pPROFIT 190 //TP 175

    //———————————————————

    pointToReachLong=35*pointSize // 30 //TrP (trailingProfit)

    pointToKeepLong=10*pointSize // 12

    If not onMarket then

    newSL=0

    endif

    If longOnMarket then

    If newSL=0 and high-tradePrice(1)>pointToReachLong then

    newSL=tradePrice(1)+ pointToKeepLong

    endif

    If newSL>0 and close-newSL>pointToReachLong then

    newSL = newSL+pointToKeepLong

    endif

    endif

    If newSL>0 then

    sell at newSL STOP

    endif

    //————————————————————- SPLIT winning position

    once partialcloseGain = 1

    If partialcloseGain then

    ONCE PerCent = 0.5 //close 1/2 size

    PipsGain = 160 //PositionPrice * PerCentGain / PipSize

    ONCE MinLotSize = 0.5

    ExitQuantity = abs(CountOfPosition) * PerCent

    LeftQty = max(MinLotSize,abs(CountOfPosition) – ExitQuantity)

    CloseQuantity = max(0,abs(CountOfPosition) – LeftQty)

    TempGain = PositionPerf * PositionPrice / PipSize

    IF Not OnMarket THEN

    Flag = 1

    ENDIF

    IF partialcloseGain AND LongOnMarket and TempGain >= PipsGain*pipsize AND Flag THEN

    SELL CloseQuantity Contracts AT Market

    Flag = 0

    endif

    IF partialcloseGain AND ShortOnMarket and TempGain >= PipsGain*pipsize AND Flag THEN

    exitshort CloseQuantity Contracts AT Market

    Flag = 0

    endif

    endif

    //—————————————————————————————————————————————–

    1 user thanked author for this post.
    #176692
    #176695

    This is a simplified and clean version of the tradingsystem : TEST-KD Mean Reverting version 1,3

    Test over 200k:

    on the leftside the basic version 1,3

    on the right side the new version 2,1

    2 users thanked author for this post.
    #176702

    This is a simplified and clean version (v2.1) of the trading system: TEST-KD Mean Reverting version (v1.3). I have optimized the trailing stop, added a splitPosition (thanks to Roberto Gozzi’s code) and added an additional filter for the exit.  

    Thank you very much MauroPro, that’s such a great improvement.  And there are so many useful snippets of code in your version, such as averaging out of a position.  Brilliant work.

    #176890

    Great strategy.  Anyone got further with short?

    #191005

    Good evening,
    Simple modification

    #191030

    Hello Fifi

    What is your simple modification???

    #191031

    For me the range is the highest and lowest, not the opening and closing.
    Line 103: I modify the range by: abs(high-low)>rangeok

    Line 40: my opening must be above the 50 moving average and above the opening of the day
    That’s it

    1 user thanked author for this post.
    #191126

    Thank you Fifi  I try to rectfy

    #191141

    I removed the TP too

    #191279

    Fifi, could you post the itf file? did not get the same results.

    #191460

    Yes, here is the code.
    I added an output with the rsi in overbuy

    3 users thanked author for this post.
Viewing 15 posts - 16 through 30 (of 38 total)

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