Indicatore Ledge Atr e pattern

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

    Salve, vorrei fare delle modifiche ad un indicatore di massimi e minimi giornalieri con dei pattern se è possibile,

    vorrei togliere i livelli di massimi e minimi giornalieri e sostituire a loro posto i livelli volatilità ATR  chiamato ledge atr, per il resto vorrei lasciare tutto uguale

    Riporto i codici sotto.

    Grazie

     

    //parameters
    enableshootingstar=1
    enablehammer=1
    enablereversalhigh=1
    enablereversallow=1
    //VolumeCheck=1
    //MinSize=10 //size in points
    nbcandle=5 //number of candle for the relative price verification
    
    
    
    //Shooting star
    //1. this candle follows a bearish signal
    //2. follows the calculation formula
    if enableshootingstar then
    Sc1=High=Highest[5](High)
    Sc2=Close < (Low+((High-Low)/3))
    Sc3=Open < (Low+((High-Low)/3))
    shootingstar=Sc1 and Sc2 and Sc3
    endif
    
    //Hammer
    //1. this candlestick follows a bullish signal
    // 2. it follows the calculation formula (mirroring that of a shooting star)
    if enablehammer=1 then
    Hc1=Low=Lowest[5](Low)
    Hc2=Close > High-((High-Low)/3)
    Hc3=Open > High-((High-Low)/3)
    hammer=Hc1 and Hc2 and Hc3
    endif
    //Reversal High
    //1. this candlestick follows a bearish signal
    if enablereversalhigh=1 then
    RHc1=High=Highest[5](High)
    RHc2=Close < Close[1]
    reversalhigh=RHc1 and RHc2
    endif
    
    //Reversal Low
    //1. this candle follows a bullish signal
    if enablereversallow=1 then
    RLc1=Low=Lowest[5](Low)
    RLc2=Close > Close[1]
    reversallow=RLc1 and RLc2
    endif
    
    if VolumeCheck=1 then
    volumeVerification = Volume[1]=Highest[5](Volume)[1]
    //volumeVerification = High[1]=Highest[5](High)[1]
    else
    volumeVerification=1
    endif
    
    //Size check
    sizeVerification=high[1]-low[1] >= minsize*pointsize
    //Relative maximum/minimum verification
    MaxVerification=high > highest[nbcandle](high[1]) //for bullish signal
    MinVerification=low < lowest[nbcandle](low[1]) // for bearish signal
    
    //price level
    currMax = dhigh(0)[1]
    currMin = dlow(0)[1]
    price1=dhigh(1)
    price2=dhigh(2)
    price3=dlow(1)
    price4=dlow(2)
    //checkprice=(high crosses over price1 and high > price1+5*pointsize) or (high crosses over price2 and high > price2*5*pointsize) or (high crosses over price3 and high > price3*5*pointsize) or (high crosses over price4 and high > price4*5*pointsize) or (low crosses under price1 and low < price1-5*pointsize) or (low crosses under price2 and low < price2-5*pointsize) or (low crosses under price3 and low < price3-5*pointsize) or (low crosses under price4 and low < price4-5*pointsize)
    if HighLowCheck then
    //checkprice=(high crosses over price1) or (high crosses over price2) or (high crosses over price3) or (high crosses over price4) or (low crosses under price1) or (low crosses under price2) or (low crosses under price3) or (low crosses under price4)
    checkpriceDH0=(high[1] >= currMax and low[1] <= currMax)
    checkpriceDL0=(high[1] >= currMin and low[1] <= currMin)
    checkpriceDH1=(high[1] >= price1 and low[1] <= price1)
    checkpriceDH2=(high[1] >= price2 and low[1] <= price2)
    checkpriceDL1=(high[1] >= price3 and low[1] <= price3)
    checkpriceDL2=(high[1] >= price4 and low[1] <= price4)
    checkprice=(checkpriceDH0 or checkpriceDL0) and (checkpriceDH1 or checkpriceDH2 or checkpriceDL1 or checkpriceDL2)
    else
    checkprice=1
    endif
    SSHm=0
    RHRL=0
    allPattern = 0
    if barindex>20 then
    SSHm=0
    RHRL=0
    //display
    if shootingstar[1] then
    DRAWTEXT("S", barindex[1], high) coloured (255,0,0)
    SSHm = 1
    endif
    if hammer[1] then
    DRAWTEXT("H", barindex[1], low) coloured (0,255,0)
    SSHm=-1
    endif
    //if reversalhigh and sizeverification and MinVerification and  checkprice then
    if reversalhigh[1] then
    DRAWTEXT("RH", barindex[1], high) coloured (255,0,0)
    RHRL=1
    endif
    //if reversallow and sizeverification and MaxVerification and  checkprice then
    if reversallow[1] then
    DRAWTEXT("RL", barindex[1], low) coloured (0,255,0)
    RHRL=-1
    endif
    
    
    endif
    if (SSHm = 1 or SSHm=-1 or RHRL=1 or RHRL=-1) and (sizeVerification and checkprice and volumeVerification) then
    allPattern = 1
    endif
    return SSHm COLOURED (255, 0, 0) as "ShootingStar or Hammer", RHRL COLOURED (0, 255, 0) as "Reversal", sizeVerification as "SizeVer", high-low as "Size", volumeVerification as "VolumeVer" , checkpriceDH0 as "DH0",checkpriceDL0 as "DL0", checkpriceDH1 as "DH1", checkpriceDH2 as "DH2", checkpriceDL1 as "DL1", checkpriceDL2 as "DL2", allPattern COLOURED (0, 0, 255) as "All"//, barindex
    //return BarIndex

    l’altro indicatore chiamato Ledge ATR è il seguente

    defparam drawonlastbaronly=true
    
    // --- parameters
    ATRperiod = 20
    // ---
    
    dTR = 0
    for i = 0 to ATRperiod
    dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
    next
    
    avg = dTR/ATRperiod
    converted = round(avg/pointsize*10)/10
    
    htr = Dlow(0)+avg[1]
    ltr = Dhigh(0)-avg[1]
    
    if intradaybarindex=0 then
    begin=barindex
    endif
    
    drawsegment(begin,htr,barindex,htr) coloured(200,100,0)
    drawsegment(begin,htr+20*pointsize,barindex,htr+20*pointsize) coloured(200,100,0)
    drawtext("#htr# - (D1atr: #converted#)",barindex,htr+10*pointsize,Dialog,Bold,10) coloured(200,100,0)
    drawsegment(begin,ltr,barindex,ltr) coloured(200,100,0)
    drawsegment(begin,ltr-20*pointsize,barindex,ltr-20*pointsize) coloured(200,100,0)
    drawtext("#ltr# - (D1atr: #converted#)",barindex,ltr-10*pointsize,Dialog,Bold,10) coloured(200,100,0)
    drawsegment(begin,Dopen(0),barindex,Dopen(0)) coloured(255,140,0)
    
    return
    
    #213956 quote
    robertogozzi
    Moderator
    Master

    Nel primo sarebbero da togliere i dati delle variabili CHECKPRICEXXX?

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

Indicatore Ledge Atr e pattern


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Fabry11 @hit-man Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
2 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 03/25/2023
Status: Active
Attachments: No files
Logo Logo
Loading...