Adding horizontal dots as a lower study to dynamic MA?

O

oferwo

New member
VIP
Hello, I currently have a simple 9 EMA average script which dynamically changes the color when price above average and when below. Simple. However, in addition to it I'd like to add horizontal dots as a lower study that change colors too (green / red or similar) Not sure how. Any help super appreciated! This is my current code:


Code:
input price = close;
input length = 9;
input displace = 0;
input showBreakoutSignals = no;

plot AvgExp = ExpAverage(price[-displace], length);
plot UpSignal = price crosses above AvgExp;
plot DownSignal = price crosses below AvgExp;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

AvgExp.SetDefaultColor(GetColor(1));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

avgExp.AssignValueColor(if avgExp > avgExp[1] then color.light_green else Color.MAGENTA);

Here is an image of the dots I mean (the indicators on this image are unrelated to mine):

 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
Here you go:

Code:
declare lower;

input price = close;
input length = 9;
input displace = 0;

def AvgExp = ExpAverage(price[-displace], length);

plot Value = 1;

Value.AssignValueColor(if avgExp > avgExp[1] then color.light_green else Color.MAGENTA);
Value.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
 
T

tradebyday

Active member
@BenTen Is there a way to for it to be defined by the Heiken Ashi candle close instead of your standard bar close, while not having Heiken Ashi running on your chart?
 
T

tradebyday

Active member
@BenTen made a purely HA candle based one to start, still trying to figure out how to get the HA close value to be used as my price input on the moving avg study you posted https://tos.mx/y9MqTKu
 
T

tradebyday

Active member
Never mind @BenTen , I am a complete moron.... the ability is already built in to the indicator, just changed price input to (O+C+L+H)/4 in settings🤦‍♂️
 

Similar threads

Top