Tracking Stocks With Numbers On Your Mac - YouTube

Channel: unknown

[0]
Hi, this is Gary with MacMost.com.
[1]
Today let's build a Stock Chart using Numbers on your Mac.
[7]
MacMost is brought to you thanks to a great group of more than 750 supporters.
[14]
Go to MacMost.com/patreon.
[16]
There you could read more about the Patreon Campaign.
[18]
Join us and get exclusive content and course discounts.
[21]
So if you want to analyze stock histories using Numbers you can do that using the STOCKH
[27]
Function.
[28]
Let me show you.
[29]
Here let's start with a blank template and I'm going to use a simple function to get
[33]
a stock price.
[34]
I'll hit the equals key here and if I search in Functions for stock you can see I come
[40]
up with two things.
[41]
STOCK and STOCKH.
[42]
STOCK will give you the previous days closing price.
[45]
STOCKH is much more powerful and will give you the closing price and also things like
[50]
highs and lows for any date.
[52]
So I'm going to double click it here to insert it in and we can see the parameters.
[56]
So first we can choose the symbol.
[57]
I'm going to use Apple as an example.
[59]
You have to put the symbol in quotes so double quote AAPL for Apple as the symbol.
[66]
Then we choose whether to look at the close, open, high, low, or volume.
[70]
You can see these also have numbers so we can use the number instead.
[74]
Let's choose close.
[75]
Now let's choose the date.
[77]
We put this in quotes as well.
[79]
So a double quote here and we'll look at say 1/2/2020.
[85]
Close the quote.
[86]
Now I'll hit Return and we'll see the closing price for Apple stock on that day.
[91]
Let's go back in here and let's look in the Functions Help for a second.
[94]
We could read lots of different things here about the STOCKH function.
[97]
So if you want the details read through this and look through the examples.
[101]
Let's create something a little more robust.
[103]
Let's make it easy to change the stock symbol and also the date.
[107]
So I'm going to create a new table here using this style.
[110]
It's going to put it below.
[112]
But I'm going to move things around and put it above.
[115]
So I'm going to move this one here to the top and this one here below it.
[120]
I'm going to shrink this table so it's only one column wide and only has one extra cell
[127]
after the header cell here.
[128]
So let's take a closer look at this.
[131]
Here I can select this table and let's go to Format, Table and turn off the title.
[135]
Let's make some more room here.
[137]
Move this down a bit here so we can see both cells clearly.
[140]
Let's put Stock Symbol here and I'll put the symbol there.
[146]
So now I can go into this formula here and instead of having the Apple symbol hard coded
[152]
in there I can delete that and I can click on this cell here.
[156]
I'm going to additionally click here and set it to Preserve Row, Preserve Column.
[160]
So use the Absolute location of this cell.
[163]
So no matter how I copy and paste this function in the future it will always refer to this
[167]
exact cell.
[168]
So now it's going to get the symbol from here.
[171]
So now I can switch to another symbol and it instantly changes
[176]
Now let's also put the date here.
[178]
So 1/2/2020.
[182]
Let's go in here and instead of hard coding the date in there I'll delete that and I'll
[187]
refer to this cell.
[188]
So now we've got it like that.
[189]
Let's name this column Date and this column Close.
[195]
Now if I were to put another date here, like 1/3/2020, and copy this formula from this
[202]
cell and paste it here, it will pick up the same stock symbol but the new date.
[208]
I could now extend this if I want.
[209]
I could select both of these cells and then if I move my cursor over the bottom I get
[213]
this yellow dot.
[215]
Click and drag that and you could see it extends it out.
[217]
So I could select this formula here and paste it in here.
[222]
Now I get the closing prices for these days.
[225]
What about these errors here?
[226]
Well, these are non-trading days.
[228]
These are weekends.
[229]
So we get an error because there's no closing price on Saturdays and Sundays or any other
[233]
day the market it closed.
[234]
Don't worry too much about those.
[235]
We'll deal with those in a minute.
[237]
Let's go ahead and add other columns here.
[239]
I'm going to do a Low and a High.
[244]
I'm going to take this function and paste it into both places.
[250]
But for the Low I'm going to go into it and change close to low.
[255]
That's the low price for the day.
[257]
In here I'm going to change close to high.
[260]
That's the high price.
[262]
If I Copy these two and paste them throughout here I now see the Close, Low, and High for
[268]
all of the trading days.
[270]
Let's extend this here by dragging down the table to include the entire month.
[276]
Remember we started on the 2nd.
[278]
So let's actually create this the proper way by going all the way to the 31st there.
[283]
Let's do 1/1/2020 which of course is not a trading day, it's New Year's Day.
[288]
I'll extend this yellow dot here all the way down to the bottom so it goes 1/1 to 1/31.
[296]
Now if i take these and I extend this as well it'll put those functions on each of those.
[304]
So now we have the close, low, and high for everyday in January.
[308]
Let's get rid of the cells here on the right and I'm going to select of these cells here
[312]
and drag the line here at the top over to the left to shrink them so we have plenty
[317]
of space here.
[318]
Now let's create a chart to track the closing numbers.
[321]
So I'm going to click here, click the column B there, and click Chart and we can create
[327]
a simple line chart here.
[330]
Now we can see the closing numbers for Apple stock throughout the month of January.
[335]
Notice the breaks.
[336]
The breaks are those non-trading days.
[339]
Let's get rid of the non-trading days.
[341]
What I'm going to do is go back into these function here.
[343]
I'm going to surround them with the IFERROR function.
[347]
So IFERROR and then the second parameter after looking at the value there is whatever we
[353]
want to use as the error value.
[356]
So in this case I'm going to put a dash.
[357]
Double quote dash double quote.
[360]
So if this function produces an error we will see the dash instead of the function.
[364]
So now you can see it looks a little bit better.
[366]
Let's do it for each one of these as well.
[367]
I'll do IFERROR and then at the end here dash and I'll do it here and now let's spread that
[378]
function all the way down here.
[381]
Now instead of errors we get dashes.
[383]
Now what we can do is Filter.
[385]
Let's use the closing column there as a Filter.
[387]
Go to Organize, Filter and then add a filter.
[390]
Say a filter on close and say If the text is not, and let's do a dash.
[396]
So it's going to filter out all the rows where the dash is there instead of a number.
[402]
Now you could see it filters it out.
[403]
We've got the gaps filled in so it goes the 2nd, the 3rd, and then it jumps to the 6th.
[409]
So we only have valid numbers there.
[412]
The chart changes to reflect that.
[415]
Now we have a coherent chart that doesn't have those gaps.
[418]
What if you wanted to chart the highs and lows.
[421]
Let's try that.
[422]
So I'm going to take this chart here and I'm going to move it down and out of the way.
[425]
What I would like to do it chart the low and the high and maybe do it in a stacked bar
[431]
chart.
[432]
But a stacked bar chart by itself won't work because we want to stack 75 on top of 73.
[437]
That wouldn't give us anything useful.
[439]
What we like to do is stack the difference between the high and the low on top of the
[443]
low.
[444]
So let's create a new column here.
[446]
I'm going to drag this out call this one HL Dif.
[451]
It's just going to be a simple formula equals this number, the high minus the low.
[458]
So you can see here the high is $1.35 above the low.
[462]
Now let's populate the whole column with that.
[466]
Now we can do a stacked bar chart with the low and the high low difference.
[471]
I'll select those two columns.
[473]
Do Chart and then that there.
[477]
Now we could see the low, of course, takes up the majority of this, and then the high
[480]
is this little bar above it.
[482]
So what if we got rid of the low.
[485]
One way to do that is click on it.
[487]
You could see that I could select just a Series.
[489]
It shows here Format, Series, Value low.
[492]
I could switch to Style and then I could change the style.
[495]
I could make it white.
[496]
That would make it go away.
[498]
But instead I'm going to go here on the Color Wheel and just leave it at the current color
[504]
but make it completely transparent by bringing the opacity down to zero.
[508]
So now you could see just a bar here that shows the low to the high.
[515]
Now this is looking pretty good.
[516]
What will be even better would be if we could see the low, the high, and the closing price.
[523]
You'll often see that as a line here on these bars.
[526]
I'm going to move this chart further down and move this one down.
[531]
Now let's do another stacked bar chart.
[532]
So we're going to need some new numbers for that.
[534]
I'm going to create two new columns here.
[536]
Now we want to make sure when we work on these functions that we turn OFF the filtering.
[542]
I want to show you why.
[543]
If I turn it off notice that the cells that weren't visible before don't have anything
[548]
in them right now.
[550]
That's not going to be good for something that we're going to do in the future.
[552]
So I want to Copy one of these functions here and paste it throughout.
[557]
I get the errors there but I'm not worried about it.
[559]
I could, if I want to, IFERROR and then do that same dash in there.
[567]
Copy and paste it throughout.
[569]
Now these two new columns are going to be the1% Max and Close 2.
[575]
So what are these for.
[576]
Well 1% Max is going to be 1% of the highest high.
[579]
So we can do that by taking the maximum value of the High column and multiplying it by point
[585]
zero one.
[586]
That tells us that basically the maximum value is about $82 and 0.82 is 1% of that.
[593]
We could just copy and paste that throughout the entire column here.
[597]
That's actually an expensive calculation.
[599]
Calculating the maximum value.
[601]
So instead I'm just going to do it in the very first row.
[604]
Then in the second row I'm going to set it equal to that value.
[608]
I'm going to make sure I set Preserve Row so it's always looking at the first row.
[614]
This is a simple inexpensive function just to basically take this value and put it here.
[619]
So I'm going to Copy this and paste it in the entire column except for that first cell.
[626]
So now I get 0.82 throughout the entire thing.
[629]
What is Close 2.
[630]
Well, Close 2 is going to be equal to the Closing price minus that 1% Max.
[639]
So let me go and Copy and Paste throughout the entire thing here.
[644]
So instead of 75.15 Close 2 is 74.27.
[649]
The close minus that 0.82.
[652]
Minus that 1% of the maximum line.
[654]
So why did I do all of that?
[655]
Because I can create a really cool chart using this Close 2 and this 1% Max.
[660]
Let me got and select the two of those.
[662]
Create a chart, a bar chart.
[664]
Now it's going to put the 1% down there at the bottom.
[667]
So I'm going to switch those and go to Series here and select this Series and instead of
[674]
1% Max I'm going to change that to point to the Close 2 and instead of the Close 2 there
[688]
I'm going to change that to point to the 1% Max.
[693]
So now what we've got is these equally sized little bars, because they are all 0.82 high,
[700]
above the Close minus that 0.82.
[705]
So I'll select this Series here.
[706]
I'll go to Style.
[708]
I'll change its color to be transparent just like before and you get these cool little
[713]
bars.
[714]
Let me go in here and in the Chart turn off the Legend at the top.
[718]
I'm going to move this here so I can see both of these charts at the same time.
[723]
For this one I'm also going to turn the Legend off.
[726]
For this one I'm going to set the color.
[728]
So for this Series I'll click there on that Series, the style to black.
[733]
So it's a little black bar.
[735]
Now let's go and turn the Filtering back on.
[738]
So I'll select this table.
[740]
Organize and turn the Filter back on.
[742]
Now we see one chart here that shows you the little bars with the Closing price.
[746]
Another that shows you the highs and lows.
[749]
All we need to do is drag one on top of the other and make sure they are perfectly on
[754]
top of the other.
[755]
Getting them perfectly on top of each other is tough.
[758]
So I'm going to Undo that and instead I'm going to use Numbers to do it.
[762]
I'm going to go to Format, Arrange and with this selected I'm going to see here that the
[766]
position is 477.
[768]
Let's set that to something even like 460 and let's change the y position to say something
[773]
like 60.
[774]
So it's down there.
[776]
Notice the width is 340.
[777]
The height is 247.
[780]
Let's make sure that those are full whole numbers here by changing it to something like
[786]
that.
[787]
There.
[788]
So there are no decimal points that are hidden.
[790]
I'm going to change this one to 340, 240 and then 460, 60 so it overlays perfectly.
[796]
So 340, 240 and 460, 60.
[802]
Now these are perfectly overlaid on top of each other.
[805]
You can even see the numbers are overlaid on top.
[809]
The black bar now represents the Close and the green is the lows and the highs.
[814]
That's pretty good.
[815]
What would be even better is if the dates could be changed because right now I would
[819]
have to go in there and just manually change these dates to something else.
[823]
Let's go in and extend this table here with two more columns.
[829]
Let's call this the Start Date and the End Date.
[835]
Let's say the start date will be January 1, 2020.
[838]
The end date will, for now, be January 31, 2020.
[844]
Let's go into this table here and turn Off the Filters.
[848]
We can edit everything easily.
[850]
Now let's go and change this date here to be equal to exactly this date.
[856]
Let's go and set the Preserve Row and Preserve Column.
[859]
Now let's remove the rest of these dates, delete them.
[862]
Okay.
[863]
What we want to do here is this date should be 1+this date.
[869]
So equals this date +1 and look how that works.
[874]
Now you would think I could just keep going with that.
[876]
Right But I want there to be this end date.
[878]
When I get to January 31st I don't want there to be a February 1st after it.
[883]
So instead I'm going to alter this function and do an IF and check this date and see if
[891]
it's less than or equal to this date.
[895]
Set that to Preserve Row and Preserve Column.
[898]
So it's always looking at.
[900]
If it is less then I want to use that same number, so in other words this value +1.
[906]
If it isn't then I want to put a dash or something like that there.
[912]
So now you can see that works there.
[914]
I can extend this down and you could see how the dates fill in.
[919]
Now what happens if this is a much longer table here.
[923]
If I were to take this and keep extending all the way down you could see here the 31st
[929]
is there but I get a dash for February 1st and after that I get an error because it's
[933]
trying to add one to a dash.
[936]
So the result is the same.
[937]
I don't get anything here.
[938]
Remember as long as Close has a dash in it, it won't be shown.
[942]
Let's extend this table quite a bit.
[945]
Just drag this down, way down.
[947]
If I go 1000, that's like three years.
[950]
365 x 3.
[951]
If I go even more you know there's like four or some years.
[955]
Then you could see how it's going to fill in those formulas there.
[960]
So now I can extend this quite a bit.
[965]
So I could say I want this to go to March 31st.
[968]
So look what happens.
[969]
I start there on the same day and now I go down and after March 31st it's just going
[975]
to be dashes and errors.
[978]
Let's select something in this table and I'll go to Organize and turn the Filters back on.
[981]
That will get rid of all the dates that Closes are dashes.
[984]
So the table is only to March 31st.
[989]
After that everything is filtered out.
[990]
The charts change to reflect that.
[993]
You could see here the highs and lows and the Close for all the dates from January 1st
[1000]
through the end of March.
[1001]
Now we need to change these dates to reflect the changes.
[1004]
So if I want to go to August 30th all I need to do is change the date and wait for everything
[1010]
to recalculate.
[1011]
I can see my charts change to reflect that.
[1014]
If I were to change this to a different stock I could do that as well and then wait for
[1021]
everything to recalculate again.
[1023]
So I hope this gives you some idea of what you can do using the STOCKH function in Numbers
[1028]
and how you can create some charts to analyze stocks with it.