Find Stocks with a difference in mark Price compared to last


Category:
0
0

Hi Pete,

I saw your code about bid ask spread for a price difference and thought could it be possible to have a scan but for the difference between mark price and last (close)?  I have tried so far by typing up

input limit = 0.02;
def priceB = close(priceType = PriceType.Last);
def priceA = close(priceType = PriceType.Mark);
plot mark = priceA – priceB >= limit;

Which hasn’t worked.  Ideally I have a result right now with 89 stocks and prefer to cut it down to just 10 of them that actually have a difference in price compared to all the rest.  Mark and last would help me out here if this is possible.

 

Thanks!!

Marked as spam
Posted by (Questions: 3, Answers: 1)
Asked on June 16, 2019 3:18 pm
63 views
0
Private answer

I don't think this is going to be possible. PriceType.MARK has limited use. Basically you can only use it for Forex symbols or within the customizable columns of the option chain on the trade page. For stocks, this price type produces an N/A result. How would you know this?

Well that is a simple matter of debugging the code using a basic troubleshooting technique. Which is to break things down into their basic units and plot the results:

declare lower;
input limit = 0.02;
plot priceB = close(priceType = PriceType.Last);
plot priceA = close(priceType = PriceType.Mark);
#plot mark = priceA – priceB >= limit;

All I did here was to turn off your main plot using a "#" symbol in front of the statement. Then I changed the other two "def" statements into "plot" statements. This enables us to view the results on a chart. Notice in the screenshot below we have two plots. The last value on the chart for 'priceB' is 198.35 and the last value on the chart for 'priceA' is..... N/A. Which means the value you are trying to read for priceA is not available. Now try changing that chart to a Forex symbol and see what happens.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 18, 2019 12:42 pm