Conversion from TRading View to PRT :Buy and Sell Alerts using VWAP

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #241445 quote
    IASDIASD
    Participant
    Senior

    Hello..

    Nicolas, Ivan and other experts,

    could you please convert this trading view indicator to ProRealTime : Buy and Sell Alerts using VWAP ?

    I think the Alerts cannot be programmed in PRT
    So, it is enough for me to convert it to an indicator only

    I hope that the buy and sell signal
    Have the option to add or delete from the chart as needed

    I think this indicator will benefit everyone,

    Thanks in advance

     

    https://ar.tradingview.com/script/HJyXKmit-Buy-and-Sell-Alerts-using-VWAP/

     

     

    // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © thisgirl

    //@version=5
    indicator(“Custom VWAP and MA Alerts”, overlay=true)

    // Input for selecting moving averages
    show_vwap = input(true, title=”Show VWAP”)
    show_9ema = input(false, title=”Show 9 EMA”)
    show_10sma = input(false, title=”Show 10 SMA”)
    show_50sma = input(false, title=”Show 50 SMA”)
    show_100sma = input(false, title=”Show 100 SMA”)
    show_200sma = input(false, title=”Show 200 SMA”)
    show_325sma = input(false, title=”Show 325 SMA”)

    // Input for volume threshold
    volume_threshold = input(0, title=”Volume threshold”)

    // Calclulate moving averages
    vwap = ta.vwap
    ema9 = ta.ema(close, 9)
    sma10 = ta.sma(close, 10)
    sma20 = ta.sma(close, 20)
    sma50 = ta.sma(close, 50)
    sma100 = ta.sma(close, 100)
    sma200 = ta.sma(close, 200)
    sma325 = ta.sma(close, 325)

    // Plot moving averages based on user input
    plot(show_vwap ? vwap : na, title=”VWAP”, color = color.blue)
    plot(show_9ema ? ema9 : na, title=”9 EMA”, color = color.orange)
    plot(show_10sma ? sma10 : na, title=”10 SMA”, color = color.purple)
    plot(show_50sma ? sma50 : na, title=”50 SMA”, color = color.green)
    plot(show_100sma ? sma100 : na, title=”100 SMA”, color = color.yellow)
    plot(show_200sma ? sma200 : na, title=”200 SMA”, color = color.red)
    plot(show_325sma ? sma325 : na, title=”325 SMA”, color = color.gray)

    // Buy and sell conditions based on crossing VWAP and volume threshold
    crossAboveVWAP = ta.crossover(close, vwap) and volume > volume_threshold
    crossBelowVWAP = ta.crossunder(close, vwap) and volume > volume_threshold

    // Plot buy and sell signals
    plotshape(series=crossAboveVWAP, location=location.belowbar, color = color.green, style=shape.labelup, title=”Buy Signal”, text=”BUY”)
    plotshape(series=crossBelowVWAP, location=location.abovebar, color = color.red, style=shape.labeldown, title=”Sell Signal”, text=”SELL”)

    // Alerts
    alertcondition(crossAboveVWAP, title=”Buy Alert”, message=”Price crossed above VWAP with volume threshold met”)
    alertcondition(crossBelowVWAP, title=”Sell Alert”, message=”Price closed below VWAP with volume threshold met”)

    #241473 quote
    Iván GonzálezIván González
    Moderator
    Legend

    Hi! here you have it:

    //------------------------------------------//
    //PRC_Custom Vwap and MA alerts
    //version = 0
    //16.12.2024
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //------------------------------------------//
    // inputs
    //------------------------------------------//
    showAvg=1
    volumeThreshold=0
    //------------------------------------------//
    // Daily Vwap
    //------------------------------------------//
    if day<>day[1] then
    d=1
    VWAP=typicalprice
    else
    d=d+1
    if volume > 0 then
    VWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
    endif
    endif
    //------------------------------------------//
    // Moving averages
    //------------------------------------------//
    ema9=average[9,1](close)
    sma10=average[10](close)
    sma50=average[50](close)
    sma100=average[100](close)
    sma200=average[200](close)
    sma325=average[325](close)
    //------------------------------------------//
    // Plot moving averages
    //------------------------------------------//
    if showAvg=0 then
    ema9=undefined
    sma10=undefined
    sma50=undefined
    sma100=undefined
    sma200=undefined
    sma325=undefined
    endif
    //------------------------------------------//
    // Buy and Sell Conditions
    //------------------------------------------//
    crossAboveVwap=close crosses over vwap and volume>volumeThreshold
    crossBelowVwap=close crosses under vwap and volume>volumeThreshold
    
    if crossAboveVwap then
    drawtext("▲",barindex,low-averagetruerange[14](close))coloured("green")
    elsif crossBelowVwap then
    drawtext("▼",barindex,high+averagetruerange[14](close))coloured("red")
    endif
    //------------------------------------------//
    RETURN VWAP  as "VWAP"coloured("blue"), ema9 as "EMA9"coloured("orange"),sma10 as "SMA10"coloured("purple"),sma50 as "SMA50"coloured("green"),sma100 as "SMA10"coloured("yellow"),sma200 as "SMA200"coloured("red"),sma325 as "SMA325"coloured("grey")
    
    IASD thanked this post
    #241475 quote
    IASDIASD
    Participant
    Senior

    Thank you very much Mr. Ivan
    Great job

    my Regards,

Viewing 3 posts - 1 through 3 (of 3 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

Conversion from TRading View to PRT :Buy and Sell Alerts using VWAP


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
IASD @iasd Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by IASDIASD
1 year, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/15/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...