Trendline Breakout Indicator and Screener

Forums ProRealTime English forum General trading discussions Trendline Breakout Indicator and Screener

Viewing 7 posts - 1 through 7 (of 7 total)
  • #240818

    Hi there,

    I designed an indicator and a screener to detect the trendline breakouts:

    https://market.prorealcode.com/product/trendline-break-indicator-screener/?lang=fr

     

    Indicator Properties

    • The indicator displays bullish and bearish trendlines on your charts.

    • It detects their breakouts and indicates buying and selling signals.

    • It also displays the targets and stop-losses.

     

    ✅ The indicator contains volume and strength trend filters to improve the quality of the signals.

    ✅ It works with stocks, indices, and ETFs in all the time units.

     

    Market Scanner

    The screener will allow you to detect real-time trendline breakouts in the markets. You will be able to catch opportunities at the best time.

     

    The scanner comes with the indicator:

    https://market.prorealcode.com/product/trendline-break-indicator-screener/?lang=fr

     

    Feel free to reply to this post if you have any questions. 😊

    I wish you good trades,

    Vivien

    #241423

    Hello  Vivien, Hello All,

    thanks a lot for your indicator, I used it in my strategy, adding some filter and rules for position management.

    Please find in attach a first result on 1 hour US100, everybody feel free to try updates and improvement on 1-2-3 minue Timeframe in order to decrease the overnight cost.

    Welcome to any improvement! :):)

    Regards,

    Franco

    2 users thanked author for this post.
    #241432

    Hello Roccafragius

    Seems very interesting. Can you share the code of your backtest ?

    I will buy the indicator and wants also to simulate backtests on indexes (SPI, Nasdaq, Cac40 and DAX).
    I will share with you the results.

    Have a great day

    plbourse

     

    #241436

    Hello Franco,

    Thanks for sharing your strategy. Your code seems quite complete. 😊

     

    Have you tested applying the trend, volume, and market strength filters?

    I use the variable optimizer to do this kind of testing. I copy and paste the variables into the optimizer and set a value range from 0 to 1.

    Remind to comment on the variables you are testing in the code. You also have to make sure that there is enough history for the volumes.

     

    You can also test different signals: breakout, validated breakout, retest, and validated retest.

     

    Thanks again for sharing. 👍
    Vivien

    #241441

    Hello plbourse,

    I attached in my previous post the .txt with the code, anyway I post again below no problem, best regards!

    Franco

     

    /——————————————————–//
    // 1224-kkTrendLines Breaker-1H
    //——————————————————–//
    DEFPARAM CUMULATEORDERS = False
    DEFPARAM PRELOADBARS = 1000
    ////////////////////
    //Strategia: To do: until I hit TakeProfit if BUY, I close when Hyper turns red and reopen when it turns green
    /////// If I have reached Stop Loss I stop
    //——————————————————–//
    ExitTrailingStop=0 // Exit in Traling Stop
    EntrateHyperTrig=0 /// Green and yellow arrow entries Hyper Trig (crosses over avg in trend green)
    TooLateToEnter=1 // Too far from last change of HyperTrend
    TooLateToEnterMaxBar=60 /// 60 How many bar too far? Max Bar
    SeguiTPconHyper=1 // If change color of Trend Hyper close the position
    EntrataHyper=1 // Entry filter versus hyper trend by default
    UscitaHyper=1 /// and I go against Hyper timeframedefault and close
    EntrataHyperHTF=0 /// to do Filter with respect to Hyper High Time Frame, but within the same BUY if they are close to the lower
    ///////and SELL if they are close to upper
    CifraDaInvestire=1000
    MinVol=50
    takeProf=CifraDaInvestire/1.1 /// 1.1
    SwingContrarioChiudoDaQuestoGain=CifraDaInvestire/2
    ////////SET TARGET PROFIT takeProf
    volLastCand=volume[1]
    numc=round((CifraDaInvestire*20/close)*100)/100
    //// 0224-kkHyperTrend–1Day
    timeframe(1 Day) // 1 hour 30 minute
    mult30m=5
    slope30m=14
    width30m=80
    once avg30m = close
    once hold30m = 0
    once os30m = 1
    once rR30m = 220
    once gR30m = 20
    once bR30m = 60
    once rV30m = 60
    once gV30m = 179
    once bV30m = 113

    if barindex > 200 then
    atr30m = AverageTrueRange[200] * mult30m

    If abs(close – avg30m) > atr30m then
    avg30m = (close+avg30m)/2
    //avg30m = avg30mN
    else
    avg30m = avg30m + os30m*(hold30m/mult30m/slope30m)
    //avg30m = avg30mN
    endif

    os30m = sgn(avg30m – avg30m[1])

    If os30m <> os30m[1] then
    hold30m = atr30m
    else
    hold30m = hold30m[1]
    endif

    upper30m = avg30m + width30m*hold30m/100
    lower30m = avg30m – width30m*hold30m/100

    If os30m = 1 then
    r30m = rV30m
    g30m = gV30m
    b30m = bV30m
    TrendHypeColorDay=1
    else
    r30m = rR30m
    g30m = gR30m
    b30m = bR30m
    TrendHypeColorDay=-1
    endif
    If os30m = 1 then
    r30mA = 0
    g30mA = 255
    b30mA = 0
    else
    r30mA = 255
    g30mA = 0
    b30mA = 0
    endif

    endif
    LimituppavgDay=(avg30m+upper30m)/2
    LimitDownavgDay=(avg30m+lower30m)/2

    timeframe(default,updateonclose)
    //——————————————————–//
    // *** POSITION SIZE *** //
    //——————————————————–//
    // Capital to invest
    ONCE CapitalToInvest = 10000
    // Minimum number of contracts
    ONCE NumberOfContractsMin = 1
    // Position Size
    NumberOfContracts = MAX(ROUND(CapitalToInvest / Close, 2), NumberOfContractsMin)

    //——————————————————–//
    // *** SETTING BLOCK *** //
    //——————————————————–//
    // Type of lines
    ONCE FallingLines = 1
    ONCE RisingLines =1
    // Length
    ONCE LineLength = 5
    ONCE LineExtension = 15
    // Signals
    ONCE breakout = 1
    ONCE ValidatedBreakout = 0
    ONCE Retest = 0
    ONCE ValidatedRetest = 0
    // Trend filters
    ONCE intheTrend = 0
    ONCE Reversal = 0
    // Strength filters
    ONCE withVolumes = 0
    ONCE withDivergence = 0
    // Take profit
    ONCE TakeProfit = 1
    ONCE TPLevel = 2
    // Stop-loss
    ONCE StopLoss = 1
    ONCE SLLevel = 1
    // Display options
    ONCE FallingColor = 0
    ONCE RisingColor = 0
    ONCE LineThickness = 0
    ONCE FontSize = 0
    // Starting year
    ONCE StartingYear = 2010
    ////////////////////////////////////////////////////
    ////////////////////////////////////////////////////// 1124-kkHyperTrend-SuppDem-Trig
    //////
    mult=5
    slope=14
    width=80
    once avg = close
    once hold = 0
    once TrendHyperos1m = 1
    once rR = 220
    once gR = 20
    once bR = 60
    once rV = 60
    once gV = 179
    once bV = 113

    if barindex > 200 then
    atr = AverageTrueRange[200] * mult

    If abs(close – avg) > atr then
    avg = (close+avg)/2
    //avg = avgN
    else
    avg = avg + TrendHyperos1m*(hold/mult/slope)
    //avg = avgN
    endif

    TrendHyperos1m = sgn(avg – avg[1])

    If TrendHyperos1m <> TrendHyperos1m[1] then
    hold = atr
    else
    hold = hold[1]
    endif

    upper = avg + width*hold/100
    lower = avg – width*hold/100

    If TrendHyperos1m = 1 then
    r = rV
    g = gV
    b = bV
    TrendHypeColor=1
    else
    r = rR
    g = gR
    b = bR
    TrendHypeColor=-1
    endif
    if TrendHyperos1m<>TrendHyperos1m[1] THEN
    avcandleH=(high-low)
    upperprec=upper[1]
    lowerprec=lower[1]
    SearchUp=0
    SearchDn=0
    CambioTrendHyperBar=BarIndex
    CambioTrendHyperVal=close
    SignalHyper=0
    If TrendHyperos1m = 1 THEN
    ///drawarrowUp(barindex,close-avcandleH) coloured(“blue”)
    SignalHyper=1
    ELSE
    ////drawarrowdown(barindex,close+avcandleH) coloured(“magenta”)
    SignalHyper=-1
    endif
    endif
    /////////////

    endif
    ////////////////////////////////////////
    if SearchUp=0 and TrendHypeColor=1 and avg crosses over upperprec THEN
    SearchUp=1
    endif
    if SearchDn=0 and TrendHypeColor=-1 and avg crosses under lowerprec THEN
    SearchDn=1
    endif
    SignalHyperBounce=0
    if SearchUp=1 and close crosses over avg THEN
    //////drawarrowUp(barindex,close-avcandleH) coloured(“green”)
    SignalHyperBounce=1
    SearchUp=0
    endif
    if SearchDn=1 and close crosses under avg THEN
    /////drawarrowDown(barindex,close+avcandleH) coloured(“yellow”)
    SignalHyperBounce=-1
    SearchDn=0
    endif

    ///////Return upper as “upper” COLOURED(rR,gR,bR,100)style(line,1),lower as “lower” COLOURED(rV,gV,bV,100)style(line,1), upperprec as “upperprec”, lowerprec as “lowerprec”,avg as “avg” COLOURED(r,g,b,255)style(line,1)
    //////////////////////////////////////////////
    ///

    myBreakout, myTakeProfit, myStopLoss = CALL “TrendLines Breaker(1)”[FallingLines, RisingLines, LineLength, LineExtension, breakout, ValidatedBreakout, Retest, ValidatedRetest, intheTrend, Reversal, withVolumes, withDivergence, TakeProfit, TPLevel, StopLoss, SLLevel, FallingColor, RisingColor, LineThickness, FontSize, StartingYear](close)

    // Conditions pour ouvrir une position acheteuse
    entrBuy=myBreakout
    entrSell=myBreakout
    ///////////////////////////////////
    if EntrateHyperTrig=1 then
    if entrBuy=0 and entrSell=0 and SignalHyperBounce=1 THEN
    entrBuy=1
    endif
    if entrBuy=0 and entrSell=0 and SignalHyperBounce=-1 THEN
    entrSell=1
    endif
    endif
    Entrato=0
    ////
    if TrendHypeColorDay=1 and close<LimituppavgDay THEN
    entrSell=0
    endif
    if TrendHypeColorDay=-1 and close>LimitDownavgDay THEN
    entrBuy=0
    endif
    if EntrataHyper=0 THEN
    CheckTrendHypeColorBUY=1
    CheckTrendHypeColorSELL=-1
    ELSE
    CheckTrendHypeColorBUY=TrendHypeColor
    CheckTrendHypeColorSELL=-TrendHypeColor
    endif
    /////////////////////////////
    if TooLateToEnter=1 then
    if TrendHyperos1m=1 and barindex-CambioTrendHyperBar >TooLateToEnterMaxBar THEN
    entrBuy=0
    endif
    if TrendHyperos1m=-1 and barindex-CambioTrendHyperBar >TooLateToEnterMaxBar THEN
    entrSell =0
    endif
    endif
    /////////////////////////////////////////
    IF NOT LongOnMarket AND entrBuy=1 and CheckTrendHypeColorBUY=1 THEN
    // Target price
    ///Set Target Price myTakeProfit
    myTakeProfitBUY=myTakeProfit
    // Stop-Loss price
    Set Stop Price myStopLoss
    myStopLossBUY=myStopLoss
    // Buying order
    BUY numc CONTRACTS AT MARKET
    LastSignal=1
    Entrato=1
    ENDIF
    ///////////////////////////////
    // Conditions pour ouvrir une position en vente à découvert
    IF NOT ShortOnMarket AND entrSell = -1 and CheckTrendHypeColorSELL=-1 THEN
    // Target price
    ///Set Target Price myTakeProfit
    myTakeProfitSELL=myTakeProfit
    // Stop-Loss price
    Set Stop Price myStopLoss
    myStopLossSELL=myStopLoss
    // Buying order
    SELLSHORT numc CONTRACTS AT MARKET
    LastSignal=-1
    Entrato=1
    ENDIF
    /////////////////////////////////////////////// USCITE
    if UscitaHyper=1 then
    if ShortOnMarket and SignalHyper=1 and TrendHypeColorDay=1 and close<avg30m THEN
    EXITSHORT AT MARKET
    endif
    ///////////////////////////////////////
    if LongOnMarket and SignalHyper=-1 and TrendHypeColorDay=-1 and close>avg30m THEN
    SELL AT MARKET
    endif
    endif
    ////////////////////////////
    if SeguiTPconHyper=1 THEN
    //Strategy: To do until I reach TakeProfit if BUY, I close when Hyper turns red and reopen when it turns green
    /////// If I have reached Stop Loss I stop
    if LastSignal=1 then
    if LongOnMarket and SignalHyper=-1 THEN
    SELL AT MARKET
    endif
    if not LongOnMarket and SignalHyper=1 and SignalHyper[1]=-1 and close<LimituppavgDay THEN /// Entrato=0 and
    BUY NumberOfContracts CONTRACTS AT MARKET
    endif
    endif
    /////////////
    if LastSignal=-1 then
    if ShortOnMarket and SignalHyper=1 THEN
    EXITSHORT AT MARKET
    endif
    if not ShortOnMarket and SignalHyper=-1 and SignalHyper[1]=1 and close>LimitDownavgDay THEN /// Entrato=0 and
    SELLSHORT NumberOfContracts CONTRACTS AT MARKET
    endif
    endif
    endif
    /////////////////////////////////////////////////////
    if ExitTrailingStop=1 then
    /////RETURN TrendLine coloured(r,g,0) style(line,2) as “BBands stop Trend”
    PriceDistance = 7 * pipsize //7 minimun distance from current price
    Moltav=1
    SellPrice=avg-Moltav*avcandleH
    ExitPrice=avg+Moltav*avcandleH

    //SellPrice=TMA30
    ///ExitPrice=TMA30+10
    if LongOnMarket then

    IF abs(close – SellPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    //
    if close>avg then
    IF close >= SellPrice THEN
    SELL AT SellPrice STOP
    ELSE
    SELL AT SellPrice LIMIT
    ENDIF
    endif
    ELSE
    //
    //sell AT MARKET when EXITPRICE does not meet the broker’s minimun distance from current price
    //
    ///SELL AT Market
    ENDIF
    endif
    if ShortOnMarket then
    //
    IF abs(close – ExitPrice) > PriceDistance THEN
    //
    // place either a LIMIT or STOP pending order according to current price positioning
    if close<avg then
    IF close <= ExitPrice THEN
    EXITSHORT AT ExitPrice STOP
    ELSE
    EXITSHORT AT ExitPrice LIMIT
    ENDIF
    endif
    ELSE
    //
    //ExitShort AT MARKET when EXITPRICE does not meet the broker’s minimun distance from current price
    //
    ///EXITSHORT AT Market
    ENDIF
    endif
    endif
    /////
    ///graph myBreakout
    ///graph TrendHypeColorDay
    ///graph SignalHyperBounce
    ///graph TrendHypeColor
    ///graph SignalHyper

    1 user thanked author for this post.
    #241491

    Hello Roccafragius

    I have been running your code with only a very change : I had to call the function “TrendLines Breaker” instead of “TrendLines Breaker(1)” : I do not know the changes you made in the function “TrendLines Breaker(1)” on IG Dow(1€), Nasdaq(1€), DAX40(1€), CAC40(1€) with always a spread of 2 points on the timeframes 1 min, 5 min, 15 min, 1 hour and 4 hour, each time using a 200k bars chart.

    The results on the whole are not satisfactory,

    • % Tr > 0 between 20 % and 30 %
    • Equity curve mostly around 0 or negative, no result showing a steady growing equity curve
    • Best results as average trade between 15€ and 30 € but on timeframe 1 hour or 4 hour, resulting in very low trade rate per day.

    I have found that if you chose “only long trades” in the detailed report summary, you sometime achieve the same quality of results or even slightly better (teh short trade reduce the average performance), here screenshots of the detailed reports for Nasdaq 1 hour

    Maybe this can allow further optimisation of the system especially for Long Trades. Until now, I had not the time to go deeply in understanding the code to try further optimization .

    Hope this can help in the mean time

    1 user thanked author for this post.
    #241519

    Thank you plbourse, the reason for TrendLines Breaker(1) is that I tried the for a while the indicator for free last weeks and after I bought it.

    During the use after I boufght the license the import it failed, I solve it with a rename.

    Thank you

    Franco

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

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