SweatyMexican99
New member
input showZones = yes;
input length = 14;
def high = highest(high, length);
def low = lowest(low, length);
def mid = (high + low) / 2;
def buyingPressure = sum(volume * (close - low), length) / sum(volume, length);
def sellingPressure = sum(volume * (high - close), length) / sum(volume, length);
def dp = if buyingPressure > sellingPressure then 1 else -1;
plot demand;
if dp == 1 then {
demand = high;
} else {
demand = Double.NaN;
}
plot supply;
if dp == -1 then {
supply = low;
} else {
supply = Double.NaN;
}
demand.SetDefaultColor(Color.GREEN);
supply.SetDefaultColor(Color.RED);
demand.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
supply.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
if (!showZones) then {
demand.SetPaintingStrategy(PaintingStrategy.HIDDEN);
supply.SetPaintingStrategy(PaintingStrategy.HIDDEN);
}
It gives me this error on Thinkorswim, how do I fix this ?
Syntax error: An 'else' block expected at 32:1
Syntax error: Semicolon expected at 32:1
input length = 14;
def high = highest(high, length);
def low = lowest(low, length);
def mid = (high + low) / 2;
def buyingPressure = sum(volume * (close - low), length) / sum(volume, length);
def sellingPressure = sum(volume * (high - close), length) / sum(volume, length);
def dp = if buyingPressure > sellingPressure then 1 else -1;
plot demand;
if dp == 1 then {
demand = high;
} else {
demand = Double.NaN;
}
plot supply;
if dp == -1 then {
supply = low;
} else {
supply = Double.NaN;
}
demand.SetDefaultColor(Color.GREEN);
supply.SetDefaultColor(Color.RED);
demand.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
supply.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
if (!showZones) then {
demand.SetPaintingStrategy(PaintingStrategy.HIDDEN);
supply.SetPaintingStrategy(PaintingStrategy.HIDDEN);
}
It gives me this error on Thinkorswim, how do I fix this ?
Syntax error: An 'else' block expected at 32:1
Syntax error: Semicolon expected at 32:1