Traders Reality PVSRA Volume Suite For ThinkOrSwim

jagat

New member
This indicator employs Price, Volume, Support, Resistance Analysis (PVSRA), to analyze price movements, volume, support, and resistance levels to identify potential trading opportunities

PdgxlFX.png



Original Tradingview code:
https://www.tradingview.com/script/UcbR9FIH-Traders-Reality-PVSRA-Volume-Suite/
New ToS code in post below
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

PVSRA tradingview to thinkscript with price bars colored
https://se.tradingview.com/script/UcbR9FIH-Traders-Reality-PVSRA-Volume-Suite/

or similar

PVA Candles and Volumes to thinkscript
https://www.tradingview.com/v/WfUJCZjK/

thank u
check the below:

CSS:
#// Indicator for TOS
#// Original by infernix, library integration by peshocore
#// Please note while the code is open source and you are free to use it however you like - the 'Traders Reality' name is not - ie if you produce derivatives of this
#// source code you to name those scripts using "Traders Reality", "Pattern Watchers" or any other name that relates to Traders Reality in any way.
#indicator(title = 'Traders Reality PVSRA Volume Suite', shorttitle='TR_PVSRA_VS'
# Converted by Sam4Cok@Samer800    - 09/2024
declare lower;
declare weak_volume_dependency;

input alerts   = yes;
input alertType   = Alert.BAR;
input alertSound  = Sound.NoSound;
input CandleColors = no; # 'Set PVSRA candle colors?'
input timeframe = AggregationPeriod.MIN;
input displayVolMovAvg = no; #(false, 'Volume MA', inline="vma")
input movAvgPeriod = 20; #,"MA Period", minval=1, maxval=2000, step=1, inline="vma")
input OverrideChartSymbol = {default "No", "Yes"}; # Override chart symbol?'
input pvsraOverrideSymbol = "SPY"; # 'PVSRA Override'


def na = Double.NaN;
def last = IsNaN(close);
def current = GetAggregationPeriod();
def tf = Max(current, timeframe);
#-- Colors
DefineGlobalColor("highP", Color.GREEN);
DefineGlobalColor("highN", Color.RED);
DefineGlobalColor("midP", CreateColor(33, 150, 243));
DefineGlobalColor("midN", CreateColor(224, 64, 251));
DefineGlobalColor("lowP", Color.GRAY);
DefineGlobalColor("lowN", Color.DARK_GRAY);
def pvsraVolume;
def pvsraHigh;
def pvsraLow;
def pvsraClose;
def pvsraOpen;
switch (OverrideChartSymbol) {
case "Yes" :
    pvsraVolume = volume(Symbol = pvsraOverrideSymbol, period = tf);
    pvsraHigh   = high(Symbol = pvsraOverrideSymbol, period = tf);
    pvsraLow    = low(Symbol = pvsraOverrideSymbol, period = tf);
    pvsraClose  = close(Symbol = pvsraOverrideSymbol, period = tf);
    pvsraOpen   = open(Symbol = pvsraOverrideSymbol, period = tf);
default :
    pvsraVolume = volume(period = tf);
    pvsraHigh   = high(period = tf);
    pvsraLow    = low(period = tf);
    pvsraClose  = close(period = tf);
    pvsraOpen   = open(period = tf);
}

def smaVol = Average(pvsraVolume , movAvgPeriod);
def averageVolume = Sum(pvsraVolume[1], 10) / 10.0;
def volumeSpread = pvsraVolume * (pvsraHigh - pvsraLow);
def highestVolumeSpread = Highest(volumeSpread[1], 10);
def pvsraColor; # = na
def alertFlag; # = false
if pvsraVolume >= 2 * averageVolume or volumeSpread >= highestVolumeSpread {
    pvsraColor = if pvsraClose > pvsraOpen then 3 else -3;
    alertFlag = 2;
} else if pvsraVolume >= 1.5 * averageVolume {
    pvsraColor = if pvsraClose > pvsraOpen then 2 else -2;
    alertFlag = 1;
} else {
    pvsraColor = if pvsraClose > pvsraOpen then 1 else -1;
    alertFlag = 0;
}

#---- Alerts

Alert(alerts and alertFlag==2, "High Volume!", alertType, alertSound);
Alert(alerts and alertFlag==1, "Medium Volume!", alertType, alertSound);

#-- Plots
plot volMovAvg = if displayVolMovAvg then smaVol else na; #, title="Volume MA"
plot pvsraVol = pvsraVolume; # "PVSRA Volume"
volMovAvg.SetDefaultColor(Color.CYAN);
pvsraVol.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
pvsraVol.AssignValueColor(if pvsraColor == 3 then GlobalColor("highP") else
                          if pvsraColor == -3 then GlobalColor("highN") else
                          if pvsraColor == 2 then GlobalColor("midP") else
                          if pvsraColor == -2 then GlobalColor("midN") else
                          if pvsraColor == 1 then GlobalColor("lowP") else
                          if pvsraColor == -1 then GlobalColor("lowN") else Color.GRAY);
AssignPriceColor(if !CandleColors then Color.CURRENT else
                 if pvsraColor == 3 then GlobalColor("highP") else
                 if pvsraColor == -3 then GlobalColor("highN") else
                 if pvsraColor == 2 then GlobalColor("midP") else
                 if pvsraColor == -2 then GlobalColor("midN") else
                 if pvsraColor == 1 then GlobalColor("lowP") else
                 if pvsraColor == -1 then GlobalColor("lowN") else Color.GRAY);
# End of Code
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
301 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top