Hey there,
Im having trouble writing the proper code to differentiate between the different desired values I'd like displayed.
Below is the code Ive been working on thus far.
The bottom code in bold is what Ive been struggling with.
Everything works, I'd just like to have tick values that exceed +/- 700 paint a different color without negating the color assignment already in place.
Hope Ive explained this well enough, appreciate any help! Cheers.
##custom TICK indicator##
declare lower;
input hidecumtick = yes;
input hidemean = no;
input usetrend = { "No", default "Yes"};
input change_candle_colors = yes;
input symbol = "$TICK";
input period = 20;
input lookback = 4;
## Coding definitions ##
def p = period;
def i = BarNumber();
def na = Double.NaN;
def hi = high("$TICK");
def lo = low("$TICK");
def location = close;
## Code designed to record things at a specific place and time
rec htick = if IsNaN(high(symbol)) then htick[1] else high("$TICK") ;
rec ltick = if IsNaN(low(symbol)) then ltick[1] else low("$TICK");
rec avgh = if i == 1 then htick else Max(300, avgh[1] + 2 / (p + 1) * (htick - avgh[1]));
rec avgl = if i == 1 then ltick else Min(-300, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;
def average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
def average_hi = if IsNaN(close) then na else avgh;
def average_lo = if IsNaN(close) then na else avgl;
plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
hib.SetDefaultColor(Color.DARK_GRAY);
hib.SetLineWeight(3);
plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
lob.SetDefaultColor(Color.DARK_GRAY);
lob.SetLineWeight(3);
####CROSSOVA WORKS####
def ema1 = ExpAverage(close, 50);
def aboveavg = hi > average_hi;
def belowavg= lo < average_lo;
plot phi = hi;
phi.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
phi.AssignValueColor(if aboveavg then Color.DARK_GREEN else Color.light_orange);
##if hi >700 then color.green##
plot plo = lo;
plo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plo.AssignValueColor(if belowavg then CreateColor(250,10, 10) else color.light_orange);
###if lo < -700 then color.white###
Im having trouble writing the proper code to differentiate between the different desired values I'd like displayed.
Below is the code Ive been working on thus far.
The bottom code in bold is what Ive been struggling with.
Everything works, I'd just like to have tick values that exceed +/- 700 paint a different color without negating the color assignment already in place.
Hope Ive explained this well enough, appreciate any help! Cheers.
##custom TICK indicator##
declare lower;
input hidecumtick = yes;
input hidemean = no;
input usetrend = { "No", default "Yes"};
input change_candle_colors = yes;
input symbol = "$TICK";
input period = 20;
input lookback = 4;
## Coding definitions ##
def p = period;
def i = BarNumber();
def na = Double.NaN;
def hi = high("$TICK");
def lo = low("$TICK");
def location = close;
## Code designed to record things at a specific place and time
rec htick = if IsNaN(high(symbol)) then htick[1] else high("$TICK") ;
rec ltick = if IsNaN(low(symbol)) then ltick[1] else low("$TICK");
rec avgh = if i == 1 then htick else Max(300, avgh[1] + 2 / (p + 1) * (htick - avgh[1]));
rec avgl = if i == 1 then ltick else Min(-300, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;
def average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
def average_hi = if IsNaN(close) then na else avgh;
def average_lo = if IsNaN(close) then na else avgl;
plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
hib.SetDefaultColor(Color.DARK_GRAY);
hib.SetLineWeight(3);
plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
lob.SetDefaultColor(Color.DARK_GRAY);
lob.SetLineWeight(3);
####CROSSOVA WORKS####
def ema1 = ExpAverage(close, 50);
def aboveavg = hi > average_hi;
def belowavg= lo < average_lo;
plot phi = hi;
phi.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
phi.AssignValueColor(if aboveavg then Color.DARK_GREEN else Color.light_orange);
##if hi >700 then color.green##
plot plo = lo;
plo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plo.AssignValueColor(if belowavg then CreateColor(250,10, 10) else color.light_orange);
###if lo < -700 then color.white###