Trade Tracker Code In Google Sheets | Master Portfolio Tracker
HTML-код
- Опубликовано: 4 мар 2021
- Trade Tracker Code In Google Sheets | Master Portfolio Tracker
📈 Link to download all my Portfolio Trackers: / thinkstocks
☑️ Follow me on Twitter: / keithfrislid
🌎 Check out my discord server: / discord
🎥 Here is the camera I use for my videos: amzn.to/2PB865Q
🔶Get 50% off Seeking Alpha Premium with my Promo Link!!!🔶
www.sahg6dtr.com/28KL61/R74QP/
In this video, I will show you how to track every trade you make in Google Sheets so you can create these amazing portfolio trackers. This tutorial will show you how to write your own function to calculate exactly how many stocks you have, how many shares of each stock, and what your average purchase price is! This code is a major update from one of my older portfolio tracker videos. In that video, the code did not account for when you sold off a stock then rebought it at a later date. This would mess up the purchase price.
This video will show you how to fix that problem and how to write a code in google sheets that will no longer count stocks that have been sold off already using the FIFO method or "first in first out".
Link to Portfolio Tracker Video: • Build Your Own Stock P...
If you want to support my channel check out both my Patreon and discord below!
AFFILIATE DISCLOSURE: Some of the links on this channel and in video descriptions are affiliate links. At no additional cost to you, we receive a commission if a purchase is made after clicking the link.
#googlesheets #codeingooglesheets #stocksingooglesheets
Nice one mate! I had to go over the whole code a second time cause I was one number off but Its worth it! Awesome work man, your very detailed and clear with your walkthroughs
@Think Stocks You are an amazing human being. Thank you for great content and for your help. I really do appreciate you. I wish I could give this more than one like.
Notice the copy and paste around 51' of the video, the sell shares do not have the "minus" sign like the previous Build Your Own Portfolio video. So if you copy and paste from that worksheet, then you have to take out the minus quantity sign from all the Sell Quantity in order for this to work.
Dude, how are you so nice!?! Thank you so much. After finding all my spelling mistakes I finally got it working. What a great code, THANK YOU :)
I created my own Stock Portfolio on google sheet using your three Video lessons: 1-Build Your Own Stock Portfolio Tracker, 2-Code to Track Every Trade and 3-Automated Email Stock Price Alerts. It’s working flawlessly, amazing! Thank you for your good teacher like guidance.💐
Thats awesome!!
Yes 🙌. These sheets back videos are 🔥
Very helpful update indeed. Looking forward to more advanced ad-on features. Cheers!
And they are coming! Got some cool add on features that will drop soon
Great job! it works perfect
Thank you ! Really Thank you
Thanks for your effort, May be you won't get so much like the way entertainment video are getting. But we really appreciate your effort for making such video which will help us teach us about our financial. Thank you very much.
Thanks for the update, this is great! and love the walk through. Question: do you have a code/script to determine the date (mm/20XX) your dividend return will outpace the rate at which you're able to invest principle? I'm trying to add some forecast dates when I'll reach certain portfolio goals.
Thank you for your hardwork!!
Is it possible to make a track list for options volume and open interest??
Greetings From India.
It works fine for me. Thanks for this update.
Great stuff. Thanks. If you are considering new features please also consider having multiple portfolios/strategies and showing results for each portfolio/strategy. As we know, one should use ~5 strategies, not one strategey. I will try this myself, but if you deem this relevant to you or your audience, it might make sense to include this feature.
Fun coding with you... I linked this to me exportable transaction from my account and it works quite well. The only bug I ran into is short sells... it seems when the sell comes in first, the math is missing on the buy side... I played around with the code and righted the ship! Thanks again for sharing...
how did you fix this? I wanna make a portfolio tracker that has everything included, international, crypto, dividend and short selling. This video and a couple of others cover everything but the short selling according to you. Thanks
Great stuff. This should also deal with multiple accounts, which is something I modified the old source to handle. I will modify this code as well but just wanted to throw it out there that many people have multiple trading accounts and want to track the performance of each account individually. In Canada, we can trade within a TFSA, RRSP and Margin account.
Agreed, my wife and I have several accounts that I manage. It would be great to see the breakdown of each one.
So are you all creating a different tracking portfolio for each exchange you use? For instance, I have bitcoin on several exchanges.
Great and thanks. Now time to find out how to incorporate shorting stocks and using margin formulas... searching the internet for answers.. lol
Thank you for this great input! - How would you link screenshots for easy access? Greetings to you from germany 😀
This tutorial was superb. Noticed the cost avg discrepancies when experimenting with GME Buy/Sells a couple weeks ago. Good to see you've worked on a fix.
However... because i've heavily modded my sheet to best suit GBP and GBX (pence), i'm now completely out of my depth when it comes to applying your script amendments.
Will be on the lookout for more of your work!
Oh don't worry I found a work around for GBX in Google sheets. Ill be coming out with something soon for that!
@@ThinkStocks I figured out where the issue was... which was to remove the negative sign when clocking in sell quantities. So now the new script works perfectly!
Thank you for taking the time to post this excellent tutorial! My only problem is that I have wash sales, so the cost basis using these formulas for one of my stocks is completely different than what I see in my trade account. What would be the best way to make the numbers correct in your tracker? Thanks!
Great teaching video!! Do you happen to have any sheets dealing with selling options? I use the wheeling strategy and something like this would be a great asset for me. Do you perhaps have one on your patreon page?
Well worth the patreon for the sheets.
Thank you sir.
Awsome man. Great job, thanks!
Do you know a formula or a script that show how much we sell per month and our profit per month, so we can do our taxes?
Thank you. Great video. very helpful. I am getting the data but also getting error at the bottom. Need to watch the video again to see if there is a way to fix it. I noticed when you added and removed, you also had similar error(n/a) but when you added something else after, it disappeared but mine is now
great stuff
Thanks!
Great vid, trying to figure out a way of tracking my investments which are held in the UK and US and that does through back some errors on the formula due to the currencies. Any simple solutions.
My only thought at the moment was two separate spreadsheets for UK and US
HI, What about short positions? I sometimes put shorts to hedge some other positions and it seems when I first put sell and then buy it back, sheet sees only a buy. Is there a posibility to track also shorts?
Thanks,
Is there a way to show every trade and every change in portfolio in a line-graph with date on the x-axis? So it is easier to benchmark it against the general market or stockprice.
Thank you..
is there a video for how you created the History tab?
Hi, do you have sheets to track fund prices?
All your work is greatly appreciated!
Everything works fine for me with one exception. When my transaction page reached 80+ lines I get the following error - ReferenceError: activetrades is not defined (line 48). This is weird as it will work after I delete some lines from my transactions sheet. Amy advice would be helpful. Thank you!
Hello,
Thank you for all.
Could you try to add a new Action in History such as "Split" and to write the required code rows, please?
Have a nice day.
This will be helpful if you can share how to record stock splits in the sheet?
How to we calculate the total profits or losses made for all closed positions?
hi, check another video from this channel. However, I've added some tweaks to formulas provided there to reflect my broker commissions
Love what you are doing. I did this video. Took a long time to get the code just right. Today I processed my first Sell order, entered it into the History tab, but it doesn't register on the Positions tab. I checked the code to make sure the word Sell was spelled the same. Checked the Data Validation, making sure no spaces or spelling error on the History tab. Everything seems to be matching up but no Sell processing.
Hmm thats interesting. Its not breaking the code or anything? You just aren't seeing the shares being sold off?
@@ThinkStocks Just the shares. The cash is working fine going back into the account. I sold ten shares of a stock, recorded it on history and the cash posted back into my available cash. But the stock share numbers did not update on the Positions tab, Breakdown tab or the Dashboard.
Awesome Spreadsheet!! I'm running into this Error: #ERROR! " type error: action.toUpperCase is not a function" How can fix that issue??
is it somehow possible to get the data sorted so we can see a trade histoy? Like which buy with which sell has been calculated. This would be the last improvement i could think of!
we all guys should appreciate what he is doing for us .........love from great country india❤
Thank you for this great tutorial. Purchase price shows up perfectly in the Positions when i only have buy in the History. Moment i add a sell, position gives me error "ReferenceError: sharesTosell is not defined (line 36)" Can someone help me ?
I was visiting several stock tracker tutorings. This is best the stock google sheet ever. Please add sort stock by alphabet, and account tracking availability (most of us have multiple broker accounts). I plan to sign up for your Patreon.
Thank you! I plan on making a multiple account sheet!
@@ThinkStocks Awesome!
Keith,
Thanks for pointing it out on my google sheet. I am able to solve the error! You are right that I oversold the position (actually I have to resort to transaction date.) I am looking forward to your new video.
@@ThinkStocks Can't wait for this one!
Do you have a sheet that can take the transaction history and turn it into a equity curve for the portfolio so you can see what the ending balance was for the portfolio at the close of each day in the past? Would love to have something like this and certainly will to become a patron if that is something available to subscribers.
I got a cannot read property 'toString' of undefined (line 13)
Hi! Found the video :)
Quick question, and just to confirm, sale transactions should be added with the share number in absolute format? Selling 3 shares should be added as 3 and not -3, right?
That is correct!
@@ThinkStocks my tools doesn't have script editor
The code is working perfectly for stocks, but for crypto has to be heavily modified due to the case when you exchange a coin(ticker) on a pair which is not always USD for example. This means you for eg. in same time buy a coin but also sell another.. any volunteer? :)
Hi can i get some help please. Every time i try and sell an item the positions tab says reference does not exist. i have checked lines 27 to 64 more times than i can count and rewritten multiple times and even checked to see if it matched with the name on the data validations tab but still nothing.
Hi, do you have any source how to start understanding the makros in google sheets? Or mabye what soutce to start with. Thank you.
Absolutely love your tutorials!
Script works fine for me until I try to do "Sell" shares, gives me the #Error on the cell but works perfectly when i make a ass a "Buy" to the list.
Sell could cause problems if you over sell what you own. Make sure you are selling exactly what it says in your broker! Glad you like my tutorials!
I m facing the same problem as you. Did you manage to find the bug?
Thank you for such a great spreadsheet. I am having a problem with the error "Exceeded maximum execution time (line 0). Could you please advise how I can fix this issue?
Did you figure it out? Having the same issue
This is awesome. I am a beginner. Can you please do video how to deal with multiple accounts. I want to figure out each account's performance.
Glad you liked it! And im planning on doing a multiple accounts one. Alot of people have been asking me that!
Is there a way to create a Trading Journal where, when you input Transactions, the scrips get updated on the Journal Sheet along with entry and exit price and all you have to do is enter other columns like Stoploss, R2R, Strategy...manually?
I did create a day trading journal on Google sheets a few months back. Maybe that is similar to what you are looking for of you haven't seen that one already!
@@ThinkStocks I did not see that. Will dive right in.
Good morning, thank you for your very informative video, I have been using your instructions to create a tracker that has allowed me to manage my investments across multiple brokerages in one place.
One problem I am having at the moment is with the way the F.I.F.O code is working when I sell a partial position after making several incremental 'average down purchases'. Here is the scenario:
Purchase D 100 @ 73.84
Purchase D 10 @ 71.50
Purchase D 20 @ 71.26
Purchase D 20 @ 70.95
Purchase D 50 @ 68.32.....Total average cost basis per share was 71.80.
I found myself a little too deep in the money on a covered call after a swift move up to 78.89 on half my position. I decided to let it go @ 72.50 and not buy back the option (which is still higher than my average cost basis). I think I still should be realizing a capital gain rather than the capital loss calculated. I know the sheet is looking solely at the first higher transaction of 100 @ 73.84 and is reflecting the loss as such without considering the adjustment to cost basis. On the other side, unrealized gains on my remaining shares is overstated as the cost basis only reflects the incremental lower purchases following the initial 100. I do realize if I sell all my stake in D, all will be right because the averages would calculate properly, but I do not have any intention to do so.
Is there anyway the code can be slightly adjusted to consider these situations?
Thank you kindly and I look forward to your next video.
Hey, Keith Does your Patreon not accept Paypal payments, I have tried several times but it keeps saying failed? I know I don't have a problem with my account, soi was wondering if there is a problem at that end
The "Drip" or if you want add "Dividends" that don´t add new entry! :( , see line 19!
I am getting #NUM! under purchase column. Can you please help?
Hi, I'm trying to register a short position. Please help.
Does this code replace the formula you had in your previous tutorials where we would enter an average weighted formula to calculate the average share price?
Also when I try to enter a column on the left side of the price column it automatically shifts all the price values to the left into the new empty column i created. Any work around that, in case if we need to insert new columns to the left of the price column?
Thanks
Yes this is replacing the average weighted formula. Also make sure to delete the average weighted formula in the C column for the code to work properly!
Thanks.
ive gone through the script so many times for any mistakes and none found, execution start and finish all good to, no faults - filled out the myporfolio/mypositions bit all the same but still showing as an error (TypeError: Cannot read property 'toString' of undefined (line 12).)
anyone with any advise please?
For anyone who would like to know and it may also be causing an error to show. There seems to be maximum amount of trade history lines you can have before it causes the postion sheet to just give up on running the script. I believe the max is around 200.
Hey jack, what does your function look like? I've helped people with well over 500 trade history lines with no problems
Hi, it looks exactly like the one you wrote in this video. I originally downloaded the the spreadsheets from your patreon and plugged my data in. Then I followed this video along with following the script on the sheet file and verified it was the same. I have almost 1350 transactions and that'll go up. It comes up with an error like exceeded execution time (line 0). I knew the script worked before I cleared the prefilled data. So I assumed maybe I had to much data, so I played around on the =myportfolio formula change the the 2nd number lower until it ran.
If you are getting that error message that means you have a position that is over sold or a transaction out of order. If you buy 2.5 shares of a stock then sell 2.6 shares you will get that error message. The shares in your history tab needs to be precise
How would you show options trades?
that is in the works!
How does it update your portfolio stocks
Hey George, the code keeps track of your trades and at what prices you bought into all of them using FIFO! Then there are different functions you can put into cells to pull current market data
Thank you for this. Is it possible to link the cryptocurrency tracker to this investment spreadsheet?
Yes it is! Just use the price function in my international stock tracker tutorial. That will pull both stocks and cryptos!
@@ThinkStocks many thanks 🙏🙏
getting #REF! when referencing the myPositions script.
in my code I had my buy and sell actions written out as "Buy" and "Sell", but on the sheet it was "BUY" and "SELL". just updated the code to match the case of the sheet and that solved the issue for me.
This should be pinned for all of us who like to use capital letters. I did what he suggested and it worked perfectly.
Position data is nt getting from history sheet
Guys, is there any error in line 76? value.map(trade => { should not be value.Map(trade => {
basically map with capital M instead of lower case?
1. One thing that was interesting to me about google sheets are the functions. I didn't known this existed. 2. FIFO may be the default method of selling stocks, but it is not the only one FILO is also valid. It is up to the customer to select the method. This also brings the issue of realized gain/tracking. Without recording the sell price+cost one cannot establish the reliable numbers. 3. This and previous videos are waaaay too long, and the fact you don't provide source code makes this experience less pleasant. Just an opinion.
Great Video! Thanks for sharing.
I have noticed a problem or flaw with the sheet. Lets say I deposit $10k to my account. Then I buy 200 stocks for $10k (20 stocks each 1k). After some time I sell 100 of the stocks for $7K total. I then buy inn later using the $7K to get 120 stocks. In reality I've used my original $10K to get 220 stocks (22 stocks each 1k), but the code thinks I bought 220 stocks for $12k instead (18,3 stocks per 1k spent), making the deal look worse.
Is this how it is in yours aswell, or have you found a solution for it?
Is there a way to include brokerage fees within the code? I'd love to have these in there as well to get a more accurate calculation!
Hello. Greetings from Denmark.
Good work you have done, I am a big fan and I love using your sheets to follow my stocks, I also trade stocks from the Scandinavian countries.
I have a problem, in cell A2 there is an error message.
ReferenceError: actions are not defined (line 14).
Can't just see what I did wrong.
Can you help?
Thanks again for your good work.
Did your code properly execute when you ran it?
@@ThinkStocks Yes, it ran smoothly
Hey there, great content and journal. Unfortunately I just wanna buy the spread sheets, I don't wanna subscribe to a monthly plan. Is that possible?
Absolutely! Subscribe to patreon, download the spreadsheet (or all my spreadsheets) then unsubscribe so you are only charged that one time!
@@ThinkStocks got you thank you much
Thank you very much for the code. You have done great service to the public.
However, I am having one problem. When I generate the code, it gives me the error saying the result is not a number. Can I send you the code to check?
Sure thing! My email is in the about section on my channel
Question - Is it "action" or "actions" or a combination of the two? The code in the video has a combination. I've had someone tell me they changed one or some of the "actions" to "action" and it worked. I cannot find the combination. Running "generateTrade" works fine. But the other two I get these errors:
Getting error - "TypeError: Cannot read property 'length' of undefined. generateFifo @ Code.gs:11 MyPositions @ Code.gs:69
Same issue...
awesome video but its import to me all the stocks i ever trade, include the ones that shares is 0
Nice video, i also created this one, but when i try to sell all stock after my second or third buy with the same stock, that stock not disappear on positions tabs.
Can this be used on the previous master tracker as a fix or will it ruin the entire sheet?
Yes! But you need to make sure your clear out the purchase function in column C of the positions tab
@@ThinkStocks i applied the code for the old portfolio tracker sheet, and purchase column function also deleted, but ERROR is showing.. what is wrong?? whether i should keep the script file existing or delete that???
By using this Fifo scrip
Buy stock - 10 shares - 10.00
Buy stock - 10 shares - 20,00
Sell stock - 7 shares - 15,00
Average Purchase = U$ 17.69
it substract --> 10 inicial shares - 7 sold shares = 3 remaining x 10,00 purchase = 30,00
then Adds 10 shares bought x 20,00 = 200,00
Purchase total --> U$ 230,00 / 13 stocks remaining = U$ 17,69 purchase
or i did something wrong with the script?
Hello, and thanks for the great work. I just want to make sure that your FIFO formula is actually using the date entered and not just the order it is placed in the spreadsheet. Also, the reason I chose your video in the first place was that you were not having the realized gains show up, which I liked. But I do still want to keep track of realized gains. Is there an easy formula to keep track of realized gains for each ticker that you could share? Thank you.
The code reads the transactions in order so the entire must be in date order to properly calculate. And not yet but ill see if I can come up with something!
@@ThinkStocks aha. ya, that's what I thought....So do you think I can just sort the date column and that will fix the FIFO without screwing anything else up?
Yes!
@@ThinkStocks Oh, that is good news. Great, thanks again!
Man, Idk what changed but it stopped working. I now get this error when running script:
11:01:58 AM Notice Execution started
11:01:59 AM Error
TypeError: Cannot read property 'length' of undefined
generateFifo @ myPositions.gs:12
myPositions @ myPositions.gs:69
here is line 12: for(var i = 0; i
Waiting for your add on features.
Oh its coming! few months down the road but it will be worth the wait!
My sell and buy options working fine. but cash deposit details are not getting fetched from history tab. Pls help.
How so?
@think stocks is it ok if instead of creating a new blank spreadsheet with myPositions.gs , I edit the Master Portfolio Tracker spreadsheet I downloaded from your Patron and add myPositions.gs? I am not a developer so in case the latter is possible, I see your Code.gs script in the Master Portfolio Tracker spreadsheet and I'm afraid it would generate conflicts with myPositions.gs? Also do you know how I would go about copying the myPositions.gs script from my blank spreadsheet and pasting it in the Master Portfolio Tracker spreadsheet? Thanks!
Yeah you easily just copy and paste the scripts!
Thank you for this update! However, the numbers beneath “Purchase” give me an error saying the result is not a number, do you know how this can be solved?
Are you trading no us stocks?
@@ThinkStocks Yes, but to test it out I only used US stocks and it still gave me the same error, could I otherwise send you an email with the code?
Sure! You can email me it. Better yet share your tracker with me. The code might be right, but there might be a different error in your sheets
This happened for me also. If you are not American, you may write numbers differently. In Europe one million is "1,000,000" instead of "1.000.000". A small number with decimal places could be "1.34", for example, instead of "1,34", with a comma instead of a dot. Google detects "1.34" as a text, not a number, which is perhaps your problem. Anyway, that is what happened to me. Hope that helps!
@@ThinkStocks Thank you very much sir!
I am from India, it works fine here also.
In the moment 41:35 is an error??? Is value or vaule??
why i get this nassage " action is not defined line 13
Hello Think Stocks.. Videos are amazing. Your link shows to pay 4.99$ per month. Is it possible to download the google sheets?Once I download the google sheet can I use it myself or should I pay 4.99$ every month to use it? Regards
You can pay once download the sheets that you want then unsubscribe from my patreon so it only charges you that one time
Thank you
Great Work,
When I run the code it executes very well.
When I try to put the Formula in positions (=myPositions(History!B2:B1000;History!C2:C1000;History!D2:D1000;History!E2:E1000) it says name? "unknown function)
What should I do?
Hmm it could be a few things. Make sure your history tab is free of any errors, and make sure your first 3 columns in the positions tab has no other formulas in any cells other than the myPortfolio formula
@@ThinkStocks Thanks for fast reply, but keep saying #Name (Unknown function: myPosition)
@@andreslbandre Try this =myPositions(Go to tab History and select the columns B,C,D,E) you should have this at the end: =myPositions(History!B:B,History!C:C,History!D:D,History!E:E)
Is this code posted somewhere, on Patreon maybe? I am running into errors. Would be nice to be able to copy-paste it haha
Yes my code and every tracker I've uploaded to RUclips is on my patreon! Link is in the description
How about dealing with stock splits?
That one I have not solved yet... But when I do there will be a video for it!
@@ThinkStocks Thank you, appreciate your time
Interesting!
@@ThinkStocks Did you get chance to verify if the above tick works :)
Yes! This Friday I will release a new master portfolio tracker with an updated code that accounts for stock splits!
Sir if drip added in history drip particular stock showings in positions please tell solutions.
Drip is supposed to add to your position in the positions tab. If you don't have DRIP on then it should be Dividend
@@ThinkStocks ok got it thanks sir
Hello @Think Stocks, Can you suggest me an alternative payment method to purchase this file?
I do not use credit card. I am using a debit card. and I want to do the importance with this.
Debit cards will also work with my Patreon
@@ThinkStocks Unfortunately, all my attempts fail. Does not accept debit cards.
message: "your payment to Keith Frislid didn't go through."
@@ThinkStocks Payment by debit card was successful, thank you.
With the Fifo method, you have finished the average price problem. It has been a great program. Congratulations...
Awesome work @ThinkStocks, can you please help, got #NUM = result is not number error in positions sheet for Shares and Purchase
Hmm, you have no syntax errors in your code?
@@ThinkStocks nope all looks good, going thru one more time. but got rid of all grey elements
If you want you can send me a copy of your sheet and I can take a look at it for you. My email is in the about section of my channel
@@ThinkStocks just did it
Okay cool. As soon as I get to my laptop ill take a look at it for you!
You seem to have an abundant knowledge of google sheets. Is there a way to formulate a cell to see yesterday's
value of my stocks? (sum total of a column.) This way I can see the gain/loss for the day. My Schwab acct lists it as "day's change".
So google finance has a function to pull yesterday's close price. The function would be =googlefinance(A3,"closeyest"). Obviously A3 is assuming thats where your ticker is. Hope this helps!
No one seems to understand my question. I am not looking for yesterday for any ticker. There is a SUM TOTAL of my gains for yesterday and a sum total of my gains for today. How much increase/decrease has occurred? There must be a way to do this. I am not looking for ticker prices or closing prices. My Schwab acct lists it as "day's change".
Ohh okay, so the best way to do this is find the change in all your positions which googlw finance has dollar change and % change and some them all together. I do this in my master portfolio tracker video on the dashboard. Warning It will not be as accurate as your broker because Google finance has a 20 minute delay
After adding the new function my positions tab is now showing that none of my positions have ever been closed out... Any idea how to fix?
Actually just figured this out myself... If anyone is having the same issue, you just need to change how many shares sold in history tab from negative to positive numbers.
This is a great tracker, but I can't get it to work. Script runs without errors. When I call the function in the positions tab I get #REF! (reference does not exist). History tab looks fine too. I had the exact same issue with your previous tracker as well for some reason.
i got the same issues. i have double, and triple my script and found no errors, however I get #REF! (reference does not exist). can anyone help please
I bought all the journals from. And have a few questions how can I email you? I cancelled my membership after I downloaded the drive.
Hey Roc, sure, you can find my email on my channel in the about tab
Hey! None of the formulas on the Positions Tab that you show at 54:03 work after updating to the newest code you showed earlier in the video. If those formulas dont work then I am assuming I would be unable to finish the dashboard too. Please advise!
I just checked and the code is still working on my end
What error message are you getting?
@@ThinkStocks should we still use =if(isblank) like the last video?
So in your purchase price column there should be no functions. Column a, b, and c need to be free of any functions other than the myPositions function to work
@thinkstocks the drip and dividend function doesnt work as it doesnt actually add to my position or show up in the cash available
there could be a syntax error on your end that is causing the function to not work properly. Make sure there are no spaces and the capitalization is the same as the code. Hope this helps!
@@ThinkStocks that was weird i had to do all lower case then all upper case for it to work. thanks a bunch man.
Glad it works for you now!
Hi, I am getting Error message Unknown function: 'myPositiobs'. Is it because of Google Chrome...? Which browser to use for Google sheet
Same here any fix?
I think that the function is still a little bit bugy when it comes to calculating the avg price.
In my use case f.e. for stock XY it doesn't calculate the avg. price correctly.
XY Buy 80 $34
XY Buy 10 $43
XY Buy 10 $42
XY Sell 43 $37
XY Buy 5 $36
XY Sell 37 $38
The avg. price for the example above would be something around $36 but what I get is $41.
What are the prices and what results are you getting?
@@ThinkStocks Hi, these are buying and selling prices. F.e. 80 shares * $34 equals $2720. With the old function the avg price was calculated correctly. I ve implenented your new function and for this specfic case it doesn't work. For the other use case f.e. buying 100 shares of an company selling 100 shares and rebuying again it works.
@@ThinkStocks Figured it out, I made a mistake in my formula :).
Okay awesome!
@@Ahmed-ry8qd I am facing the same issue in calcualting average price. Can you tell what was the fix you had done in the formula ?
#ERROR! RferenceError:generatTrade I not defined (line17).
i have double, and triple check my script but found no errors, however I get #ref! (reference does not exist). can you please help, Thank you!
I successfully created the code in script editor but when i attempt to insert it into my "positions" tab like you do, i get a #NAME? error. From what i can tell, i did everything verbatim like you did. Is there something else I might be missing that you may have done differently? I also get a #REF! error
It could be a few things. First I would recommend testing the code by depositing 10,000 cash, buying 10 shares of AAPL at 100, Selling 5 at 150, then buying another 5 at 200. See if that populates 5 shares of AAPL at 150. If so then the code and function are fine and you might have an error in your transactions