CONFLUENCE CANDLE-PINE SCRIPT TRADINGVIEW

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #187018 quote
    giadelogiadelo
    Participant
    Junior

    This indicator looks for confluence among three indicators ( RSI , Stochastic , and MACD ), a strategy popularized by Markus Heitkoetter in his book, “The PowerX Strategy: How to Trade Stocks and Options in Only 15 Minutes a Day”, and expands it to look for agreement on up to four symbols.

    Each indicator is configurable in the settings, as well as the ability to choose which of the indicators are used.

    Default Logic
    Green Candles
    RSI > 50
    Stochastic > 50
    MACD Histogram > 0

    Red Candles
    RSI < 50
    Stochastic < 50
    MACD Histogram
    k = sma(stoch(close, high, low, periodK), smoothK)
    d = sma(k, periodD)
    output = useStochD ? d : k

    confluence() =>
    [_, _, histLine] = macd(close, macdFastLength, macdSlowLength, macdSignalLength)
    rsiLine = rsi(close, rsiLength)
    stochLine = stochastic(periodK, smoothK, periodD)
    histBull = includeMacdHist ? histLine > 0 : true
    histBear = includeMacdHist ? histLine rsiBullThreshold : true
    rsiBear = includeRsi ? rsiLine stochBullThreshold : true
    stochBear = includeStoch ? stochLine < stochBearThreshold : true
    signal = histBull and rsiBull and stochBull and not confluenceKillSwitch ? 1 : histBear and rsiBear and stochBear and not confluenceKillSwitch ? -1 : 0

    confluenceSymbol1 = useCurrentChartAsSymbol1 ? confluence() : security(symbol1, "", confluence())
    confluenceSymbol2 = security(symbol2, "", confluence())
    confluenceSymbol3 = security(symbol3, "", confluence())
    confluenceSymbol4 = security(symbol4, "", confluence())

    symbol1BullFilter = includeSymbol1 ? confluenceSymbol1 == 1 : true
    symbol1BearFilter = includeSymbol1 ? confluenceSymbol1 == -1 : true

    symbol2BullFilter = includeSymbol2 ? confluenceSymbol2 == 1 : true
    symbol2BearFilter = includeSymbol2 ? confluenceSymbol2 == -1 : true

    symbol3BullFilter = includeSymbol3 ? confluenceSymbol3 == 1 : true
    symbol3BearFilter = includeSymbol3 ? confluenceSymbol3 == -1 : true

    symbol4BullFilter = includeSymbol4 ? confluenceSymbol4 == 1 : true
    symbol4BearFilter = includeSymbol4 ? confluenceSymbol4 == -1 : true

    bullish = symbol1BullFilter and symbol2BullFilter and symbol3BullFilter and symbol4BullFilter and not killSwitch
    bearish = symbol1BearFilter and symbol2BearFilter and symbol3BearFilter and symbol4BearFilter and not killSwitch

    barcolor(bullish ? #00FF00 : bearish ? #FF0000 : color.gray)

    // Alerts
    greenCandleAlerts = input(true, "Alerts for candle color changing to GREEN", group="Alerts")
    redCandleAlerts = input(true, "Alerts for candle color changing to RED", group="Alerts")
    grayCandleAlerts = input(true, "Alerts for candle color changing to GRAY", group="Alerts")

    if (greenCandleAlerts and bullish and not bullish[1])
    alert("Candle color changed to GREEN", alert.freq_once_per_bar_close)

    if (redCandleAlerts and bearish and not bearish[1])
    alert("Candle color changed to RED", alert.freq_once_per_bar_close)

    if (grayCandleAlerts and not bullish and not bearish and (bullish[1] or bearish[1]))
    alert("Candle color changed to GRAY", alert.freq_once_per_bar_close)

    confluence-candles-code.docx
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

CONFLUENCE CANDLE-PINE SCRIPT TRADINGVIEW


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
giadelo @giadelo Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 01/29/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...