I had a thinkscript I found a while back that was working to do this but it stopped working. Can anyone help to fix or create a thinkscript that will plot the bid (green) and ask (red) as short horizontal lines on the candle chart (example shown below), please?
script line {
input barsBack = 1000;
input data = close;
def c = if !IsNaN(data) and IsNaN(data[-1]) then data else c[1];
plot line = if IsNaN(data[-barsBack]) then c[-barsBack] else Double.NaN;
}
input length = 1000;
def b = close(symbol = "/ESM26", priceType = PriceType.BID);
def a = close(symbol = "/ESM26", priceType = PriceType.ASK);
plot bid_ = line(length, b);
plot ask_ = line(length, a);
input limit = 0.02;
def priceB = close(symbol = "/ESM26", priceType = PriceType.BID);
def priceA = close(symbol = "/ESM26", priceType = PriceType.ASK);
# Labels for bid, ask, and spread
#AddLabel(yes, Concat("Bid: ", priceB), Color.Red);
#AddLabel(yes, Concat("Ask: ", priceA), Color.Green);
#AddLabel(yes, Concat("Spread: ", priceA - priceB), if priceA - priceB > limit then Color.RED else Color.WHITE);
script line {
input barsBack = 1000;
input data = close;
def c = if !IsNaN(data) and IsNaN(data[-1]) then data else c[1];
plot line = if IsNaN(data[-barsBack]) then c[-barsBack] else Double.NaN;
}
input length = 1000;
def b = close(symbol = "/ESM26", priceType = PriceType.BID);
def a = close(symbol = "/ESM26", priceType = PriceType.ASK);
plot bid_ = line(length, b);
plot ask_ = line(length, a);
input limit = 0.02;
def priceB = close(symbol = "/ESM26", priceType = PriceType.BID);
def priceA = close(symbol = "/ESM26", priceType = PriceType.ASK);
# Labels for bid, ask, and spread
#AddLabel(yes, Concat("Bid: ", priceB), Color.Red);
#AddLabel(yes, Concat("Ask: ", priceA), Color.Green);
#AddLabel(yes, Concat("Spread: ", priceA - priceB), if priceA - priceB > limit then Color.RED else Color.WHITE);
Last edited by a moderator: