RedToGreen
Active member
In the following study, it plots Green above zero and red below zero
Watchlist is supposed to signal if above zero and any new signals...i.e red yesterday, green today...Several that signaled today, 12-27, were good but a few others signaled long but on the chart study, it still shows Red. (MRNA)
Or
it will show a new long trigger on WL and previous day was green on chart.
It's suppose to only show a new "Today" Green with yesterday being red or vice versa.
There's various info the WL provides, the section I'm concerned with is the following...
"else if V51 crosses above 0 and RoC_S[1] then "NL++ "
"else if V51 crosses below 0 and RoC_L[1] then "NS++ "
Thanks for any help
Chart Code
[/CODE]
Watchlist is supposed to signal if above zero and any new signals...i.e red yesterday, green today...Several that signaled today, 12-27, were good but a few others signaled long but on the chart study, it still shows Red. (MRNA)
Or
it will show a new long trigger on WL and previous day was green on chart.
It's suppose to only show a new "Today" Green with yesterday being red or vice versa.
There's various info the WL provides, the section I'm concerned with is the following...
"else if V51 crosses above 0 and RoC_S[1] then "NL++ "
"else if V51 crosses below 0 and RoC_L[1] then "NS++ "
Thanks for any help
Chart Code
Code:
# 12-20-2023 RGMB Optimized
declare lower;
# Buying and Selling Volume
def buying = if isNaN(buying[1]) then volume * (close - low) / (high - low) else buying[1] + volume * (close - low) / (high - low);
def selling = if isNaN(selling[1]) then volume * (high - close) / (high - low) else selling[1] + volume * (high - close) / (high - low);
plot zero = 0;
zero.setlineWeight(2);
zero.setdefaultColor(color.DARK_GRAY);
# Multi-Bar Calculations
def buyvol5a = wildersAverage(buying, 5);
def sellvol5a = wildersAverage(selling, 5);
def buyVol5 = wildersAverage(buying, 7);
def buyVol10 = wildersAverage(buying, 12);
def sellVol5 = wildersAverage(selling, 7);
def sellVol10 = wildersAverage(selling, 12);
# Calculate the differences between buyvol5a, buyvol5, and buyvol10
def BuySellDiff5a = buyVol5a - sellVol5a;
def BuySellDiff5 = buyVol5 - sellVol5;
def BuySellDiff10 = buyVol10 - sellVol10;
def BuyTotals = buyvol5a + buyvol5 + buyvol10;
def SellTotals = sellvol5a + sellvol5 + sellvol10;
def BuyTotals_N_Periods = GetValue(Buytotals, 14);
def SellTotals_N_Periods = GetValue(Selltotals, 14);
# Calculate the Rate of Change (ROC) for buyvol5a and smooth using EMA
def roc_buyVol5a = ((BuyTotals - BuyTotals[1]) / (BuyTotals)) * 100;
def roc_sellVol5a = ((SellTotals - SellTotals[1]) / (SellTotals)) * 100;
def RoCDiff = roc_buyVol5a - roc_sellVol5a;
# Smooth the ROC signals using EMA
def length = 9;
def smooth_rocDiff = ExpAverage(RoCDiff, length);
def RoC_L = Smooth_rocDiff > zero;
def RoC_S = Smooth_rocDiff < zero;
#def NewRoC_L = RoC_L and !RoC_L[1];
#def NewRoC_S = RoC_S and !RoC_S[1];
def NewRoC_L = Smooth_rocDiff crosses above zero and !RoC_L[1];
def NewRoC_S = Smooth_rocDiff crosses below zero and RoC_S[1];
def RoCStatus = if RoC_L then 1 else if RoC_S then 2 else 0;
# Plot histogram based on the smoothed differences
plot V5a = Smooth_rocDiff;
V5a.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
V5a.HideTitle();
V5a.HideBubble();
V5a.SetLineWeight(4);
V5a.AssignValueColor(if rocStatus == 1 then CreateColor(33, 145, 72) else if rocstatus == 2 then CreateColor(159, 40, 45) else Color.DARK_GRAY);
###END
Watchlist code ---
[CODE]# 12-20-2023 RGMB Optimized
declare lower;
def ZeroL = 0;
# Buying and Selling Volume
def buying = if isNaN(buying[1]) then volume * (close - low) / (high - low) else buying[1] + volume * (close - low) / (high - low);
def selling = if isNaN(selling[1]) then volume * (high - close) / (high - low) else selling[1] + volume * (high - close) / (high - low);
# Multi-Bar Calculations
def buyvol5a = wildersAverage(buying, 5);
def sellvol5a = wildersAverage(selling, 5);
def buyVol5 = wildersAverage(buying, 7);
def buyVol10 = wildersAverage(buying, 12);
def sellVol5 = wildersAverage(selling, 7);
def sellVol10 = wildersAverage(selling, 12);
def buysellDiff5a = buyvol5a - sellVol5a;
def BuySellDiff5 = buyVol5 - sellVol5;
def BuySellDiff10 = buyVol10 - sellVol10;
def BuyTotals = buyvol5a + buyvol5 + buyvol10;
def SellTotals = sellvol5a + sellvol5 + sellvol10;
def BuyTotals_N_Periods = GetValue(Buytotals, 14);
def SellTotals_N_Periods = GetValue(Selltotals, 14);
# Calculate the Rate of Change (ROC) for buyvol5a and smooth using EMA
def roc_buyVol5a = ((BuyTotals - BuyTotals[1]) / (BuyTotals)) * 100;
def roc_sellVol5a = ((SellTotals - SellTotals[1]) / (SellTotals)) * 100;
def RoCDiff = roc_buyVol5a - roc_sellVol5a;
# Smooth the ROC signals using EMA
def length = 9;
def smooth_rocDiff = ExpAverage(RoCDiff, length);
def RoC_L = Smooth_rocDiff > ZeroL;
def RoC_S = Smooth_rocDiff < ZeroL;
#def NewRoC_L = RoC_L and !RoC_L[1];
#def NewRoC_S = RoC_S and !RoC_S[1];
def NewRoC_L = Smooth_rocDiff crosses above 0 and !RoC_L[1];
def NewRoC_S = Smooth_rocDiff crosses below 0 and !RoC_S[1];
def RoCStatus = if RoC_L then 1 else if RoC_S then 2 else 0;
# Plot Buy/Sell Difference
plot V5a = BuySellDiff5a;
plot V5 = BuySellDiff5;
plot V10 = BuySellDiff10;
def V5aLong = V5a > V5a[1];
def V5Long = V5 > V5[1];
def V10Long = V10 > V10[1];
def V5aShort = V5a < V5a[1];
def V5Short = V5 < V5[1];
def V10Short = V10 < V10[1];
def V_Long = V5aLong and V5Long and V10Long;
def V_Short = V5aShort and V5Short and V10Short;
def NewV_Long = V_Long and !V_Long[1];
def NewV_Short = V_Short and !V_Short[1];
# Background color
assignBackgroundColor(if V_Long and RoCStatus == 1 then createColor(14,84,45)
else if V_Short and RoCstatus == 2 then createColor(118,8,8)
else Color.DARK_GRAY);
# Plot histogram based on the smoothed differences
plot V51 = smooth_rocDiff;
V51.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
V51.HideTitle();
V51.HideBubble();
V51.SetLineWeight(4);
V51.AssignValueColor(if V51 > 0 then CreateColor(33, 145, 72) else if V51 < 0 then CreateColor(159, 40, 45) else Color.DARK_GRAY);
# Labels for Histograms
AddLabel(yes, if V5aLong and V10Short then "5L " + if RoCStatus == 1 then " L" else " S"
else if V5aShort and V10Long then "5S " + if RoCStatus == 1 then " L" else " S"
else if NewV_Long then "NL "
else if NewV_Short then "NS "
else if V51 crosses above 0 and RoC_S[1] then "NL++ "
else if V51 crosses below 0 and RoC_L[1] then "NS++ "
else if V_Long then "LV " + if RoCStatus == 1 then " L" else " S"
else if V_Short then "SV " + if RoCStatus == 1 then " L" else " S" else "_",
if V5aLong and V10Short then createColor(72,217,137)
else if V5aShort and V10Long then createColor(181,131,131)
else if NewV_Long then createColor(70,184,136)
else if NewV_Short then createColor(217,72,72)
else if V_Long then createColor(41,142,100)
else if V_Short then createColor(196,54,54)
else Color.DARK_GRAY);
[/CODE]
Last edited: