Paul Allen
New member
Here is a study showing current bid and ask linearly extended left /right.
Code:
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(priceType = "BID");
def a = close(PriceType = "ASK");
plot bid_ = line(length, b);
plot ask_ = line(length, a);
input limit = 0.02;
def priceB = close(priceType = PriceType.BID);
def priceA = close(priceType = PriceType.ASK);
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);
# End Code
Last edited by a moderator: