OPEN-SOURCE SCRIPT
Small Caps - Range + Breakout (dernier seulement)

//version=5
indicator("Small Caps - Range + Breakout (dernier seulement)", overlay=true)
// -------------------
// Paramètres
// -------------------
lookback = input.int(50, "Période max du range (jours)")
minConsol = input.int(20, "Consolidation minimale (jours)")
volLen = input.int(20, "Période moyenne volume")
volMult = input.float(1.5, "Volume minimum (x moyenne)")
useRSI = input.bool(true, "Filtrer avec RSI > 55 ?")
rsiLength = input.int(14, "RSI période")
// -------------------
// Détection du Range
// -------------------
rangeHigh = ta.highest(high[1], lookback)
rangeLow = ta.lowest(low[1], lookback)
// Vérifier consolidation minimale
consolHigh = ta.highest(high[1], minConsol)
consolLow = ta.lowest(low[1], minConsol)
consolOk = (consolHigh <= rangeHigh) and (consolLow >= rangeLow)
// -------------------
// Conditions breakout
// -------------------
volMa = ta.sma(volume, volLen)
volOk = volume > volMult * volMa
rsi = ta.rsi(close, rsiLength)
rsiOk = useRSI ? rsi > 55 : true
breakoutUp = close > rangeHigh and volOk and rsiOk and consolOk
breakoutDown = close < rangeLow and volOk and rsiOk and consolOk
// -------------------
// Rectangle unique
// -------------------
var box rangeBox = na
if barstate.islast
if not na(rangeBox)
box.delete(rangeBox)
// Couleur par défaut (range gris)
rectColor = color.new(color.gray, 85)
borderCol = color.new(color.gray, 0)
// Modifier couleur si cassure
if breakoutUp
rectColor := color.new(color.green, 85)
borderCol := color.new(color.green, 0)
if breakoutDown
rectColor := color.new(color.red, 85)
borderCol := color.new(color.red, 0)
// Créer rectangle du range courant sur une seule ligne
rangeBox := box.new(left=bar_index - lookback, top=rangeHigh, right=bar_index, bottom=rangeLow, border_color=borderCol, border_width=1, bgcolor=rectColor)
// -------------------
// Flèches breakout
// -------------------
plotshape(breakoutUp, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny)
plotshape(breakoutDown, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)
indicator("Small Caps - Range + Breakout (dernier seulement)", overlay=true)
// -------------------
// Paramètres
// -------------------
lookback = input.int(50, "Période max du range (jours)")
minConsol = input.int(20, "Consolidation minimale (jours)")
volLen = input.int(20, "Période moyenne volume")
volMult = input.float(1.5, "Volume minimum (x moyenne)")
useRSI = input.bool(true, "Filtrer avec RSI > 55 ?")
rsiLength = input.int(14, "RSI période")
// -------------------
// Détection du Range
// -------------------
rangeHigh = ta.highest(high[1], lookback)
rangeLow = ta.lowest(low[1], lookback)
// Vérifier consolidation minimale
consolHigh = ta.highest(high[1], minConsol)
consolLow = ta.lowest(low[1], minConsol)
consolOk = (consolHigh <= rangeHigh) and (consolLow >= rangeLow)
// -------------------
// Conditions breakout
// -------------------
volMa = ta.sma(volume, volLen)
volOk = volume > volMult * volMa
rsi = ta.rsi(close, rsiLength)
rsiOk = useRSI ? rsi > 55 : true
breakoutUp = close > rangeHigh and volOk and rsiOk and consolOk
breakoutDown = close < rangeLow and volOk and rsiOk and consolOk
// -------------------
// Rectangle unique
// -------------------
var box rangeBox = na
if barstate.islast
if not na(rangeBox)
box.delete(rangeBox)
// Couleur par défaut (range gris)
rectColor = color.new(color.gray, 85)
borderCol = color.new(color.gray, 0)
// Modifier couleur si cassure
if breakoutUp
rectColor := color.new(color.green, 85)
borderCol := color.new(color.green, 0)
if breakoutDown
rectColor := color.new(color.red, 85)
borderCol := color.new(color.red, 0)
// Créer rectangle du range courant sur une seule ligne
rangeBox := box.new(left=bar_index - lookback, top=rangeHigh, right=bar_index, bottom=rangeLow, border_color=borderCol, border_width=1, bgcolor=rectColor)
// -------------------
// Flèches breakout
// -------------------
plotshape(breakoutUp, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny)
plotshape(breakoutDown, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.tiny)
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.