gravityflyer
New member
Hi all,
I created a MTF lower indicator for the CCI.
It works exactly as intended, but kindly requesting assistance with two slight modifications to the existing code:
I created a MTF lower indicator for the CCI.
It works exactly as intended, but kindly requesting assistance with two slight modifications to the existing code:
- How can I condense the spacing between each row of dots? Even if I resize the lower window in ToS there still seems to be a limit of how closely I can squish the dots together.
- I'd like the indicator title (circled in blue) to be red if all three lines of dots are red, and green if all three lines of dots are green.
Code:
#MTF_CCI_LowerStudy_Dots
# gravityflyer
# v1.0 - 2021.09.23
declare lower;
input timeFrameOne = AggregationPeriod.TWO_MIN;
input timeFrameTwo = AggregationPeriod.FIVE_MIN;
input timeFrameThree = AggregationPeriod.FIFTEEN_MIN;
input length = 14;
#CCI Two Minutes
def priceTWO_MIN = close(period = timeFrameOne) + low(period = timeFrameOne) + high(period = timeFrameOne);
def linDev2 = lindev(priceTWO_MIN, length);
def CCI_2 = if linDev2 == 0 then 0 else (priceTWO_MIN - Average(priceTWO_MIN, length)) / linDev2 / 0.015;
#CCI Five Minutes
def priceFIVE_MIN = close(period = timeFrameTwo) + low(period = timeFrameTwo) + high(period = timeFrameTwo);
def linDev5 = lindev(priceFIVE_MIN, length);
def CCI_5 = if linDev5 == 0 then 0 else (priceFIVE_MIN - Average(priceFIVE_MIN, length)) / linDev5 / 0.015;
#CCI Fifteen Minutes
def priceFIFTEEN_MIN = close(period = timeFrameThree) + low(period = timeFrameThree) + high(period = timeFrameThree);
def linDev15 = lindev(priceFIFTEEN_MIN, length);
def CCI_15 = if linDev15 == 0 then 0 else (priceFIFTEEN_MIN - Average(priceFIFTEEN_MIN, length)) / linDev15 / 0.015;
#Row 1
plot rowOne = if IsNaN(close) then Double.NaN else 1;
rowOne.SetPaintingStrategy(PaintingStrategy.POINTS);
rowOne.AssignValueColor(if CCI_2 > 0 then Color.GREEN else Color.RED);
rowOne.SetLineWeight(3);
#Row 2
plot rowTwo = if IsNaN(close) then Double.NaN else 2;
rowTwo.SetPaintingStrategy(PaintingStrategy.POINTS);
rowTwo.AssignValueColor(if CCI_5 > 0 then Color.GREEN else Color.RED);
rowTwo.SetLineWeight(3);
#Row 3
plot rowThree = if IsNaN(close) then Double.NaN else 3;
rowThree.SetPaintingStrategy(PaintingStrategy.POINTS);
rowThree.AssignValueColor(if CCI_15 > 0 then Color.GREEN else Color.RED);
rowThree.SetLineWeight(3);