Good day guys, new to coding and attempted to create a ribbon trend bar.
What I am struggling is that there seem to be an overlap between the short and long with the indecision condition. Causing the bar of the indecision to be halved in appearance.
Appreciate anyhelp I can get
Thanks
// Trend_Bar
//
// Weighted Moving Average (WMA) SETTINGS
timeframe(1 day)
WMA50 = WeightedAverage[50](close)
WMA150 = WeightedAverage[150](close)
// CONDITIONS
LONG = Close > WMA150 AND Close >WMA50
SHORT = Close < WMA150 AND Close < WMA50
INDECISION = close > WMA50 AND close < WMA150 OR close < WMA50 AND close > WMA150
// EMA BAND COLORS
If LONG Then
r = 0
g = 255
b = 0
Elsif SHORT THEN
r = 255
g = 0
b = 0
ELSIF INDECISION THEN
r = 168
g = 168
b = 168
EndIf
// RETURN VALUES FOR VISUALIZATION
RETURN r AS "Short", g AS "Long", b AS "Indecision"
JSParticipant
Senior
Hi,
Do you mean something like this…?
// Trend_Bar
//
// Weighted Moving Average (WMA) SETTINGS
timeframe(1 day)
WMA50 = WeightedAverage[50](close)
WMA150 = WeightedAverage[150](close)
// CONDITIONS
LONG = Close > WMA150 AND Close >WMA50
SHORT = Close < WMA150 AND Close < WMA50
INDECISION = close > WMA50 AND close < WMA150 OR close < WMA50 AND close > WMA150
// EMA BAND COLORS
If LONG Then
xLong=1
else
xLong=0
EndIf
if SHORT THEN
xShort=1
else
xShort=0
EndIf
IF INDECISION THEN
xIndecision=1
else
xIndecision=0
EndIf
//// EMA BAND COLORS
//If LONG Then
//r = 0
//g = 255
//b = 0
//Elsif SHORT THEN
//r = 255
//g = 0
//b = 0
//ELSIF INDECISION THEN
//r = 168
//g = 168
//b = 168
//EndIf
// RETURN VALUES FOR VISUALIZATION
RETURN xLong coloured("Green")Style(Histogram),xShort coloured("Red")Style(Histogram),xIndecision coloured("White")Style(Histogram)
Ok worked out my issue.
I do however have another problem with my code.
What I’m attempting to do is view the daily trend over the four hour chart. Am I using the MTF properly as it appear blank on some four hour charts.
Hi JS
Yes exactly like that. Thanks!