custom watchlist showing above/below 1st 15 min candle, RSI, and VWAP
Looking to create a watchlist field to show the following information:
Note: I have coding below that might help with the below but I have limited skills in making it all jive together.
If close of price is less than/below VWAP and below midpoint price of first 15 min candle and RSI number is negative 15 or more then color the box red.
Else the box can be color.white
Note the letters/number should be color.black for best visualization.
Appreciate your help in this.
Coding found in TOS from other scripts that might be helpful to code.
#####Vwap info####
def myVwap = Reference VWAP();
#####15 Min aggregation period #####
### 15m timeframe ###
def tf15m = AggregationPeriod.FIFTEEN_MIN;
def valid15m = GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN;
def h15m;
def l15m;
def o15m;
def c15m;
def grn15m;
def red15m;
def onebar15m;
def twobar15m;
def thrbar15m;
if valid15m {
h15m = high (period = tf15m)
l15m = low (period = tf15m);
o15m = open (period = tf15m);
c15m = close(period = tf15m);
onebar15m = h15m <= h15m[1] && l15m >= l15m[1];
twobar15m = h15m <= h15m[1] && l15m < l15m[1] or h15m > h15m[1] && l15m >= l15m[1];
thrbar15m = h15m > h15m[1] && l15m < l15m[1];
grn15m = o15m <= c15m;
red15m = o15m >= c15m;
} else {
h15m = 0;
l15m = 0;
o15m = 0;
c15m = 0;
grn15m = Double.NaN;
red15m = Double.NaN;
onebar15m = Double.NaN;
twobar15m = Double.NaN;
thrbar15m = Double.NaN;
}
####Midpoint candle code ####
input candletype = {default candle, heikinashi};
def HAclose = hlc3;
rec HAopen = CompoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh = Max( high, Max( HAopen, HAclose ) );
def HAlow = Min( low, Min( HAopen, HAclose ) );
plot Data = if candletype == candletype.heikinashi
then (HAhigh + HAlow) / 2
else hl2;
Data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Data.AssignValueColor(if Data > Data[1] then Color.GREEN else CreateColor(102, 0, 0));
Data.SetLineWeight(5);
###RSI Histogram Code####
declare lower;
input fastLength = 12;
input slowLength = 26;
input RSILength = 8;
input Multiplier = 1.5;
input Over_Sold = -20;
input Over_Bought = 20;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = yes;
plot Diff = (RSI(RSILength,100, 0, close) - 50) * multiplier;
# plot Diff = MACD(fastLength, slowLength, MACDLength, averageType).Diff;
plot UpSignal = if Diff crosses above 20 then 0 else Double.NaN;
plot DownSignal = if Diff crosses below 20 then 0 else Double.NaN;
plot OverSold = over_Sold;
plot OverBought = over_Bought;
# plot POverSold = P_over_Sold;
# plot POverBought = P_over_Bought;
plot Zzero = 0;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
Zzero.SetDefaultColor(Color.BLACK);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.RED);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.GREEN);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
###################
###ADDED CODE for SIGNALS
##########################
#DEF VOLBOMB = Diff > Diff[1];
#Plot bullish = volbomb;
#bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
#alert(bullish,”VOLBOMB”, alert.Bar, sound.ding);
Plot volbomb = diff > 20;
Looking to create a watchlist field to show the following information:
Note: I have coding below that might help with the below but I have limited skills in making it all jive together.
- Show the price of the midpoint of the first fifteen minute candle.
- Show where we are in relation to the first fifteen minute candles midpoint. So current price above first candle mid say “ Above Mid”. Current price below first candle mid say ”Below Mid”. Equal to “ “.
- Show RSI number. (Positive number as it is ex “15” if negative show negative sign ex. “-15”
If close of price is less than/below VWAP and below midpoint price of first 15 min candle and RSI number is negative 15 or more then color the box red.
Else the box can be color.white
Note the letters/number should be color.black for best visualization.
Appreciate your help in this.
Coding found in TOS from other scripts that might be helpful to code.
#####Vwap info####
def myVwap = Reference VWAP();
#####15 Min aggregation period #####
### 15m timeframe ###
def tf15m = AggregationPeriod.FIFTEEN_MIN;
def valid15m = GetAggregationPeriod() <= AggregationPeriod.FIFTEEN_MIN;
def h15m;
def l15m;
def o15m;
def c15m;
def grn15m;
def red15m;
def onebar15m;
def twobar15m;
def thrbar15m;
if valid15m {
h15m = high (period = tf15m)
l15m = low (period = tf15m);
o15m = open (period = tf15m);
c15m = close(period = tf15m);
onebar15m = h15m <= h15m[1] && l15m >= l15m[1];
twobar15m = h15m <= h15m[1] && l15m < l15m[1] or h15m > h15m[1] && l15m >= l15m[1];
thrbar15m = h15m > h15m[1] && l15m < l15m[1];
grn15m = o15m <= c15m;
red15m = o15m >= c15m;
} else {
h15m = 0;
l15m = 0;
o15m = 0;
c15m = 0;
grn15m = Double.NaN;
red15m = Double.NaN;
onebar15m = Double.NaN;
twobar15m = Double.NaN;
thrbar15m = Double.NaN;
}
####Midpoint candle code ####
input candletype = {default candle, heikinashi};
def HAclose = hlc3;
rec HAopen = CompoundValue( 1, ( HAopen[1] + HAclose[1] ) / 2, HAclose );
def HAhigh = Max( high, Max( HAopen, HAclose ) );
def HAlow = Min( low, Min( HAopen, HAclose ) );
plot Data = if candletype == candletype.heikinashi
then (HAhigh + HAlow) / 2
else hl2;
Data.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Data.AssignValueColor(if Data > Data[1] then Color.GREEN else CreateColor(102, 0, 0));
Data.SetLineWeight(5);
###RSI Histogram Code####
declare lower;
input fastLength = 12;
input slowLength = 26;
input RSILength = 8;
input Multiplier = 1.5;
input Over_Sold = -20;
input Over_Bought = 20;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = yes;
plot Diff = (RSI(RSILength,100, 0, close) - 50) * multiplier;
# plot Diff = MACD(fastLength, slowLength, MACDLength, averageType).Diff;
plot UpSignal = if Diff crosses above 20 then 0 else Double.NaN;
plot DownSignal = if Diff crosses below 20 then 0 else Double.NaN;
plot OverSold = over_Sold;
plot OverBought = over_Bought;
# plot POverSold = P_over_Sold;
# plot POverBought = P_over_Bought;
plot Zzero = 0;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
Zzero.SetDefaultColor(Color.BLACK);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.RED);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.GREEN);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
###################
###ADDED CODE for SIGNALS
##########################
#DEF VOLBOMB = Diff > Diff[1];
#Plot bullish = volbomb;
#bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
#alert(bullish,”VOLBOMB”, alert.Bar, sound.ding);
Plot volbomb = diff > 20;