frankie.baumann

Fractals average breakout [FB]

My first indicator.
A simple average of last 1 to 10 fractals (top and bottom)
Trade breakouts of top or bottom lines.
Feel free to use and experiment with.
Frank Baumann
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
//
// @author frankie.baumann
//

study("Fractals average breakout [FB]",shorttitle="FAB",overlay=true)

LookBack = input(5,minval=1,maxval=10)
ShMid = input(true, type=bool, title = "Show Midline?")
ShFL = input(true, type=bool, title = "Show Fractal lines?")

th = high[2]>high[1] and high[2]>high and high[2]>high[3] and high[2]>high[4] ? -1 : 0

bl = low[2]<low[1] and low[2]<low and low[2]<low[3] and low[2]<low[4] ? 1 : 0

tot = th + bl
pl = abs(tot)>=1 ? 1 : 0

// plotarrow(pl==1 ? tot : na,colorup=green,colordown=red,offset=-2,maxheight=10)

lowline = (valuewhen(tot==1, low[2], 0) + (LookBack>1 ? valuewhen(tot==1, low[2], 1) : 0)
    + (LookBack>2 ? valuewhen(tot==1, low[2], 2) : 0) + (LookBack>3 ? valuewhen(tot==1, low[2], 3) : 0)
    + (LookBack>4 ? valuewhen(tot==1, low[2], 4) : 0) + (LookBack>5 ? valuewhen(tot==1, low[2], 5) : 0)
    + (LookBack>6 ? valuewhen(tot==1, low[2], 6) : 0) + (LookBack>7 ? valuewhen(tot==1, low[2], 7) : 0)
    + (LookBack>8 ? valuewhen(tot==1, low[2], 8) : 0) + (LookBack>9 ? valuewhen(tot==1, low[2], 9) : 0)
    )/LookBack
plot(ShFL ? lowline : na, style=line, linewidth=2, color=green) //, offset=-2)

highline = (valuewhen(tot==-1, high[2], 0) + (LookBack>1 ? valuewhen(tot==-1, high[2], 1) : 0)
    + (LookBack>2 ? valuewhen(tot==-1, high[2], 2) : 0) + (LookBack>3 ? valuewhen(tot==-1, high[2], 3) : 0)
    + (LookBack>4 ? valuewhen(tot==-1, high[2], 4) : 0) + (LookBack>5 ? valuewhen(tot==-1, high[2], 5) : 0)
    + (LookBack>6 ? valuewhen(tot==-1, high[2], 6) : 0) + (LookBack>7 ? valuewhen(tot==-1, high[2], 7) : 0)
    + (LookBack>8 ? valuewhen(tot==-1, high[2], 8) : 0) + (LookBack>9 ? valuewhen(tot==-1, high[2], 9) : 0)
    )/LookBack
plot(ShFL ? highline : na, style=line, linewidth=2, color=red)

MidLine = (highline+lowline)/2
plot(ShMid ? MidLine : na, style=line, linewidth=2)