therecluse
New member
Found this code on the forums, works good for what I want, but right now the cloud color is pre-set to "RED" and "GREEN". Any way to add a color selector to the code?
declare lower;
input length = 25;
Assert(length > 0, "'length' must be positive: " + length);
plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;
Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));
AddCloud(if Up > 95 and Down < 5 then Up else Double.NEGATIVE_INFINITY, if Up > 95 and Down < 5 then Down else Double.NEGATIVE_INFINITY,color.RED);
AddCloud(if Up < 5 and Down > 95 then Down else Double.NEGATIVE_INFINITY, if Up < 5 and Down > 95 then UP else Double.NEGATIVE_INFINITY, color.GREEN);
declare lower;
input length = 25;
Assert(length > 0, "'length' must be positive: " + length);
plot Up = (length - 1 - GetMaxValueOffset(high, length)) * 100.0 / (length - 1);
plot Down = (length - 1 - GetMinValueOffset(low, length)) * 100.0 / (length - 1);
plot OverBought = 70;
plot OverSold = 30;
Up.SetDefaultColor(GetColor(1));
Down.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(8));
OverSold.SetDefaultColor(GetColor(8));
AddCloud(if Up > 95 and Down < 5 then Up else Double.NEGATIVE_INFINITY, if Up > 95 and Down < 5 then Down else Double.NEGATIVE_INFINITY,color.RED);
AddCloud(if Up < 5 and Down > 95 then Down else Double.NEGATIVE_INFINITY, if Up < 5 and Down > 95 then UP else Double.NEGATIVE_INFINITY, color.GREEN);