NASDAQ Mean Reversion

Viewing 8 posts - 31 through 38 (of 38 total)
  • Author
    Posts
  • #191461 quote
    fifi743
    Participant
    Master

    At the bottom of my code, I added this line

     

    if longonmarket and close>positionprice and RSI[14](close)crosses under 70  and barindex-tradeindex>30 and opentime<130000 and close[1]-open[1]>20 then
    sell at market
    ENDIF
    ullle73, Fabiano, Midlanddave and ichimoku18 thanked this post
    Capture-decran-4803.png Capture-decran-4803.png
    #191464 quote
    ullle73
    Participant
    Senior

    thanks fifi!

    #191539 quote
    fifi743
    Participant
    Master

    I modified the code for long entry and the difference between the two versions is high-high[1]>5

    MM=average[30]
    //and high-high[1]>5
    cndLong= OPEN>MM and dopen(0)<close and high-close>1 and  high-close<20 and low[1]<close
    // Conditions to enter long positions
    If close > lowest[Pbars](low) and c1 and opendayofweek <> 5 and F1 and cndLong then
    Buy PositionSize CONTRACTS AT MARKET
    ENDIF
    ichimoku18 thanked this post
    Capture-decran-4806.png Capture-decran-4806.png
    #191542 quote
    fifi743
    Participant
    Master

    or this version

    MM=average[30]
    //
    cndLong= OPEN>MM and dopen(0)<close and high-close>1 and  high-close<20 and low[1]<close and high-high[1]>5 and not(open<low[1])
    // Conditions to enter long positions
    If close > lowest[Pbars](low) and c1 and opendayofweek <> 5 and F1 and cndLong then
    Buy PositionSize CONTRACTS AT MARKET
    ENDIF
    
    Fabiano, Midlanddave and ichimoku18 thanked this post
    Capture-decran-4809.png Capture-decran-4809.png
    #192039 quote
    Robert841
    Participant
    New
    #192050 quote
    monkeys nuts
    Blocked
    New

    Hi Robert841 – Depending on the index, and whether it’s CFD or Spreadbet, it’s 0.2 or 0.5.  Once you’ve run it in demo for a bit and are happy then you can try it on a small size.

    #192386 quote
    MauroPro
    Participant
    Veteran

    Hi, this is one of my revised and simplified versions (v5) with the addition of Fifi improvement.

    //TS KD Mean Reverting v5 - Nasdaq 15 min
    // spread 2 points
    DEFPARAM CUMULATEORDERS = FALSE
    positionSize = 1
    //--------------------------------------------------------
    avgHull = average[150,7]
    nBarsVolume = 15
    average30 = average[30](close)
    //--------------------------------------------------------
    c1L = close > avgHull
    c2L = volume < volume[nBarsVolume]
    c3L = open > average30 and dOpen(0)< close and high - close > 1 and high - close < 20 and low[1] < close  // [Fifi improvement "cndLong": rif. 191539]
    //--------------------------------------------------------
    If c1L and c2L and c3L and nLoss < nLossMax and openDayOfWeek <> 5 then
    buy positionSize contracts at market
    endif
    //-------------------------------------------------------------------------------------
    set target pProfit 220
    set stop pLoss 100
    //-------------------------------------------------------------------------------
    once nLoss = 0
    nLossMax = 2   //max N daily losses
    if intradayBarIndex = 0 then
    nLoss=0
    endif
    if strategyProfit < strategyProfit[1] then
    nLoss=nLoss +1
    endif
    //------------------------------------------------------------------------
    EZT = 1 //EZT (exit zombie trades - Nonetheless)
    if EZT then
    if longOnMarket and (barIndex-tradeIndex(1)>= 1600 and positionPerf<0)  then
    sell at market
    endif
    endif
    //-----------------------------------------------------
    EWT = 1   //(exit winning trades - MauroPro)
    nCandles = 8
    percentTP        =  1.8
    endTime   = 080000
    if EWT then
    if longOnMarket and (barIndex-tradeIndex(1)>nCandles and positionPerf*100 > percentTP) and (time>000000 and time<endTime) then
    sell at market
    endif
    endif
    //------------------------------------------------------------------
    myRsi = rsi[14](close)      //RSI exit
    if myRsi < 30  and longOnMarket and close > positionPrice  then
    sell at market
    endif
    //----
    if longOnMarket and close>positionPrice and RSI[14](close)>70 and  close-open>100 then  //added by Fifi
    sell at market
    ENDIF
    //-------------------------------------------------------------------------------------------
    pointToReachLong = 38*pointSize   // 30
    pointToKeepLong =  12*pointSize
    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
    //-----------------------------------------------------------------------------------------------------
    once bollPeriod = 20              // bollPercent Exit
    once multiplier = 2
    avgBoll = average[bollperiod,1](close)
    stDevBoll = std[bollperiod]
    bollUp = avgBoll + multiplier * stDevBoll
    bollDown = avgBoll - multiplier * stDevBoll
    bollPercent = 100 * (close - bollDown) / (bollUp - bollDown)
    //-----------------------------------------------------------------------------
    once rangeOk = 40
    once timeOk = 0
    if time <= 090000 or time >= 210000 and (high - low) > rangeOk then
    timeOk = 0
    endif
    IF time >= 080000 and time <= 200000 and (high - low) > rangeOk then
    timeOk = 1
    endif
    
    period = 4     // exit with 2 of the last 4 bars below the threshold of 40 bollPerCent
    levelPercent = 40
    candleNum = 2
    if  timeOk = 1 and (barIndex - tradeIndex) < 12 and summation[period](bollPercent < levelPercent) = candleNum then
    sell at market
    endif
    //------------------------------------------------------------------------------------------------------------
    ichimoku18 and reb thanked this post
    #192387 quote
    MauroPro
    Participant
    Veteran
Viewing 8 posts - 31 through 38 (of 38 total)
  • You must be logged in to reply to this topic.

NASDAQ Mean Reversion


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

This topic contains 37 replies,
has 14 voices, and was last updated by MauroPro
3 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/23/2021
Status: Active
Attachments: 14 files
Logo Logo
Loading...