netarchitech
Well-known member
Given the following normalizing script:
Is there a way to create an unbounded Max input while the Min input remains at zero? Essentially I want to take input Max = 100; and remove the 100 limitation to provide for max values well in excess of 100...
For example, let's say I need to normalize a Volume plot...a Max input value of 100 is obviously not going to cut it. If I hard-code in an arbitrary amount...say 1,000,000...I'll be capping the Volume and preventing the proper display of any values in excess of 1,000,000...
There are a number of volume values above in excess of 1,000,000 being cut off..Do you think there might be a workaround?
Thanks in advance for your time and anticipated potential feedback/solution to this matter. It is much appreciated
Code:
script normalizePlot {
input data = close;
input Min = 0;
input Max = 100;
input length = 50;
def hhData = Highest(data, length);
def llData = Lowest(data, length);
plot resized = (((Max - Min) * (data - llData)) /
(hhData - llData)) + Min;
}
Is there a way to create an unbounded Max input while the Min input remains at zero? Essentially I want to take input Max = 100; and remove the 100 limitation to provide for max values well in excess of 100...
For example, let's say I need to normalize a Volume plot...a Max input value of 100 is obviously not going to cut it. If I hard-code in an arbitrary amount...say 1,000,000...I'll be capping the Volume and preventing the proper display of any values in excess of 1,000,000...
Code:
declare lower;
script normalizePlot {
input data = close;
input Min = 0;
input Max = 1000000;
input length = 50;
def hhData = Highest(data, length);
def llData = Lowest(data, length);
plot resized = (((Max - Min) * (data - llData)) /
(hhData - llData)) + Min;
}
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
# Unfilled Gap down: Use prior close as high
def equivHi = if H < C[1] then C[1] else H;
# Unfilled Gap up: Use prior close as low
def equivLo = if L > C[1] then C[1] else L;
def Buying2 = Round(V * (C - equivLo) / (equivHi - equivLo), 0);
def Selling2 = Round(V * (equivHi - C) / (equivHi - equivLo), 0);
# Selling Volume
plot SV2 = normalizePlot(Selling2);
SV2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SV2.SetDefaultColor(CreateColor(0, 82, 184));
SV2.SetLineWeight(1);
#SV2.hide();
# Buying Volume
plot BV2 = normalizePlot(Buying2);
BV2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BV2.SetDefaultColor(CreateColor(0, 182, 254));
BV2.SetLineWeight(5);
#BV2.hide();
There are a number of volume values above in excess of 1,000,000 being cut off..Do you think there might be a workaround?
Thanks in advance for your time and anticipated potential feedback/solution to this matter. It is much appreciated