Introducing coding using Google Sheets

Discussion in 'Strategy Building' started by themickey, Oct 20, 2024.

  1. themickey

    themickey

    Ok, I'm doing this kind of tongue in cheek.
    The thread will be about how you can use Sheets (Google Sheets) to code stuff for trading.
    Why Sheets? It's easy, you can do a lot with it, you get free data with it, 10-20 minutes delayed data but I find it's usually about twice that.
    The software is free, the data is free, it's similar to Excel, coding is easy.
    It's better than Excel imo.
    Plenty of resources available to learn the formulas, I should be able to help out there.

    Why am I doing this?
    I've got a bit of spare time.
    I enjoy coding.
    Hopefully this will be educational.
    It shouldn't have any negative affects on my trading.

    I don't anticipate to flood this thread immediately with tons of tips, I'm gonna take my time, too much bullshit from idiots and I will discontinue.
     
    cesfx, MACD and Slope Trader like this.
  2. themickey

    themickey

    First up, I find using a chromebook laptop helps, the operating system is Android.
    That's all I use, I don't own or run any Microsoft stuff any longer, several years now.
    No fees for software or upgrades, zero! zilch!

    I get 100GB of storage on Google Drive for $2.50 a month

    So chromebooks defaults to Chrome browser, Sheets and all the info, data, sheets etc is on the cloud. Nothing on my chromebook hard drive.
    Security is excellent, no antivirus software required, everything is bug free, never had any hassles.

    I've found the last year or so that sheets can hold more data than previously, ie, I can have hundreds of stock codes and run large algos and sheets doesn't freeze.

    I do have some very large sheets of data, sometimes it takes a few minutes to load, but I'm talking about very large amounts of data. Once the few minutes is up and the sheet is loaded, then there is no lags in anything. I'm talking about 600 stocks and several combined sheets all working together.

    So, if you are a MS Windows user and using Sheets, I can't comment on performance, I have no clue how Windows will behave.
     
  3. themickey

    themickey

    As mentioned, you can do a ton of stuff on sheets.

    Lets begin with the very first basic lesson:
    How to create a watchlist with the following information;
    Company code
    Name
    Current share price
    Percentage gain from yesterday
    Marketcap
    Shares on issue
    volume
    Average volume

    That'll do just for starters.

    Open up a Google sheet obviously.......

    upload_2024-10-20_12-35-4.png

    On row1, type the names as per above which is your header column.

    upload_2024-10-20_12-37-57.png
    Freeze the top row (prevents from scrolling) by going View/Freeze/Freeze row1

    in cell B2 type: =GOOGLEFINANCE($A2,B$1)

    Copy (Ctrl +C) cell B2 and paste (Ctrl +V) into cells D2, F2, G2, H2, I2, J2.

    In cell C2, manually type in your sector
    In cell E2 type: =D2/J2-1

    And there you have it, a basic watchlist, continue to add your stock codes down column A
    and copy along the formulas.

    Type in a name for the watchlist, here I have named it: "Create a watchlist"

    Here below are further attributes you can use which you would type into Row1
    • "price" - Real-time price quote, delayed by up to 20 minutes.

    • "priceopen" - The price as of market open.

    • "high" - The current day's high price.

    • "low" - The current day's low price.

    • "volume" - The current day's trading volume.

    • "marketcap" - The market capitalization of the stock.

    • "tradetime" - The time of the last trade.

    • "datadelay" - How far delayed the real-time data is.

    • "volumeavg" - The average daily trading volume.

    • "pe" - The price/earnings ratio.

    • "eps" - The earnings per share.

    • "high52" - The 52-week high price.

    • "low52" - The 52-week low price.

    • "change" - The price change since the previous trading day's close.

    • "beta" - The beta value.

    • "changepct" - The percentage change in price since the previous trading day's close.

    • "closeyest" - The previous day's closing price.

    • "shares" - The number of outstanding shares.

    • "currency" - The currency in which the security is priced. Currencies don't have trading windows, so open, low, high, and volume won't return for this argument.
     
    Last edited: Oct 20, 2024
    MACD likes this.
  4. themickey

    themickey

    Any questions?
     
  5. themickey

    themickey

    Because the data is not live/realtime but delayed, a daytrader could still find this handy as you can record effortlessly the previous day or week's Open, High, Low, Close, Volume.
     
  6. themickey

    themickey

  7. Yes, look at the portfolio tab. You will be able to add any stock in there and have your watchlist.
     
    themickey likes this.
  8. themickey likes this.
  9. themickey

    themickey

    To add to the watchlist stocks from different exchanges/countries....

    Australia ASX:BHP
    NewZealand NZE:XYZ
    Toronto TSE: XYZ
    London LON:XYZ
    Singapore SGX:XYZ
    Shanghai SHA:XYZ

    etc etc
     
    #10     Oct 20, 2024