Arizona Real Estate update 8.8.2022

Six months ago some had the opinion, ‘this time is different. Their primary argument was that supply didn’t exist so housing prices could not fall that significantly. I always pushed back, you don’t know how many people are holding second or third houses as rentals. Or how many people bought Airbnb properties because ‘houses always go up in value? Well, now we are finally seeing people unload those houses. Where they came from for sure, who knows. But they are coming out of the woodwork. The good news is we are not yet back to the levels of inventory that we saw back ding the 2008 collapse. The peak houses for sale back then were somewhere just shy of 60k. All of the old data can be found on ARMLS. It would be nice if someone compiled it into graphs.

The months of supply now sit at 3.2. As I’ve indicated before supply is cyclical and we should see this peak around Jan-Feb, all else being equal.

House prices peaked at $401.43/sq ft in March. Since then they have declined about 18% to $329/ sq ft.

One of the key things I’m keeping an eye on is the number of price cuts per week.

It is still elevated at 4,006. This represents 25% of the listings for sale. One in every four people who are selling houses has had to cut their price in the last week. The psychological implications of this I think are huge. People are not going to buy if they think prices will continue to decline. Listings under contract continue to decline and currently sit at 7,421.

To put this in perspective in Q4 of 2007 the lowest this level dropped to was 8,898. You could however argue that this low number is due to low inventory.

I follow CPI(inflation) pretty closely for a different investment that I’m working on.

The FED is afraid of inflation. In fact, I think it’s the only thing keeping them in check. It is the main driver behind them raising rates and why they will continue to do so. I’m eagerly waiting for the July CPI report which will be released on August 10th. If CPI is continuing up the FED will respond accordingly. Until the FED stops raising rates I would be very cautious about investing in any asset class.

Facebook Comments Box

Arizona Real Estate update 8.1.22

People are still slashing their listing prices. It increased to its highest level this week, 4,172. This will continue to put huge downward pressure on prices.

We have exactly 3 months of supply also going to put downward pressure on prices. The number I’m waiting for this to break is 3.9. Once this happens will have the most supply since 2016. I expect this will continue upward until Jan-Feb of ’23 (it’s cyclical).

The number we should be watching now is listings under contract. It sits this week at 7,343. This is the lowest it’s been for at least 3 years. I don’t have data that goes back any further. This number will tell you where the ‘bottom’ is because it means people started buying again. Right now they still appear to be sitting on the sidelines.

Listing prices are where they were a year ago. I’m not sure who is running things over at Zillow but their estimates don’t show any downturn. This appears to me to be highly inaccurate. I would not trust your ‘Zestimate’ right now. It seems their algorithm has no method to adjust for a ‘listing price’ variable.

It’s understandable why houses are not moving. Since the huge injection of capital into the system in early 2020(Covid) people are broke again. This can be seen in the personal savings rate. It is the lowest since 2009. I think this will also have an adverse effect on retail stocks. I’m willing to bet this will continue to decline to all-time lows in the next year or two. America is addicted to stimulus. With Fed rates going up the balance sheet of individuals is going to deteriorate.

The question now is will the Fed continue to raise rates or pause as Powell hinted at last week?

I’m a huge believer in I Bonds right now. They are one of the most solid investments you can make. They yield 9.62% risk-free. That being said I follow the inflation numbers pretty closely so I can determine what their new rate will be, come November 1st. There is nothing that indicates a slowdown in CPI-U(inflation). The next report is due on August 10th. I imagine that one won’t be friendly and the Fed will be back on track to raise rates for their September meeting. If inflation continues on its current trajectory then I bonds will yield north of 12% in November.

Mortgage rates are also where they were back in 2008/2009. With housing values up and rates up people cannot afford this market.

Facebook Comments Box

Arizona real estate weekly update 7.25.22

Call me crazy…But I believe affordability is the primary driver of housing prices. Mortgage rates determine payment. And payment determines affordability. This is rough rough rough math. But based on the inverse correlation between rates and housing prices you could easily derive from this chart a 30% drop in prices everything else being equal.

Buyers are still slashing prices as indicated in ‘Number of Price Changes per Week’. As long as this stays high or continues to grow there will be tremendous pressure continuing to push prices lower. Just because of psychological reasons if not anything else.

Based on the ‘average list price per square foot’ if you bought in the last year you are more than likely upside down. And technically you’re probably upside down if you bought anywhere near the end of 2020. Assuming a 6% reduction in your appreciation for selling fees.

Supply now sits at 2.8 months. This typically peaks in Jan-Feb. So I think it will continue to climb. I wouldn’t be surprised if we’re back to supplies being where they were in 2015 before it peaks, Jan/Feb ’23.

Facebook Comments Box

Arizona real estate weekly update 7.18.22

Price cuts continue to accelerate. Sellers are panicking. Typical at the top of a bull run. This is not good for housing prices.

Inventory and months of supply are back to Jun 2019 levels.

Albeit minimal the price per square foot is now lower than where it was a year ago meaning the one year ROI on a house is negative for the first time since… Um, well, I don’t know. None of the data shows house prices to have ever declined in the last 4 years. This is major sign the market has turned.

Despite the ‘low prices’ the listings under contract are the lowest they’ve been in 3 years. Also, a sign that buyers are telling sellers to keep their houses.

Don’t buy yet. But have your gunpowder ready. There will be deals soon. Don’t try to catch a falling knife.

Facebook Comments Box

I Bonds don’t yield 9.62% – It’s actually 10.49%

The publicly advertised rate for I Bonds according to the Treasury Direct website is 9.62% if they were or are purchased between May and October of 2022.

But what people do not realize is that an I Bond issue month is the same regardless if you purchase it on the first day of the month or the last day of the month. So consider this, if you purchase an I Bond on July 31st of 2022 or in 18 days. Then on August 1st it is already 1 month matured.

So let’s do some basic math. If the current yield is 9.62% then you can divide this by 11. Given that you’re yielding 9.62% in 11 months, not 12. Or technically 11 months and 1 day. This will give you a monthly yield of .8745%. Multiply this by 12 and your annual yield is actually 10.49%

Facebook Comments Box

Arizona real estate weekly update 7.7.2022

My Cromford access has been restored. I can now bore you with housing statistics.

The Fed will burn down everything until they get inflation under control, no asset is safe.

From WSJ:

The overall tone of the minutes suggests “the Fed upgraded the inflation problem to a five-alarm fire,” said Omair Sharif, an economist and head of the advisory firm Inflation Insights LLC.

As a result, the minutes also revealed officials’ growing acceptance that fighting inflation might lead to higher risks of a recession, but they saw that as “a cost they’re willing to pay,” said Michael Feroli, chief U.S. economist at JPMorgan Chase.

Facebook Comments Box

AZ Home sellers are panicking

I’m fixated on this chart.

I always used to underestimate the psychological aspect of investing. But it plays an important role in any tradable asset. This chart represents the number of houses in Arizona that have cut their listing price. What do you think the mentality is of this individual? Sit and think about it. Then ask, ‘what impact will this have on the actual housing market’? As the velocity of this green arrow increases people will start unloading. Fear will become an important driver of prices.

Facebook Comments Box

Finally unloaded my rentals

The Fed is deathly afraid of inflation. At the beginning of the year, they announced they would unwind QE and raise interest rates. This was a clear sign to me that it was time to unload real estate. I will publish updates on the market weekly as it appears to be deteriorating in Arizona.

Facebook Comments Box

How SRP is destroying rooftop solar with demand charges

If you’ve installed solar and you live within the monopoly of SRP then you know what kind of racket they are running over there. You spend tens of thousands of dollars to do your part on making Arizona’s electric grid more reliable. In turn, SRP hits you with these absurd “on-peak demand charges”. Make no mistake these charges are to intentionally make rooftop solar not affordable.

While the average SRP customer is paying around 10c per kWh of electricity they are spiking solar customers with rates as high as $33.59. This is nothing short of a scam. This means they spike the cost of electricity on their E27 customers by 33,490%. They do this to basically negate all the financial benefits of installing solar.

IT’S TIME FOR CHANGE.

The corporate shills need to go. Vote for the SRP Clean Energy team.

Facebook Comments Box

Installing Zipline on Colab

If you’re using Zipline for portfolio analysis you may be wondering how to get it installed in Google Colab which is running Ubuntu 18.04. Here are the commands.

!wget https://launchpad.net/~mario-mariomedina/+archive/ubuntu/talib/+files/libta-lib0_0.4.0-oneiric1_amd64.deb -qO libta.deb
!wget https://launchpad.net/~mario-mariomedina/+archive/ubuntu/talib/+files/ta-lib0-dev_0.4.0-oneiric1_amd64.deb -qO ta.deb
!dpkg -i libta.deb ta.deb
!pip install ta-lib
import talib
!pip install zipline-reloaded
!pip install pyfolio

%env QUANDL_API_KEY=<your key>
!zipline ingest -b quandl

Facebook Comments Box

We need solar to diversify our energy imports away from countries like Russia so let’s choose our SRP leaders wisely

This week has been an emotional one. We welcomed our new baby, Olivia, to the world on 3/1/22. It’s hard to not be extremely grateful, emotional, and realize how lucky we are when we see what is happening in Ukraine. Babies are being born in bomb shelters and thousands are evacuating Ukraine as I write this. I cannot fathom what it would be like to have our baby in a situation like what is occurring in Ukraine. We need to build a country that is not reliant on corporations and oil imports for the future sustainability of our country.

America has a problem with oil

America has a major issue regarding how much oil we import. In 2020 we imported 7.86 million barrels of oil. Think for a minute of all the major oil-exporting countries. How many of them do you believe are friendly to the United States?

Oil exporting countries

  1. Saudi Arabia: US$113.7 billion (17.2% of exported crude oil)
  2. Russia: $72.6 billion (11%)
  3. Iraq: $50.8 billion (7.7%)
  4. United States: $50.3 billion (7.6%)
  5. United Arab Emirates: $47.9 billion (7.2%)
  6. Canada: $47.6 billion (7.2%)
  7. Kuwait: $28.3 billion (4.3%)
  8. Nigeria: $25.2 billion (3.8%)
  9. Kazakhstan: $23.7 billion (3.6%)
  10. Norway: $22.7 billion (3.4%)
  11. Angola: $20.2 billion (3.1%)
  12. Brazil: $19.6 billion (3%)
  13. United Kingdom: $16.1 billion (2.4%)
  14. Oman: $15 billion (2.3%)
  15. Mexico: $14.9 billion (2.2%)

Let’s start with Saudia Arabia. In 2018 they decided they would lure Jamal Khashoggi, a journalist for the Washington Post, into an Istanbul consulate and chop him to pieces. The most protected form of free speech should be given to our journalists.

The second on the list is Russia as we speak they are invading Ukraine. Killing and destroying everything in their way. The list of issues goes on…

Oil, energy, and SRP

Let’s get to what all this has to do with our future and the future for our children. There is only one way for the United States to diversify away from our oil imports, electric cars and solar. While solar and electric cars are not perfect they are the best chance we have at diversifying away from our oil imports and reliance on nations not friendly to our country. Note that I said diversify, not eliminate. I don’t think that’s rational as there are necessary use cases for oil that will always exist.

In order for solar to be sustainable, we need something called “net metering” essentially what this means is if you install solar on your house and overproduce electricity on a net annual basis you should only be charged for the net energy that you use (consumption – production). Unfortunately under the current leadership of David Rousseau and John Hoopes, and other corporate cronies this is not happening. They tout on their expensive mailer that they are solar-friendly and their opponents are bought by special interest groups. But one only has to look as far as the amount of money they are spending on their campaigns to know that they are backed by institutional donations. As America forges ahead with the democratization of electricity through rooftop solar installations they are exactly the type of politicians that get in the way. They push for centralized solar like the large-scale solar farms you see in the desert. These installations, while great for the environment, take all the financial benefit for the consumer and only benefit the corporations installing them.

I have 20kw of solar installed on my house. This provides about 100% of my electricity usage a year. Last year we installed solar on my parent’s house. Based on the current SRP plans and not recognizing net metering it kills the ROI for the average homeowner.

Trust Fund Kids and antiquated elections

SRP elections are antiquated and regressive. The more land you own the more votes you get. Yes, you read that right. The more land you own your elite vote suppresses all of the commoners. So if you visit the website of the existing SRP members you’ll see endorsements from trust fund kids who have inherited their money and political positions largely due to family inheritance and their religious connections. That is what allows these people to stay in power.

So as these two corporate shills would say “Keep your eye out” for your ballot this year. But be careful as there is more than meets the eye in the deception of their mailer. Let’s vote for a future for our kids. A future where electricity is decentralized and affordable through solar. Vote for the SRP Clean Energy team.

How to get a ballot

You will not receive a ballot even if you are a registered early voter. SRP has its own early ballot list. You can request one, here.

Important Dates

Wednesday, March 9th early ballots

Friday, March 25th last day to request early ballots

Tuesday, April 5th Election Day

Facebook Comments Box

Opening Github IPYNB files in Google Colab

If you ever want to open a Jupyter notebook that you’re reading in Github you can simply replace the URL from github.com to colab.research.google.com/github and the rest of the address. This will open the IPYNB in Colab for easy saving and editing.

Facebook Comments Box

Saving your Audible books to MP3 using Python, Colab, and AAXtoMP3

If you’re like me and you don’t like having your audiobooks tied up in Audible. There is a way to convert them to MP3.

I wrote some Python code in Google Colab to show this process.

The first thing you’ll want to do is mount Google drive so you have access to your files. This can be done here.

Your working_folder is the location in your Google drive that the files will be backed up to.

working_folder = 'Books/audible_backup'

# <----- Make sure to mount drive in Colab first 
import os
import sys
if 'google.colab' in str(get_ipython()):
  print('Running on CoLab')
  root_dir='/content/drive/My Drive/' + working_folder
  if os.path.isdir(root_dir):
    %cd $root_dir
  else:
    print('Check your working_folder or if Google drive is mounted')
    sys.exit()
  sys.path.append(root_dir)  
  print('Colab code has been executed')
else:
  print('Not running on Colab')

Here is my Google Drive mounted in Windows for comparison

Install the dependencies

!apt-get update
!apt-get install ffmpeg libav-tools x264 x265 bc
!apt-get install mediainfo
!pip install audible
!pip install audible-cli
!pip install ffmpeg
!apt-get install mp4v2-utils
!apt-get install jq
!apt-get install bc

!add-apt-repository ppa:savoury1/ffmpeg4
!apt-get update
!apt-get install ffmpeg
!ffmpeg -version
!apt-get install mp4v2-utils
import os

Run audible-quickstart to attach your Audible account.

!audible-quickstart

Now we’re going to make a backup of all of your audiobooks in AAX and AAXC format.

%cd /content/drive/My Drive/Books/audible_backup
!audible download --all --aax --cover --cover-size 1215 --chapter
!audible download --all --aaxc --cover --cover-size 1215 --chapter

Once you clone all your books to AAX and AAXC files in Google Drive it should look like this.

Now we need your AUTHCODE for your AAX files.

AUTHKEY = !audible activation-bytes
AUTHKEY = AUTHKEY[0]
print(AUTHKEY)

Next, we’ll clone a tool from Github called AAXtoMP3 and make sure it has executable permissions. This tool does all the heavy lifting.

%cd /root
!git clone https://github.com/KrumpetPirate/AAXtoMP3.git
%cd /root/AAXtoMP3
!chmod u+x /root/AAXtoMP3/interactiveAAXtoMP3
!chmod u+x /root/AAXtoMP3/AAXtoMP3

Now that you’ve cloned AAXtoMP3 you can run the following code:

%cd '/content/drive/My Drive/Books/audible_backup'
for filename in os.listdir('/content/drive/My Drive/Books/audible_backup'):
  if filename.endswith('.aaxc'):
    print(filename)
    os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -l 1 -n {filename}')
  if filename.endswith('.aax'):
    print(filename)
    os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -A {AUTHKEY} -l 1 {filename}')

Open In Colab
Facebook Comments Box

Lords of Easy Money and Thomas Hoenig

The FED’s decisions affect every asset you own all the way down to the cost of your everyday grocery purchases. I highly recommend Lords of Easy Money by Christoper Leonard. I would also recommend reading and listening to Thomas M. Hoenig’s positions on the FED policy. He served as the President of the Federal Reserve Bank of Kansas City from 1991 to 2011. This book dives into Thomas Hoenig’s dissenting votes on the FOMC and confirms that the current FED policy is a radical experiment in monetary policy. It has increased wealth inequality by driving up asset prices. Meaning, the people who own assets are getting much wealthier and those who don’t are becoming poorer. It also speaks on the current inflation that we are seeing all around us. There is no easy path out of our current situation.

Facebook Comments Box

Retrieving historical data from FRED or Yahoo Finance using Python

If you spend a lot of time analyzing big data then data retrieval is paramount. I’ve written some Python code that I use daily to retrieve data from Federal Reserve Bank of St. Louis and finance.

The first part of this code simply mounts Google drive so you can interface files on your local computer.

working_folder = 'M2 Correlation'

# <----- Make sure to mount drive in Colab first 

import os
import sys
if 'google.colab' in str(get_ipython()):
  print('Running on CoLab')
  root_dir='/content/drive/My Drive/Colab Notebooks/' + working_folder
  if os.path.isdir(root_dir):
    %cd $root_dir
  else:
    print('Check your working_folder or if Google drive is mounted')
    sys.exit()
  sys.path.append(root_dir)

  %cd $root_dir

  from IPython.display import clear_output 
  clear_output()
  
  print('Colab code has been executed')
else:
  print('Not running on Colab')

Next, we’re going to install some dependencies.

!pip install yfinance
!pip install pandas-datareader

Next, we’ll import some functions

import yfinance as yf
import pandas_datareader as pdr
import pandas as pd
from datetime import datetime, timedelta
from time import time
from tqdm import tqdm
from pathlib import Path
import plotly.graph_objects as go
import plotly.express as px
import logging
import sys
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import os

In this next part of our code, we will specify which assets we want data on from FRED and the beginning and end date. Keep in mind some data will not go back as far as you specify. So you’ll have to deal with these blank rows at a later point in the data analysis.

beginning_date = '1900-01-01'
date_today = datetime.now()
end_date = date_today

fred_assets = {
    'cpi_urban_consumers':'CPIAUCSL',
    'gold':'GOLDPMGBD228NLBM',
    'median_house_price':'MSPUS',
    'used_cars':'CUSR0000SETA02',
    'global_all_commodities':'PALLFNFINDEXQ',
    'global_copper':'PCOPPUSDM',
    'spot_crude':'WTISPLC',
    'global_brent_crude':'POILBREUSDM',
    'ground_beef':'APU0000703112',
    'rubber':'PRUBBUSDM',
    'global_raw_materials':'PRAWMINDEXM',
    'global_energy':'PNRGINDEXM',
    'shrimp':'PSHRIUSDM',
    'bacon':'PSHRIUSDM',
    'soybeans':'PSOYBUSDQ',
    'bread':'APU0000702111',
    'propane_tx':'DPROPANEMBTX',
    'global_iron_ore':'PIORECRUSDM',
    'global_wheat':'PWHEAMTUSDM',
    'eggs':'APU0000708111',
    'corn':'PMAIZMTUSDM',
    'global_aluminum':'PALUMUSDM',
    'global_uranium':'PURANUSDM',
    'global_cotton':'PCOTTINDUSDM',
    'us_diesel':'GASDESW',
    'milk':'APU0000709112',
    'global_rice':'PRICENPQUSDM',
    'global_beef':'PBEEFUSDQ',
    'jet_fuel':'DJFUELUSGULF',
    'global_sugar':'PSUGAISAUSDM',
    'coffee':'PCOFFOTMUSDM',
    'global_nickel':'PNICKUSDM',
    'us_gasoline':'APU000074714',
    'global_poultry':'PPOULTUSDM',
    'global_industrial_metals':'PINDUINDEXM',
    'us_flour':'APU0000701111',
    'global_food':'PFOODINDEXM',
    # 'global_fish':'PSALMUSDA', causing issues
    'global_swine':'PPORKUSDM',
    'us_tomatoes':'APU0000712311',
    'lumber':'WPU081',
    'real_median_personal_income':'MEPAINUSA672N',
    'phoenix-mesa-chandler_house_value':'ATNHPIUS38060Q',
    'california_house_value':'CASTHPI',
    'san_francisco_home_price':'SFXRSA',
    '30_year_fixed_mortgage_rates':'MORTGAGE30US',
    'gdp':'GDP',
    'fed_funds_rate':'FEDFUNDS',
    'case-shiller_us_home_index':'CSUSHPINSA',
    'median_household_income':'MEHOINUSA672N',
    'us_house_sales_price':'ASPUS',
    'corporate_bond_yield':'AAA',
    'personal_consumption_expenditures':'PCE',
    'us_industrial_production':'INDPRO',
    'ppi_all_commodities':'PPIACO',
    'us_average_hourly_earnings':'CES0500000003',
    'commercial_industrial_loans':'BUSLOANS',
    'real_disposable_income':'DSPIC96',
    'deposits_all_commercial_banks':'DPSACBW027SBOG',
    'us_home_ownership_rate':'RHORUSQ156N',
    'housing_units_authorized':'PERMIT',
    'coinbase_bitcoin':'CBBTCUSD',
    'loans_leases_bank_credit':'TOTLLNSA',
    'credit_card_delinquency_rate':'DRCCLACBS',
    'disposable_income_per_capita':'A229RX0',
    'personal_income':'PI',
    'poplulation':'POPTHM',
    'global_copper':'PCOPPUSDM',
    'plywood':'WPU083',
    'personal_consumption_expenditures_durable_goods':'PCEDG',
    'gpn':'GNP',
    'total_net_worth_top_1':'WFRBST01134',
    'us_new_one_family_houses':'HSN1F',
    'us_trade_balance':'BOPGSTB',
    'vix':'VIXCLS',
    'yld_10_yr_trsry':'DGS10',

    
#potential regressors of m2
    'nonfarm_payroll':'PAYEMS',
    'unemployment_rate':'UNRATE',

#potential regressors
    'm2':'M2SL',
    'm3':'MABMM301USM189S',
    'fed_debt':'GFDEBTN',
    'monetary_base':'BOGMBASE',
    'currency_in_circulation':'CURRCIR',
    'm1':'M1SL',
    'real_m2_money_stock':'M2REAL',
    'fed_mbs':'WSHOMCB',
    'fed_total_assets':'WALCL',

          }

yfinance_assets = {
    
#indices
      'SP 500':'^GSPC',
      'Dow 30':'^DJI',
      'Nasdaq':'^IXIC',
      'NYSE COMPOSITE (DJ)':'^NYA',
      'NYSE AMEX COMPOSITE INDEX':'^XAX',
      'Cboe UK 100':'^BUK100P',
      'Russell 2000':'^RUT',
      'CBOE Volatility Index':'^VIX',
      'FTSE 100':'^FTSE',
      'DAX PERFORMANCE-INDEX':'^GDAXI',
      'CAC 40':'^FCHI',
      'ESTX 50 PR.EUR':'^STOXX50E',
      'Euronext 100 Index':'^N100',
      'BEL 20':'^BFX',
      'MOEX Russia Index':'IMOEX.ME',
      'Nikkei 225':'^N225',
      'HANG SENG INDEX':'^HSI',
      'SSE Composite Index':'000001.SS',
      'Shenzhen Component':'399001.SZ',
      'STI Index':'^STI',
      'SP ASX 200':'^AXJO',
      'ALL ORDINARIES':'^AORD',
      'SP BSE SENSEX':'^BSESN',
      'Jakarta Composite Index':'^JKSE',
      'FTSE Bursa Malaysia KLCI':'^KLSE',
      'SP NZX 50 INDEX GROSS':'^NZ50',
      'KOSPI Composite Index':'^KS11',
      'TSEC weighted index':'^TWII',
      'SP TSX Composite index':'^GSPTSE',
      'IBOVESPA':'^BVSP',
      'IPC MEXICO':'^MXX',
      'SP CLX IPSA':'^IPSA',
      'MERVAL':'^MERV',
      'TA-125':'^TA125.TA',
      'EGX 30 Price Return Index':'^CASE30',
      'Top 40 USD Net TRI Index':'^JN0U.JO',

#currency
      'EURUSD':'EURUSD=X',
      'USDJPY':'JPY=X',
      'GBPUSD':'GBPUSD=X',
      'AUDUSD':'AUDUSD=X',
      'NZDUSD':'NZDUSD=X',
      'EURJPY':'EURJPY=X',
      'GBPJPY':'GBPJPY=X',
      'EURGBP':'EURGBP=X',
      'EURCAD':'EURCAD=X',
      'EURSEK':'EURSEK=X',
      'EURCHF':'EURCHF=X',
      'EURHUF':'EURHUF=X',
      'EURJPY':'EURJPY=X',
      'USDCNY':'CNY=X',
      'USDHKD':'HKD=X',
      'USDSGD':'SGD=X',
      'USDINR':'INR=X',
      'USDMXN':'MXN=X',
      'USDPHP':'PHP=X',
      'USDIDR':'IDR=X',
      'USDTHB':'THB=X',
      'USDMYR':'MYR=X',
      'USDZAR':'ZAR=X',
      'USDRUB':'RUB=X',


#futures
      '10-Year T-Note Futures,Mar-2022':'ZN=F',
      'E-Mini SP 500 Mar 22':'ES=F',
      'Five-Year US Treasury Note Futu':'ZF=F',
      'Nasdaq 100 Mar 22':'NQ=F',
      'Crude Oil':'CL=F',
      '2-Year T-Note Futures,Mar-2022':'ZT=F',
      'U.S. Treasury Bond Futures,Mar-':'ZB=F',
      'Natural Gas Mar 22':'NG=F',
      'E-mini Russell 2000 Index Futur':'RTY=F',
      'Mini Dow Jones Indus.-$5 Mar 22':'YM=F',
      'Corn Futures,May-2022':'ZC=F',
      'Gold':'GC=F',
      'Sugar #11 May 22':'SB=F',
      'Soybean Futures,May-2022':'ZS=F',
      'Copper Mar 22':'HG=F',
      'RBOB Gasoline Mar 22':'RB=F',
      'Heating Oil Mar 22':'HO=F',
      'Silver':'SI=F',
      'Soybean Oil Futures,May-2022':'ZL=F',
      'Brent Crude Oil Last Day Financ':'BZ=F',
      'Soybean Meal Futures,May-2022':'ZM=F',
      'Micro Gold Futures,Apr-2022':'MGC=F',
      'Cocoa May 22':'CC=F',
      'KC HRW Wheat Futures,Mar-2022':'KE=F',
      'Coffee May 22':'KC=F',
      'Lean Hogs Futures,Apr-2022':'HE=F',
      'Cotton May 22':'CT=F',
      'Platinum Apr 22':'PL=F',
      'Live Cattle Futures,Apr-2022':'LE=F',
      'Feeder Cattle Futures,Mar-2022':'GF=F',
      'Micro Silver Futures,Mar-2022':'SIL=F',
      'Palladium Mar 22':'PA=F',
      'Orange Juice May 22':'OJ=F',
      'Rough Rice Futures,May-2022':'ZR=F',
      'Oat Futures,May-2022':'ZO=F',
      'Random Length Lumber Futures':'LBS=F',
      'Mont Belvieu LDH Propane (OPIS)':'B0=F',


# #etf
      'SPDR SP 500 ETF Trust':'SPY',
      'iShares Core SP 500 ETF':'IVV',
      'Vanguard Total Stock Market ETF':'VTI',
      'Vanguard SP 500 ETF':'VOO',
      'Invesco QQQ Trust':'QQQ',
      'Vanguard FTSE Developed Markets ETF':'VEA',
      'iShares Core MSCI EAFE ETF':'IEFA',
      'Vanguard Value ETF':'VTV',
      'iShares Core U.S. Aggregate Bond ETF':'AGG',
      'Vanguard Total Bond Market ETF':'BND',
      'Vanguard FTSE Emerging Markets ETF':'VWO',
      'Vanguard Growth ETF':'VUG',
      'iShares Core MSCI Emerging Markets ETF':'IEMG',
      'iShares Core SP Small-Cap ETF':'IJR',
      'iShares Russell 1000 Growth ETF':'IWF',
      'Vanguard Dividend Appreciation ETF':'VIG',
      'iShares Core SP Mid-Cap ETF':'IJH',
      'iShares Russell 2000 ETF':'IWM',
      'SPDR Gold Shares':'GLD',
      'iShares Russell 1000 Value ETF':'IWD',
      'iShares MSCI EAFE ETF':'EFA',
      'Vanguard Total International Stock ETF':'VXUS',
      'Vanguard Mid-Cap ETF':'VO',
      'Vanguard Information Technology ETF':'VGT',
      'Financial Select Sector SPDR Fund':'XLF',
      'Vanguard Total International Bond ETF':'BNDX',
      'Vanguard Intermediate-Term Corporate Bond ETF':'VCIT',
      'Vanguard Real Estate ETF':'VNQ',
      'Technology Select Sector SPDR Fund':'XLK',
      'Vanguard Small Cap ETF':'VB',
      'iShares Core SP Total U.S. Stock Market ETF':'ITOT',
      'Vanguard High Dividend Yield Index ETF':'VYM',
      'Vanguard Short-Term Bond ETF':'BSV',
      'Vanguard Short-Term Corporate Bond ETF':'VCSH',
      'iShares TIPS Bond ETF':'TIP',
      'iShares iBoxx $ Investment Grade Corporate Bond ETF':'LQD',
      'Vanguard FTSE All-World ex-US Index Fund':'VEU',
      'iShares SP 500 Growth ETF':'IVW',
      'Health Care Select Sector SPDR Fund':'XLV',
      'Energy Select Sector SPDR Fund':'XLE',
      'Schwab U.S. Large-Cap ETF':'SCHX',
      'Schwab US Dividend Equity ETF':'SCHD',
      'Invesco SP 500® Equal Weight ETF':'RSP',
      'iShares Core MSCI Total International Stock ETF':'IXUS',
      'SPDR Dow Jones Industrial Average ETF Trust':'DIA',
      'iShares Russell 1000 ETF':'IWB',
      'iShares Gold Trust':'IAU',
      'iShares MSCI Emerging Markets ETF':'EEM',
      'iShares Russell Midcap ETF':'IWR',
      'Schwab International Equity ETF':'SCHF',
      'iShares MSCI USA Min Vol Factor ETF':'USMV',
      'Vanguard Large Cap ETF':'VV',
      'Vanguard Small Cap Value ETF':'VBR',
      'iShares National Muni Bond ETF':'MUB',
      'iShares MBS ETF':'MBB',
      'Vanguard Total World Stock ETF':'VT',
      'iShares SP 500 Value ETF':'IVE',
      'iShares ESG Aware MSCI USA ETF':'ESGU',
      'iShares 1-5 Year Investment Grade Corporate Bond ETF':'IGSB',
      'iShares Core Dividend Growth ETF':'DGRO',
      'iShares MSCI USA Quality Factor ETF':'QUAL',
      'Schwab U.S. Broad Market ETF':'SCHB',
      'Vanguard FTSE Europe ETF':'VGK',
      'iShares 1-3 Year Treasury Bond ETF':'SHY',
      'Schwab U.S. TIPS ETF':'SCHP',
      'SPDR SP Dividend ETF':'SDY',
      'iShares Select Dividend ETF':'DVY',
      'Consumer Discretionary Select Sector SPDR Fund':'XLY',
      'Vanguard Short-Term Inflation-Protected Securities ETF':'VTIP',
      'SPDR SP Midcap 400 ETF Trust':'MDY',
      'iShares Preferred Income Securities ETF':'PFF',
      'ProShares UltraPro QQQ':'TQQQ',
      'iShares J.P. Morgan USD Emerging Markets Bond ETF':'EMB',
      'JPMorgan Ultra-Short Income ETF':'JPST',
      'iShares iBoxx $ High Yield Corporate Bond ETF':'HYG',
      'iShares MSCI ACWI ETF':'ACWI',
      'Industrial Select Sector SPDR Fund':'XLI',
      'iShares 7-10 Year Treasury Bond ETF':'IEF',
      'iShares Core Total USD Bond Market ETF':'IUSB',
      'iShares MSCI EAFE Value ETF':'EFV',
      'iShares U.S. Treasury Bond ETF':'GOVT',
      'Vanguard Health Care ETF':'VHT',
      'Vanguard Mid-Cap Value ETF':'VOE',
      'iShares 20+ Year Treasury Bond ETF':'TLT',
      'Schwab U.S. Small-Cap ETF':'SCHA',
      'Schwab U.S. Large-Cap Growth ETF':'SCHG',
      'iShares MSCI USA Value Factor ETF':'VLUE',
      'Vanguard Mortgage-Backed Securities ETF':'VMBS',
      'Vanguard Extended Market ETF':'VXF',
      'iShares Russell 2000 Value ETF':'IWN',
      'Consumer Staples Select Sector SPDR Fund':'XLP',
      'Vanguard Tax-Exempt Bond ETF':'VTEB',
      'iShares Russell Mid-Cap Value ETF':'IWS',
      'SPDR Bloomberg 1-3 Month T-Bill ETF':'BIL',
      'Dimensional U.S. Core Equity 2 ETF':'DFAC',
      'iShares MSCI EAFE Small-Cap ETF':'SCZ',
      'Vanguard Intermediate-Term Bond ETF':'BIV',
      'Vanguard Short-Term Treasury ETF':'VGSH',
      'Vanguard Small Cap Growth ETF':'VBK',
      'iShares Short Treasury Bond ETF':'SHV',


# stocks
      'Berkshire Hathaway':'brk-a',
      'Johnson and Johnson':'jnj',
      'abnb':'abnb',
      'adbe':'adbe',
      'crwd':'crwd',
      'dis':'dis',
      'fvrr':'fvrr',
      'gm':'gm',
      'msft':'msft',
      'shop':'shop',
      'spot':'spot',
          }

Retrieving code from yfinance is slightly different so we’ll specify those assets next. You can download almost any stock, index, or ETF you want from Yahoo Finance.

yfinance_assets = {
    
#index
    'spy500':'^gspc',
    'nasdaq':'^IXIC',
    'nasdaq_100':'^NDX',
    'djia':'^DJI',
    'wilshire5000':'^W5000',
    'nasdaq':'^IXIC',
    'russell_2000':'^RUT',



# #etf
      'etf_djia':'DIA', #mega
      'etf_large_cap':'SPY', #large cap
      'etf_mid_cap':'IJH', #mid cap
      'etf_small_cap':'IWO', #small cap
      'etf_mall_cap_value':'VBR', #small cap value
      'etf_small_cap_growth':'VBK', #small cap growth
      'etf_micro_cap':'IWM', #micro cap
      'etf_emerging_markets':'VEIEX', #emerging markets
      'etf_reit':'IYR', #reit 
      'etf_high_yield_bonds':'HYG', #high yield bonds
      'etf_investment_grade_bonds':'LQD', #investment grade bonds
      'etf_gld':'GLD', #gold etf
      'etf_nasdaq':'QQQ', #nasdaq etf
      'etf_total_market':'VTI', #etf total market

          }

I don’t like downloading all my data every day. So this function I wrote backs up your dataframe.

def save_df(temp_df, filename):
  pd.to_pickle(df,f'{filename}.pkl')
  temp_df.to_csv(f'{filename}.csv')

This section of code will not only plot the asset so you can visually diagnose it but it will save it to your Google drive in a subfolder.

def plot_and_save(df_temp,folder_name):
  for col in df_temp.columns:
    df_temp2 = pd.DataFrame()
    df_temp2 = df_temp[f'{col}']
    df_temp2.dropna(axis='rows', inplace=True)
    fig = px.line(df_temp2, x=df_temp2.index, y=f'{col}', color_discrete_sequence=['red'])
    try:
      fig.write_html(f'{folder_name}/{col}.html')
    except:
      os.makedirs(f'{folder_name}')
      fig.write_html(f'{folder_name}/{col}.html')
    #comment out to save memory
    fig.show()

Here’s the code to retrieve all your FRED data.

def get_fred_prices(assets):
  df_temp = pd.DataFrame(index=pd.date_range(start=beginning_date,end=end_date,freq='D'))
  # df_yearly = pd.DataFrame(index=pd.date_range(start=beginning_date,end=end_date,freq='A'))
  for key, value in assets.items():
    print('Getting {} with symbol {}'.format(key, value))
    try:
      df_temp[f'{key}'] = pdr.DataReader(f'{value}','fred',beginning_date,date_today)
    except:
      print('Error getting {}'.format(value))
    df_temp.ffill(inplace=True)
  return(df_temp)

Here is the code to retrieve all your yfinance data.

def get_yfinance_prices(assets):
  df_temp = pd.DataFrame(index=pd.date_range(start=beginning_date,end=end_date,freq='D'))
  for key, value in assets.items():
    print('Getting {} with symbol {}'.format(key, value))
    try:
      df_temp[f'{key}'] = yf.download(f'{value}',beginning_date,date_today,progress=True).drop(columns=['Open','High','Low','Close','Volume'])
    except:
      print('Error getting {}'.format(value))
    df_temp.ffill(inplace=True)
  return(df_temp)

And finally, a function to bring all your data together.

def get_asset_prices(filename):
  df_fred = get_fred_prices(fred_assets)
  df_yfinance = get_yfinance_prices(yfinance_assets)
  df = pd.concat([df_fred, df_yfinance], axis=1)
  return(df)

This is the code that will actually retrieve your data. It will also drop all the lines that are completely blank. Then it saves the dataframe and proceeds with plotting the data

df = get_asset_prices('asset_prices')
df.dropna(how='all', inplace=True)
save_df(df, 'asset_prices')
df = pd.read_pickle("asset_prices.pkl")
plot_and_save(df,'asset_prices')

Here is a sample of one of the downloads:

Now that we’ve downloaded the data we want a visualization of the data so we can see chunks of missing data. missingno is a great tool for that. Keep in mind I forward filled the assets in a previous function. What this means is that if the stock market closes on Friday it will show the price of the asset to be the same on Saturday and Sunday.

So think of this chart below as the left being today and the right being 1900. You can see some data from these sources is only available for short time frames, shorter the bar. In this example, you can see there is complete data for producer price index for commodities.

import missingno as msno
msno.bar(df)

Let’s take a quick look at the first few rows of the data below. You can see most of the data from 1913 is NaN. This means it doesn’t exist in your dataframe. I will talk about cutting out this data later so you don’t have a bunch of empty datasets.

df.head()

And finally, we’ll look at the information of the dataframe

df.info()

That’s it you’ve downloaded your asset prices and they are all contained in one dataframe and ready for further modification and analysis.

Facebook Comments Box

Do the poor own stocks?

I’m sitting here doing some completely unrelated research and I stumbled across this figure which I’ve seen multiple times in the past. It has always surprised me. As the markets become extremely volatile this month I wonder, what is the impact on the bottom 50% of Americans? If you look at this chart it barely even registers when stacked with other assets. Real estate is their primary asset.

What’s interesting is if you look at this breakdown by percentile historically. The top 10% own 89% of all equities. While the entire bottom 50% own just .6%.

Now let’s take a look at the top 50% vs. the bottom 50%. We already know the bottom 50% of Americans own just .6% of equities. The top 50% own 99.4% of the balance of equities.

If you’re looking for the source of political turmoil in our country I don’t think we need to look much further than the wealth gap. Half of our population has no vested interest in corporations in America. I can’t imagine turmoil subsides any time soon for our country until we address the wealth gap.

Facebook Comments Box

What’s a better investment stocks or real estate? Let’s write some Python code.

I was recently chatting with a buddy about investing in real estate or stocks and which was better. I decided to use Python to analyze what that investment would look like. I used data from FRED and yfinance which is one of my favorite sources for historical data. Although they do not offer smaller timeframes.

The first thing I’m going to do is set the dates I’m interested in.

beginning_date = '1900-01-01'
date_today = datetime.now()
end_date = date_today

I’m not going to use FRED and YFinance which are two Python plugins to download historical data.

df = yf.download('^gspc',beginning_date,date_today,progress=True).drop(columns=['Open','High','Low','Close','Volume']).rename(columns={'Adj Close':'SP500'})
df = df.rename(columns={'Adj Close':'SP500'})

df['MSPUS'] = pdr.DataReader('MSPUS','fred',beginning_date,date_today)
df = df.rename(columns={'MSPUS':'Median_House_price'})

The stock market index symbol from Yahoo is ^gspc as you can see in the code above. The median house price is MSPUS from FRED.

df = df.ffill(axis=0)

df['Median_House_price_pct_change'] = df['Median_House_price'].pct_change()*100
df['SP500_pct_change'] = df['SP500'].pct_change()*100
df = df.dropna()

df['Median_House_price_pct_change_cumsum'] = df['Median_House_price_pct_change'].cumsum()
df['SP500_pct_change_cumsum'] = df['SP500_pct_change'].cumsum()
df = df.dropna()

df['spread'] = df['SP500_pct_change_cumsum'].sub(df['Median_House_price_pct_change_cumsum'])


df.tail(20)

The Median house price data is quarterly so I’m using ffill to forward fill the data.

What I’m essentially doing next is creating columns in my DataFrame for the following:

  • Percent change of asset * 100 to get the return as a percentage.
  • Cumultively summing all of the returns to get a percentage of return from a specific date.
  • Calculating the rolling spread between the two assets.

My DataFrame now looks like this.

If I plot the cumulative sum I get this.

fig1 = px.line(df, x=df.index, y='Median_House_price_pct_change_cumsum', color_discrete_sequence=['red'])
fig2 = px.line(df, x=df.index, y='SP500_pct_change_cumsum', color_discrete_sequence=['blue'])

fig3 = go.Figure(data=fig1.data + fig2.data)
fig3.show()

This shows stocks overall since 1963 have outperformed housing.

  fig1 = px.line(df, x=df.index, y='spread', color_discrete_sequence=['red'])
  fig1.show()

This code actually plots the spread between the two assets.

Now I’m going to create some more columns in my DataFrame

df_annual=pd.DataFrame()
df_annual['SP500_pct_change'] = df['SP500_pct_change'].resample('1A').sum()
df_annual['Median_House_price_pct_change'] = df['Median_House_price_pct_change'].resample('1A').sum()
df_annual['SP500_pct_change_cumsum'] = df_annual['SP500_pct_change'].cumsum()
df_annual['Median_House_price_pct_change_cumsum'] =  df_annual['Median_House_price_pct_change'].cumsum()
df_annual.dropna(inplace=True)
df_annual['YoY_spread'] = df_annual['SP500_pct_change'].sub(df_annual['Median_House_price_pct_change'])
df_annual['cumulative_spread'] = df_annual['SP500_pct_change_cumsum'].sub(df_annual['Median_House_price_pct_change_cumsum'])

df_annual.drop(df_annual.index[-1],inplace=True)

What I’m doing here is resampling my data to annual as it is broken down currently by quarter. The main difference in this code is I’m computing an annual year-over-year return of S&P 500 vs. median house price in the United States. Here is the new DataFrame header.

I’m going to replot this data using the annualized data. Should be almost identical to my first chart.

fig1 = px.line(df_annual, x=df_annual.index, y='Median_House_price_pct_change_cumsum', color_discrete_sequence=['red'])
fig2 = px.line(df_annual, x=df_annual.index, y='SP500_pct_change_cumsum', color_discrete_sequence=['blue'])

fig3 = go.Figure(data=fig1.data + fig2.data)
fig3.show()

And finally, I’m computing the annualized year-over-year spread between S&P 500 and median housing prices. This gives a better idea of the annual returns as opposed to the cumulative returns. Where the bar graph is above 0 indicates the stock market outperformed real estate that year. If the bar is below 0 that indicates the real estate market outperformed the stock market.

And finally the cumulative spread.

Facebook Comments Box

ValueError: cannot set WRITEABLE flag to True of this array

If you’re getting this error when trying to read a simple .h5 file. Change your code when you originally create the .h5 file to specify format=’table’ This should resolve the issue.

This code does not work


This code does work


Facebook Comments Box

Get thousands in repair costs if your vehicle was damaged on the US60 back in November

If you’re like me and live east of the US60 there is a good chance you were driving home one random day in November only to be hit with a barrage of rocks and other asphalt materials. The cause of this was neglect by ADOT when they ripped off the asphalt layer of the freeway and didn’t clean it up properly. If you drove through this you can get the repairs paid for by the state of Arizona. Below is how I filed my claim.

Here are the steps:

  • Fill out this form – NOTICE OF CLAIM AGAINST THE STATE OF ARIZONA
  • Get quotes to fix your vehicle and include them
  • Take a picture of the damage print it out and send it with the form
  • Take a picture of your registration and send it with the form
  • Take a picture of your license plate and send it with the form
  • Google tracks everywhere you go if this feature is turned on using something called Google Maps Timeline. I would include this as well showing travel through the area on that specific day. I don’t know if this is necessary but it makes it a lot harder to refudiate your claim. Here is my sample that I included.
  • Mail all of this to the Attorney General and if he’s not busy playing with nunchucks that day the state will send out an insurance adjuster they will then ask you to sign a form called “RELEASE OF ALL CLAIMS” and if everything checks out you will receive a check in the mail for your repairs.

And last step, cash check.

Facebook Comments Box

The annoyance of Arizona politicians endlessly bashing California to pander to Arizona citizens

I’m reading this article tonight on the Wall Street Journal where Mark Brvnovich ignorantly tries to bash California in an attempt to somehow boost his own *accomplishments.

He uses this NRF organized retail crime survey on two occasions to bash California. He states the following:

According to a 2020 survey by the National Retail Federation, three of the top 10 cities affected by organized retail crimes are in California.

We expect our efforts will deter such theft and hope our task force becomes a model for California and other states.

Here is the actual report he’s referencing.

The issue with this report is there’s an almost perfect correlation to the cities impacted by crime and the largest cities by GDP. You can compare the list yourself here.

This clearly isn’t a problem associated to policy as much as it is just a problem that comes with having a successful local economy. Perhaps instead of pointlessly bashing our neighbors to gain political points we could just focus on ourselves? Please Arizona can we just start electing normal human beings to our run our state?

Facebook Comments Box

Send SMS alerts from your trading algorithms in Python

Occasionally there may be some important alerts that you want your trading algorithms to send to you that require immediate attention. One that I use frequently is daily account drawdown. Here’s how you can set up Twilio to send you a text message when your account enters a certain percentage of drawdown.

Head over to Twilio

You do need to purchase a number to text from. It costs $1/month. You can find that here.

You’ll now need to go to your general settings page to retrieve your live credentials.

The next step is to install Twilio on your operating system. I use Ubuntu this can be done with the following command

sudo pip3 install twilio

Great now you’re ready to code.

The first thing you want to do is write a simple Python script to test your message sending capabilities. In the below code you’ll want to change a few variables:

account_sid – Change with your Twilio information found on your account page.

Auth_token – Change with your Twilio information found on your account page.

Using the format +19998887777 change to_num to your cell

Using the format +19998887777 change from_num to your Twilio phone number

def send_sms(to_num,from_num,body_message):
    import os
    from twilio.rest import Client

    account_sid = 'Enter your account sid here'
    auth_token = 'Enter your account token here'
    client = Client(account_sid, auth_token)

    try:
        message = client.messages.create(
            to=to_num,
            from_=from_num,
            body=body_message
        )

        print(message.sid)
    except Exception as e:
        print(e)

if __name__ == '__main__':
    send_sms(+14809999999,+17149999999,'test')

Now that we have a function that can send text messages we just need to incorporate this into our code.

Facebook Comments Box

Setting up Python algos to run on Ubuntu startup using systemd

If you’re running your trading algorithms on Linux the best way to get them to start on bootup is to use a service called systemd. Here are the steps on setting that up.

Go to:

/etc/systemd/system


Then create a new service as root:



sudo nano trading_algo_23.service


Here is a sample of what the file should look like. You can find your account name by using the command whoami in linux



[Unit]
Description=This algo is designed to hedge...



User=your username
WorkingDirectory=/directory/of/algo
ExecStart=/usr/bin/python3  /directory/of/algo/algo_23.py
Restart=always



[Install]
WantedBy=multi-user.target

Now reload systems

sudo systemctl daemon-reload


Enable the service

sudo systemctl enable

Start your script:

sudo systemctl start trading_algo_23.service


Check the status:

sudo systemctl status trading_algo_23.service

Facebook Comments Box

Setting up Python algos to run on Ubuntu startup using crontab

If you’re using Ubuntu or some other flavor of Linux you more than likely want your algorithm to start with the server. This is a pretty straightforward process.

The first thing you’ll want to do is make sure cron is installed

sudo apt-get update
sudo apt-get install cron

Next run crontab -e select nano when it asks which editor. The code below can be used as a template The first two lines are just writing the current date to the log files on reboot so you know when the server was restarted.

@reboot date >> /home/me_jeremywhittaker_com/AAII/log.txt
@reboot date >> /home/me_jeremywhittaker_com/AAII/errors.txt

    

I actually am running two scripts for this particular strategy. Each one gets its own line of code. This basically tells it to run on on startup @reboot then the path to the script to execute,

@reboot /home/me_jeremywhittaker_com/queen_of_stonks/queen_of_stonks_monitor.py >> /home/me_jeremywhittaker_com/queen_of_stonks/logs.txt 2>> /home/me_jeremywhittaker_com/queen_of_stonks/errors.txt 

@reboot /home/me_jeremywhittaker_com/queen_of_stonks/queen_of_stonks_trade.py >> /home/me_jeremywhittaker_com/queen_of_stonks/logs.txt 2>> /home/me_jeremywhittaker_com/queen_of_stonks/errors.txt

That’s it. We can now do a sudo reboot and our scripts should start with our server and save to the log files indicated.

Facebook Comments Box

Earn 7.12% on money sitting in your checking or savings account and hedge against inflation, risk-free, here’s how.

If you’re like me you probably have money sitting in your checking, savings, or money-market account. Paying practically zero interest and getting eaten alive by inflation. Here’s what you can do to earn 7.12% on that money and get inflation-adjusted returns on your excess cash.

Yield on savings and checking accounts are horrible

If you’re like me you’re probably trying to move your liquid funds around into these high-yield savings accounts which aren’t exactly keeping up with inflation. In fact, to date, the highest I can find is LendingClub at 0.60%

Inflation is a regressive tax on the poor and middle class

The annual inflation rate in the US has surged to 6.2% in October to 2021 according to the US Bureau of Labor and Statistics. This means your buying power is dropping significantly if you are holding on to cash. You of course know this if you have bought anything recently.

Use I bonds for risk-free inflation-adjusted return on your cash

To get the 7.12% yield you can buy I bonds which are backed by the United States government. They are inflation-adjusted. Meaning, you’re not technically building any wealth but you’re also not allowing the government to steal it through inflation. You can read more about how the rate is calculated here.

  • I bonds are an excellent investment rather than holding cash
  • They are exempt from state and local taxes
  • Subject to federal taxes.
  • Tax-deferred until you redeem them.
  • Mature in 30-years or until you redeem them
  • Redeemable after the first year of purchase
  • Early redemption is penalized with 3-months worth of interest
  • Interest is compounded every 6-months
  • Your money is locked up for a duration of 1-year

Historical I bond rates

Period when you bought
your I bond
Composite rate for your six-month earning period starting during November 2021 – April 2022
(See “When does my bond change rates?”)
FromThrough
Nov. 2021Apr. 20227.12%
May 2021Oct. 20217.12%
Nov. 2020Apr. 20217.12%
May 2020Oct. 20207.12%
Nov. 2019Apr. 20207.33%
May 2019Oct. 20197.64%
Nov. 2018Apr. 20197.64%
May 2018Oct. 20187.43%
Nov. 2017Apr. 20187.22%
May 2017Oct. 20177.12%
Nov. 2016Apr. 20177.12%
May 2016Oct. 20167.22%
Nov. 2015Apr. 20167.22%
May 2015Oct. 20157.12%
Nov. 2014Apr. 20157.12%
May 2014Oct. 20147.22%
Nov. 2013Apr. 20147.33%
May 2013Oct. 20137.12%
Nov. 2012Apr. 20137.12%
May 2012Oct. 20127.12%
Nov. 2011Apr. 20127.12%
May 2011Oct. 20117.12%
Nov. 2010Apr. 20117.12%
May 2010Oct. 20107.33%
Nov. 2009Apr. 20107.43%
May 2009Oct. 20097.22%
Nov. 2008Apr. 20097.84%
May 2008Oct. 20087.12%
Nov. 2007Apr. 20088.36%
May 2007Oct. 20078.47%
Nov. 2006Apr. 20078.57%
May 2006Oct. 20068.57%
Nov. 2005Apr. 20068.16%
May 2005Oct. 20058.36%
Nov. 2004Apr. 20058.16%
May 2004Oct. 20048.16%
Nov. 2003Apr. 20048.26%
May 2003Oct. 20038.26%
Nov. 2002Apr. 20038.78%
May 2002Oct. 20029.19%
Nov. 2001Apr. 20029.19%
May 2001Oct. 200110.23%
Nov. 2000Apr. 200110.64%
May 2000Oct. 200010.85%
Nov. 1999Apr. 200010.64%
May 1999Oct. 199910.54%
Nov. 1998Apr. 199910.54%
Sept. 1998Oct. 199810.64%

Here’s how you can buy I bonds

The first step is to sign up for a TreasuryDirect account which can be done here.

Once your account is set up you can log in here. You should have received your account number via email confirmation.

Once logged in you’ll see this screen.

Click on the BuyDirect option at the top. You’ll want to select series I bonds.

The most you can buy per social security number is $10,000/year

That’s it. Click submit.

And finally your confirmation page. Pretty simple and straightforward process.

Have kids?

If you have kids you can gift $10,000/year to them as well in I bonds. Read more on gifting I bonds here.

Want to purchase $5,000 more in I bonds every year?

You are also allowed to buy an additional $5,000 worth of I bonds every year with your tax return. That is of course if you have a tax return. You can do this by overpaying your taxes intentionally to the IRS via their website, here. I wouldn’t overpay by exactly $5,000 but probably an amount over. You can read more of the details on that process here. They are going to send you paper I bonds so you will want to convert them and attach them to your online account for ease of management. You buy I bonds with your tax return by submitting tax form 8888 with your taxes

Converting your I bonds to treasury direct electronic format

Directions on this process can be found on the treasury direct website, here.

You will need to create a conversion account one time.

You then need to create a registration list that matches the paper bond ownership that is printed on the paper bonds.

Facebook Comments Box

Used car as an investment?

With inflation running rampant you could actually justify the purchase of a used car as an investment… Crazy when you think about it.

https://fred.stlouisfed.org/series/CUSR0000SETA02
Facebook Comments Box

How to enable Python API in Interactive Brokers Trader Workstation

You’re going to want to open Interactive Brokers trader workstation as normal. Then head over to edit>Global Configuration and check that first box.

Enable ActiveX and Socket Clients

The next thing you’ll want to download is the API’s found here – http://interactivebrokers.github.io/

Next, open the command prompt as an administrator and switch directories where you installed it.

d:

D:\TWS API\source\pythonclient

python setup.py install

You will see this if it is completed successfully

Installed c:\program files\python39\lib\site-packages\ibapi-9.76.1-py3.9.egg
Processing dependencies for ibapi==9.76.1
Finished processing dependencies for ibapi==9.76.1

D:\TWS API\source\pythonclient>

I use IntelliJ to to test I’m going to run a simple command

import ibapi

You can see it ran successfully.

So let’s test a little further.

I’m going to run the following Python code

import ibapi

from ibapi.client import EClient
from ibapi.wrapper import EWrapper

class IBapi(EWrapper, EClient):
def __init__(self):
EClient.__init__(self, self)

app = IBapi()
app.connect('172.16.105.5', 7496, 123)


app.run()

import time
time.sleep(2)
app.disconnect()

This shows it was successful

“C:\Program Files\Python39\python.exe” “G:/My Drive/IdeaProjects/interactive_brokers/interactive_brokers_api_test.py”
ERROR -1 2104 Market data farm connection is OK:usfarm.nj
ERROR -1 2104 Market data farm connection is OK:cashfarm
ERROR -1 2104 Market data farm connection is OK:usfarm
ERROR -1 2106 HMDS data farm connection is OK:euhmds
ERROR -1 2106 HMDS data farm connection is OK:fundfarm
ERROR -1 2106 HMDS data farm connection is OK:ushmds
ERROR -1 2158 Sec-def data farm connection is OK:secdefnj

Facebook Comments Box

Shorting stocks to protect your home’s equity without selling your house

Almost everyone in the United States who owns a home has seen a massive increase in the equity of their house. In the Phoenix metro area, we have seen massive gains. For instance, a house I purchased 1-year ago has seen around a 50% increase in value. Today I was discussing with a friend his options for protecting his equity shorting housing stocks rather than selling his primary residence.

Let’s take a look at the Case-Shiller and Zillow estimates for our local Phoenix market.

Phoenix has been one of the hottest real estate markets over the last few years. In addition, we have seen a huge population increase in Arizona.


2020 Population
2010 Population+ People+ %
Utah3,271,6162,763,885507,73118.4
Idaho1,839,1061,567,582271,52417.3
Texas29,145,50525,145,5613,999,94415.9
North Dakota779,094672,591106,50315.8
Nevada3,104,6142,700,551404,06315
Colorado5,773,7145,029,196744,51814.8
District of Columbia689,545601,72387,82214.6
Florida21,538,18718,801,3102,736,87714.6
Washington7,705,2816,724,540980,74114.6
Arizona7,151,5026,392,017759,48511.9
South Carolina5,118,4254,625,364493,06110.7
Georgia10,711,9089,687,6531,024,25510.6
Oregon4,237,2563,831,074406,18210.6
Delaware989,948897,93492,01410.2

But are the prices high? I was to pause for a minute and look at the median sales price overlayed on the median family income. You have to normalize the price of a house. Given that people by houses a fair way to normalize this variable is to make it relative to the income of the average family or individual if you prefer.

You can also use the median sales price of a house as the numerator and income as the denominator. This creates an oscillating indicator in which the peaks show the high price values and the troughs show the low price values. Do keep in mind this does not adjust for interest rates. This is a much more complicated formula so I won’t dive into this deeper. However, I do believe it is extremely relevant. Also, the data available on FRED isn’t updated to 2021 yet. So all of the appreciation we’ve seen in the last year or so is not accounted for in these charts. If I had to guess house prices are up significantly more than income.

I have heard a lot of people talk about selling their houses to capture the appreciation value because they “know” the prices will come back down. This is an extremely speculative comment but it’s one that I’ll entertain. In fact, I’ve thought about selling some houses as well. But know speculating with your primary residence is risky.

I want to outline some basic math here for anyone who is thinking about selling their house and the true cost. Let’s say you have a house that is now worth $400,000. You paid $200,000 initially. You now have $200,000 in equity. However, if you were to sell this house you’re looking at commissions for the buying and selling realtor plus miscellaneous fees. Let’s call this a total of 8%. It’s going to cost you roughly $32,000 to sell this house. Not to mention all of the other stress that comes with moving. This $32,000 represents almost 16% of your equity. You’re going to lose 16% of your equity if you make this move.

So let’s talk about creating a market-neutral position by short-selling residential construction companies in Arizona. I did not perform a comprehensive search for residential construction companies in Arizona. But I was able to pull up 6 publicly traded residential construction companies pretty quickly. Below you will find their 1-year return charts.

So let’s say you want to protect your $200,000 in equity as in the previous example. You could open short-sale positions in all of these stocks evenly. I highly recommended against short-selling one stock with any large percentage of your portfolio. The reason why is the downside loss is infinite. Short selling is extremely dangerous. The math for short selling these stocks is evenly balanced is pretty straightforward. You take your $200,000 and divide it by 6. This gives you $33,333 that you will want to short of each stock. You then take this number and divide it by the share price of the stock. In the last example, Toll Brothers is selling for $63.48. This would mean you would sell short 525 shares of this stock. So what we have essentially done here is make the determination that these stocks represent the value of house prices or that they have a high cointegration to house prices. Therefore if the housing prices go up you will lose money on your short and gain money on your house’s equity. Likewise, if housing prices go down you will make money on your short and lose money on your house’s equity. This puts you in what is called a market-neutral position. This occurs when you find highly cointegrated assets and place trades in opposite directions. Inherently you are long your house because you own it. So what we’re trying to accomplish is a short position equal to the value of your house. Or equal to the value of your equity.

There are also a few other techniques that I will not go into in this article.

  • I would recommend analyzing the short interest ratio of the stocks you plan on shorting. This is the open short interest divided by the daily trading volume.
  • Resaearch out of the money put options. This is a much cheaper way to make this bet with a limited downside risk. But options require a lot of effort and research.
  • Instead of short selling specific stocks you can short sell the entire residential construction industry through different ETFs like XHB, HOMZ, or PKB.
Facebook Comments Box

Delta Variant is Coming and I’m not Concerned.

If you look at the cases of the Delta variant of Covid coming out of the UK it looks alarming and it appears we’re getting ready to get another wave of Covid to shut down the world. But not so fast.

Let’s take a look at the hospitalization and the death rate.

Hospitalizations are clearly ticking up but clearly not with the velocity of the infection rate.

Death rate although lagging appears to be the same.

Pretty flat given what the first and second waves did to the UK.

One of two things are happening. Either A, the delta variant is not as deadly. Or B, the vaccinations are working.

But what about the kids? Kids or people under 20 haven’t really been impacted by Covid. Deaths aren’t a perfect summary of this. But they do give you an idea of the impact. You can extrapolate the hospitalizations based on these figures.

I would be concerned if I was elderly, had pre-existing conditions, or wasn’t vaccinated. Meaning I would still wear a mask and social distance. But outside of those parameters, this new variant does not appear to be nearly as deadly as the first for people who are vaccinated.

Facebook Comments Box

Are we living in a simulation?

I was reading this article today from the Wall Street Journal – Brain Implant Lets Man ‘Speak’ After Being Silent for More Than a Decade(Original article from the New England Journal of Medecine). It begs the question, are we living in a simulation?

It may be a good time to watch the movie, The Matrix. Perhaps it wasn’t so far-fetched after all.

Here is a brief overview of the concept of the technology.

This means we’ll be able to communicate with each other without ever speaking or hearing. The concept is amazing if you take a second to think about it. Computers are interpreting our senses. They are reading the signals from this man’s brain, pushing those through a deep neural network, and decoding those signals into sentences.

  • Imagine tasting without ever putting anything in your mouth.
  • Imagine smelling without ever sniffing.
  • Imagine seeing without ever opening your eyes.
  • Imagine talking without opening your mouth.
  • Imagine hearing but there is no noise.

Once this technology emerges there is no reason why the matrix could/does not exist. In fact, it makes it difficult to argue that you may potentially be living in a simulation currently. Keep an eye on Elon Musk’s Neuralink.

Facebook Comments Box

Finding the Next Gamestop or AMC

As we see the surge of meme stocks like AMC 7.99 +0.14 +1.78% or GME 25.04 +0.34 +1.38% you might be wondering how you can profit and get the jump on the next meme stock to pop. You can actually look at the stock options volume leaders chart. This chart will give you ideas for what stocks are most likely to pop before they actually do. Another chart to look at is the most active stocks by volume.

Once you do your research and are ready to invest in a specific company you can then use a breakout strategy like turtle trading to place stop orders to enter your trades at specific price levels. Another approach is to buy out of the money put or call options that have the ability to drastically increase in value as the stocks start to move.

Facebook Comments Box

Closing SLV trade – 121% in ~10 months

Last year during Covid I decided to purchase some silver options.

4/20/202025925191587Bought SLV Jan 21 2022 15.0 Call @ 3.25
4/20/202025925192864Bought SLV Jan 21 2022 15.0 Call @ 3.25
4/21/202025951958123Bought SLV Jan 21 2022 20.0 Call @ 2.03
5/15/202026407463083Bought SLV Jan 21 2022 30.0 Call @ 1.15
5/28/202026590777533Bought SLV Jan 21 2022 19.0 Call @ 2.59

Reasons for the trade

  • Gold/Silver ratio was the highest it’s been in years.
  • Covid was sure to send the government into a massive printing spree.
  • Silver is the “poor man’s gold” most people could afford to buy it.
  • APMEX.com where I buy my precious metals had a huge spread on silver over spot price.

Exiting the Trade

I’ve now closed this trade with 121% in profit. What is funny is the profit came the same week I initially made the purchase. I just held it for a long time because I thought the government’s printing press would push it a lot further. However, I’m starting to lose confidence in precious metals as a hedge to government printing, for the short term anyway. I more so think we’ll see inflation and as that loses control a shift to precious metals as a hedge to wealth preservation. I’m keeping my VDC(Vanguard Consumer Staples ETF) position open for now.

3/10/202133321473374Sold SLV Jan 21 2022 30.0 Call @ 1.94
3/10/202133321512258Sold SLV Jan 21 2022 19.0 Call @ 6.25
3/10/202133321508484Sold SLV Jan 21 2022 15.0 Call @ 9.5
3/10/202133321479857Sold SLV Jan 21 2022 20.0 Call @ 5.59

Keeping the trade open

I think there is plenty of reason for someone to keep a trade open based on some of the supply volatility we’ve seen over the last couple of months. However, my precious metals positions are getting hit pretty hard lately and I’m not sure I want to maintain this trade.

I should also note I still maintain 1-2% of my net worth in physical silver. The target is 1% but the fluctuation comes from price increases.

Facebook Comments Box

Closing ULTHF trade 17.8% – 13 days

You can read about my previous post on this short position here.

This stock has returned to its normal volatility and I’m up 17.8% in about two weeks. I’m happy with this trade. I closed my position today at .82

The original premise of the trade was to short this giant undeserved spike in the price indicated in the picture below. I’m still confident there is a ton of room for this to continue to the downside. However, it’s recent volume is low and I have no reason to expose myself to any unforeseen risk.

Facebook Comments Box

Why I’m shorting ULTHF

I woke up to this text message yesterday.

It was completely unsolicited and I have no idea what the source of it is. Could it be a potential pump and dump given the current market circumstances? Maybe… so I decided to dig a little into this company. It looks like it spiked a few years back and has been basically worthless for the last 3 years.

What’s interesting is it looks like it is being pumped again recently. Here is the last 2 years.

Zooming in closer it looks like there has been a massive amount of volume increase in the last 3 days. Hence my text message perhaps?

What about Google Trends did people recently just start searching for ULTH or ULTHF?

I wonder what reddit has to say.

Financials

Finally, I wonder what their financials look like? Would I be comfortable holding this short position?

Let’s keep in mind this company has a market cap of $42m

But..

Only $80k in cash.

$7,500 in accounts receivable

$92k in assets

$323k in liabilities

-$5,032,200 in retaind earnings

But Lithium is rare and the price is about to explode!

So let’s take a look at LIT which is an ETF that holds a bunch of Lithium related stocks. https://www.globalxetfs.com/funds/lit/

As you can see from their holdings ULTHF is not listed. This adds further evidence this stock should be shorted. In fact, if you wanted to take a more market neutral approach to this trade you could go long an equal-weighted amount of LIT.

Time to get short

Seems like more pump and dump hype. I’m definitely going short.

I tried to get short on 2/24 @ 1.40 but my broker didn’t have any shares available.

So I got an email this morning…

I was able to open a position this morning short @ 1.15. It has fallen already so I’m opening another short position @ 1.01. This trade would already be up 40% if it wasn’t rejected yesterday.

Facebook Comments Box

The world’s largest short squeeze tomorrow? My 2020 trade already up 193% should benefit heavily.

Last year I was looking to up my precious metal holdings. I like to keep 10% of my net worth in gold and 1% in silver. I bumped my gold holdings to 20% given the Coronavirus outbreak amongst other reasons outlined below. However, when I went to go and purchase silver from APMEX. I noticed the cheapest bullion I could get was something like 10-20% over spot price So I switched to long-dated options instead. I landed on a few. But eventually piled in on one a strike price of 30 with an expiration of January 21st, 2022. I bought these for $1.15 at the time. Looks like I actually picked the worst out of the four that I bought. No worries though I’m not complaining at a 192.68% increase.

The reason for my trade were as follows:

Physical silver was trading way over spot price at APMEX

The gold to silver ratio was the highest it has ever been in the last 100-years.

When governments get in trouble they just inflate your money away. It has been this way since the beginning of time.

This image has an empty alt attribute; its file name is image-3-1024x925.png

The federal reserve rate was basically dropped to 0% indicating massive problems.

This image has an empty alt attribute; its file name is image-1-1024x521.png

Silver is the “poor man’s gold” as Covid struck harder I assumed it would rally on the Fed’s printing press which was sure to accelerate and the Fed’s balance sheet had spike massively.

This image has an empty alt attribute; its file name is image-6-1024x374.png

The fed now owns 1/3 of all mortgage-backed securities. They are literally bailing out every asset class at risk of jeopardizing the future of the sovereign credit.

This image has an empty alt attribute; its file name is image-7-1024x484.png

Update:

r/wallstreetbets - Wikipedia

It has been rumored that online bullion sites have ran out of silver until the markets open tomorrow and Wall Street Bets may have their sites set on SLV as their next target. I’m not so sure they can pump silver up 1,600% like they did with GME but it will be interesting to see what can be done. Supply of silver is already very low after the markets closed Friday. Here is a quote from WSB, “Corner the market. GV thinks its possible to squeeze $SLV, FUCK AFTER SEEING $AG AND $GME EVEN I THINK WE CAN DO IT. BUY $SLV GO ALL IN TH GAINZ WILL BE UNLIMITED. DEMAND PHYSICAL IF YOU CAN. FUCK THE BANKS.

I just put in a big order for SLV options 30.5 strike expiring 2/5/21. My issue is the market is closed. I put in the order at .23 limit and I’m not sure if it will get filled. Regardless I’m still holding a bunch of futures from my previous trade. Future markets are already showing a large breakout.

Here is a message from the CEO of APMEX:

APMEX Statement On Current Market Conditions:

In the last week, we have seen a dramatic shift in Silver demand from our customers. For example, the ratio of ounces sold per day was running about two times earlier in the week and closer to four times the average demand by the end of the week. Once markets closed on Friday, we saw demand hit as much as six times a typical business day and more than 12 times a normal weekend day. Combined with the extremely high demand levels, we are also seeing a surge in new customers. On Saturday alone, we added as many new customers as we usually add in a week.

Any Precious Metal dealer will take a long position in the futures market to protect against spot price exposure when the markets open. We do this because it is our goal not to take a speculative position on metal. The weekends are unique as we are not able to real-time hedge our position. We took an aggressive position this weekend, but clearly could not have predicted the volumes that were seen. We have partnerships around to world that allowed us to cover these long positions, but only to a point. Once we exceeded our comfort levels, we had little choice but to stop the sale of Silver on our website. This was a difficult decision to make and unprecedented in our history.

As we evaluate the markets, it is difficult to know where Silver’s price and demand will go in the coming day and weeks. APMEX is highly capitalized and has more than $150 million in inventory to support demand. We have made strategic decisions to procure additional metal, locking up any metal we can find in the market place. We suspect premiums will rise and rise quickly, as we are seeing significant increases in our costs, when we can even locate the metal. It is also highly likely that we will need an additional day or two to fill orders based on current order counts. The one guarantee we can make to our customers is that you will only be sold metal that is on-site, or we have procured the metal with a firm commitment date from our partners. In markets like this, we feel this is the best approach a retailer can take, as no one can predict product availability.

We want to thank our customers for their patience and understanding during these turbulent times. APMEX prides itself on best in class service and delivering on promises to our customers.

Regards,

Ken Lewis
CEO, APMEX

I’ll let TheHappyHawaiian explain:

Here is his updated post:

Facebook Comments Box

Want $300 for free?

I remember back in 2000 during the dot com bubble all of these companies would pay you just to surf the internet using their browser or plugin. We may be in another bubble of some sort but that’s not my purpose of this article.

Recently I received a pop up on Facebook for SoFi. A free $350 just for funding a loan. Interesting, so for kicks I applied. My application is still pending but I can’t imagine I won’t get funded. They had a minimum loan amount of $10,001.

They indicate that they will give you the $300 within 30 days of funding your loan. The interest rate is 9.25% which is about $77/month in interest. So you’ll want to pay the loan off with the money you receive as soon as the bonus funds are received. Technically you’re probably only going to net $223. But hey that’s almost 40% of what the government is giving out for stimulus.

What’s interesting is this company is also giving away a free $50 in stocks just for opening an investment account. Another free $25 in Bitcoin just for opening a crypto currency account and buying at least $10 worth of crypto.

Seems like they’re pretty desperate to boost their sales for their upcoming IPO and inflate their valuation. You might as well take advantage of it.

Facebook Comments Box

Cannabis Grow journal

Water

You always want to make sure your water is at a pH of 5.8. I calibrated my pH meter and then measured my tap and RO water. You can always then measure these two as a baseline to make sure your meter doesn’t need to be recalibrated.

Tap water pH: 6.1 / RO water pH: 6.6

1.16.21-Tap water pH: 7.3 / RO water pH: 8.2

Here is a list of things you will need to calibrate your water.

2021.1.3 2100

First step is to simply drop your seeds into RO water. I would recommend a max of 5 per cup for 15 hours.

2 green crack seeds in RO water. 4 Jack Herer in RO water.

2021.1.4 1300

Seeds have been soaking for 16 hours moving to napkin in Ziplock, black bag, and box. Placed on Ether Miner for heat.

2021.1.5

Checked the seeds no growth yet.

2021.1.6

Two green crack seeds have sprouted so I’m going to move these to root riot plugs.

The four Jack Herer seeds have not yet sprouted so I’m going to stick them back in a ziplock covered in a paper towel, black bag, and box.

2021.1.7

Jack Herer seeds still don’t seem to be germinating that quick. I’m going to leave them another day.

Also no sprouting in the humidity dome from the Green Crack plants.

One of the Green Crack plants popped through in the pm.

2021.1.8

So I probably let this Green Crack plant go for too long in the dark. I’m going to move it into the grow tent where it can get a ton of blue spectrum light. This will promote bushy growth vs. the red spectrum which will cause growth in length and is better for flowering.

I’m going to move all the Jack Herer seeds to the humidity dome with the exception of one which doesn’t appear to have popped open. One of them appears to have broke when I moved it. I feel like I may have left my paper towel too wet.

Here is the placement of the seeds in the humidity dome.

Humidity

You’re going to want a humid environment for your plants. I would recommend something like this.

2021.1.9

Lights

Any of these smaller lights will work for the seedling phase.

Powerful LED’s

You are eventually going to need something more powerful. This is what I use.

2021.1.10

Looks like all of the seedlings popped except one. Haven’t added any water since the original move from the plastic bag. Also the last Jack Herer seed is refusing to germinate. I left it in the bag but typically when it takes this long they’re duds.

2021.1.11

2021.1.12

Pretty sure that bottom left Jack Herer is shot. Plus the last seed doesn’t appear to be germinating.

2021.1.14

Looks like roots are starting to appear. I’ll probably move these to a hydroponic setup soon.

First nutrients

Now that these seedlings are getting a little older I’m going to add some Clonex nutrients. I’m going to mix up 1 gallon of water and 18mL of Clonex.

1.21.2021

So I definitely got lazy and waited too long to move these into my hydroponic box in my window seal. You can see some of the leaves are in bad shape.

I’m going to put these in my south facing window seal for light. I’m going to supplement it with a florescent light 18 hours on and 6 hours off.

Water and Nutrients

Here is my template for maintaing the hydroponic system. This one is just a single 5 gallon bucket that pumps the water onto the roots and it drains back down.

The main nutrients I use are made by General Hydroponics.

I also use a few additives in addition to these.

h2o2 also known as hydrogen peroxide. In hydroponic setups you’re apt to get some type of root rot or infection. I use h2o2 as a preventative along with Armor Si made by General Hydroponics.

You’ll want to use RO water with your setup. This way your water is pure. With that being said it’s important to add calcium and magnesium back into the water.

Flushing your water

Every 7-14 days you’ll want to completely drain and flush your water. What I’ll typically do is drain all the water. Replace it with tap water and this FloraKleen product. Let this run for 2-4 hours and then completely drain it.

1.27.2021

I haven’t done anything to the plants. I just let them grow with 18 hours of LED light and then the natural sunlight through the window.

1.29.2021

I wanted to post an update of what the roots look like at this point.

I also lost one of the plants and only had 4 growing. So I decided to germinate two more today. A Harlequin and a Blueberry plant. I tried twice to get a Harlequin to germinate and failed both times. So I’m just going to move this Blueberry over to the window seal hydroponic setup.

2.1.2021

The Blueberry is looking healthy after a few days.

2.11.2021

So I neglected these plants again. I haven’t added any nutrients since the initial move on 1.23.2021. It gives you an idea of how maintenance-free this setup is. You can also see a large amount of growth in a relatively short timeframe. The roots grew way too big to pull through the plastic containers so I lost a good portion of them while transplanting tonight. It will be interesting to see how they respond. You can see how they’re in their final spot which is the 5-gallon bucket until they flower and harvest. I had to leave two of them in the window seal due to a lack of room in the tent. Their roots are going to get way too big for this setup. I may let them flower early or move them to a dirt container.

Notice the Blueberry is the smallest one and is about 10 days old.

Tent

The plants are now in this tent.

Lighting

The LED light I’m using is this.

Exhaust Fan

You’ll also want a fan to keep the airflow and vent the plants. I use this one.

Timer

I use these timers to control the lights.

Humidity

You’ll also need a humidifier to keep your air humid.

The method I use are 5-gallon buckets in which one bucket is the control bucket. It’s empty and they all drain back into it. Then the water gets re-circulated using a pump to spray the roots.

2.25.2021

Here are the plants in their final home. In Arizona, you can grow up to 12 plants per household so long as there are two adults in the household.

3.5.2021

Updated status.

3.12.2021

Updated status.

3.17.2021

Lighting Schedule change

Today I’m switching the lights to be on 12 hours and off 12 hours. What this does is it signals to the plant it’s time to flower, or create buds. This will be the final phase of my grow in about 6-8 weeks the bud will be ready to harvest.

3.22.2021

I wanted to show what a male plant looks like. I had to take this one out of the grow tent. You don’t want males as they will pollinate the females and ruin the crop.

You can see how big this plant has gotten and it has developed quite a rooting system!

4.1.2021

4.13.21

Buds are starting to come to life. Just a few more weeks left of flowering.

Facebook Comments Box

Hacking your SRP time-of-use bill with a DIY Tesla Powerwall made from recycled scooter batteries

I’ve always been fascinated by technology. I love building all types of electronic projects and automating things. Recently I ran across a guy who discussed building a battery backup using recycled scooter batteries that contained 18650 rechargeable batteries. The same ones that you find in Tesla cars and Powerwalls.

I started thinking. I wonder if it would be possible to trickle charge a battery during low-cost energy hours (6PM-3PM) and then dump it back into the grid when the electricity was expensive(3PM-6PM). Or at least offset your peak hour usage with battery power. So I created some formulas and crunched some numbers. Before you read any further I want to say this is a complete hypothetical experiment. I would never connect this to my SRP system and risk them terminating my services.

Here is a list of SRP’s different electricity rates. You can see the greatest offset is in the months of May, June, July, August, September, and October. The variance in winter is not that great and you really can’t save that much using this method.

Ok, let’s compile a spreadsheet using these formulas.

ROI

Analyzing the ROI this setup using a simple 3kWh battery and a 1kW inverter we can yield 18.27% with a completely paid for system in 5.47 years. Not a bad return for someone with a little bit of money to invest.

Parts

So I started buying parts.

6 – Scooter batteries

1 – Inverter

1 – Charge/Discharge monitor

1 – Smart switch

1 – Battery Charger

1 – AC auto transfer switch

1 – Distribution block

1 – Arduino Nano

1 – Buck converter

Part 2

I’ll be assembling and testing over the next week. To be continued…

Facebook Comments Box

How to invest like a hedge fund manager with almost a 1,400% return in the last 14 years

A popular strategy that I have followed in my investments is crowdsourcing hedge fund manager investments. Many people don’t know this but any hedge fund that manages over $100 million dollars must report their stock holdings on a form called a 13f. This is filed with the SEC. There is a website that conveniently maps all of these filings so you can scan through your favorite investment manager and see what stocks they are buying and selling.

For instance, if you’re a fan of Warren Buffett and Charlie Munger you can take a look at Berkshire Hathaway’s holdings – https://whalewisdom.com/filer/berkshire-hathaway-inc Here is a list of their holdings which are over 1% of their portfolio

Or may be you’re a fan of Ray Dalio and you want to see what Bridgewater is holding? Here is a list of all their holdings that represent more than 1% of their portfolio.

Let’s take a look at Jim Simon’s fund Renaissance Technologies.

You get the point. You are able to get some pretty good insight as to what massive hedge funds are buying.

WhaleIndex

What I like about Whale Wisdom is they categorize the most successful hedge fund managers using what they refer to as a WhaleIndex.They then put together a list of 30 stocks based on successful fund managers. Some of their requirements are as follows.

  • Between 5 and 750 holdings in their 13F filing
  • At least 3 consecutive years of quarterly 13F filings
  • Hold no fewer than five stocks in its portfolio
  • Manage more than $100 million in marketable securities
  • Hold at least 20% of its portfolio in its top 20 stocks
  • Managers considered to be a bank, trust, pension, or insurance company are excluded

The top 40 managers who have maintained an average WhaleScore over the past 5-years higher than the five-year average WhaleScore of the S&P 500 is used in the WhaleIndex. Based on the holdings disclosed on their SEC filings, WhaleWisdom identifies the 100 stocks most commonly held among the respective managers’ 13F holdings.

The Whale Fund 2.0 is the one I follow. Since 2006 this strategy has yielded 1,345% – https://whalewisdom.com/whaleindex/portfolio_2_0

A few words of caution

13f filings come out 45 days after the quarter ends. This means the data is somewhat stale. It should also be noted that the fund could have purchased that stock at any time during the quarter. Meaning the data could be as old as 135 days. Secondly, funds are not required to report short positions or hedged positions. So you should not assume you know exactly what their portfolio consists of.

Broker

You’ll want to find a broker that allows for fractional investing if you don’t have enough money to buy full shares. Here are a couple for reference.

Firstrade – 4 free stocks with $100 deposit

Robinhood – Sign up link your bank account and get a free stock.

In Conclusion

Despite its downfalls, Whale Wisdom’s returns are still solid. While I wouldn’t recommend this strategy for your entire portfolio this is a good strategy to deploy a fixed percentage of your portfolio. There is also a book that written about this concept which you can find here – https://www.amazon.com/Invest-With-The-House-Hacking-ebook/dp/B01A3L1VEO and also an ETF that was created named VIP ETF

Facebook Comments Box

Getting St. Louis FRED Data in Google Colab for Python Analysis

At times when creating trading strategies using big data you need access to historical economic data. One of the best sources of data is the Economic Research branch of the St. Louis Federal Reserve or FRED. Today I’m going to show you how to pull that data into a dataframe so that you can analyze it using machine learning or AI.

The first step is to import Pandas datareader. What this piece of code does is it downloads all the data for Corporate AAA bond yields. Every dataset in FRED has a symobl. In this case it’s DAAA.

import pandas_datareader.data as web
import datetime

today = pd.to_datetime("today")
start = datetime.datetime(1900, 1, 1)
end = today

df_Corp_AAA_yield = web.DataReader(['DAAA'], 'fred', start, end)

# not working - Corp_AAA_yield = web.DataReader(['DAAA'], 'fred', start, end)
df_Corp_AAA_yield.head()
df_Corp_AAA_yield.tail()

We can now visualize our dataframe by plotting it.

df_Corp_AAA_yield.plot(grid=True)
Facebook Comments Box

Normalizing Stock data for Machine Learning

When analyzing historical time frame data in machine learning it needs to be normalized. In this code example, I will show how to get S&P data then convert it to a percent of daily increase/decrease as well as a logarithmic daily increase/decrease.

The first part of this code will use yfinance as our datasource.

#we're going to use yfinance as our data source
!pip install yfinance --upgrade --no-cache-dir

import pandas as pd
import numpy as np
import yfinance as yf

Next, we’re going to create a dataframe called df and download SPY data from 2000 to it.

#Here we're creating a dataframe for spy data from 2000-current
df = yf.download('spy',
  start='2000-01-01',
  end='2020-08-21',
  progress=True)
  #dauto_adjust=True,
  #actions='inline',) #adjust for stock splits and dividends
#print the dataframe to see what lives in it
print(df)

Finally, we’ll print the result of df so you can get an idea of what is inside of it.

We’re going to drop all the columns except Adj Close. Then we’ll rename it adj_close. Next, we’ll create a column labeled simple_rtn. This is the daily simple return or percent increase/decrease. The next line of code creates a logarithmic increase/decrease. Logarithmic gives equal bearing to the Y-axis and can be defined as follows, “A logarithmic price scale uses the percentage of change to plot data points, so, the scale prices are not positioned equidistantly. A linear price scale uses an equal value between price scales providing an equal distance between values.”

#only keep adj close
df = df.loc[:, ['Adj Close']]
df.rename(columns={'Adj Close':'adj_close'}, inplace=True)
#create column simple return
df['simple_rtn'] = df.adj_close.pct_change()
#create column logrithmic returns
df['log_rtn'] = np.log(df.adj_close/df.adj_close.shift(1))
print(df)

This next command just analyzes the data so you can spot-check what you’ve created.

#here we can analyze our data
df.info()

This next section describes what the daily increase/decrease of the SPY looks like. You can see statistically relevant information about S&P here.

#get statistical data on the data frame
df.describe()

Next, we can see a distribution of adjustable close, logarithmic return, and simple return.

#view chart of data to get an overview of what lives in the data
import matplotlib.pyplot as plt
df.hist(bins=50, figsize=(20,15))
plt.show()

This is all for data normalization. You can now apply different algorithmic analyses to the data.

Facebook Comments Box

Predict S&P Using Google Colab & Facebook Prophet

A few years ago Facebook decided to open source Prophet. This is their analytics algorithm that uses an additive model to fit non-linear data with seasonality. I started to wonder, “If this algorithm were in place in March when the stock market’s crashed what would it have advised?” So I decided to give it a spin.

Let’s assume you had a significant amount of money invested in S&P index funds on March 23, 2020. Since the beginning of the year, you would have lost 31% of your money. At this point you might be thinking, “Oh shit, what do I do, sell, buy, hold?”. A lot of investors would panic and sell. The market thrives and two psychologies, fear and greed.

But let’s take an analytics approach to this problem. What would Facebook’s Prophet algorithm advise you do to? Here is how you can approach that problem.

The first thing I did was fire up Google Colab. The entire notebook can be found here.

The first part of this code uses a Python DataReader to pull SPY from Yahoo Finance. I created an end date of 3/23/2020. This only gives Facebook’s Prophet access to data up until this point. We are then going to have it predict where it thinks the price would be today 8/20/2020 without feeding it any future data.

# Python
import pandas as pd
from fbprophet import Prophet

from pandas_datareader import data as web
import datetime

import pandas as pd
import matplotlib.pyplot as plt

stock = 'spy'
endDate = datetime.datetime(2020, 3, 23)
#start_date = (datetime.datetime.now() - datetime.timedelta(days=2000)).strftime("%m-%d-%Y")
start_date = (endDate - datetime.timedelta(days=2000)).strftime("%m-%d-%Y")
#print(start_date)
df = web.DataReader(stock, data_source='yahoo', start=start_date,end=endDate)
#date is the index so you need to make it a column
df["Date"] = df.index

import matplotlib.pyplot as plt

plt.plot(df['Close'])
df.head()
df.tail()

The next part of code renames the imported columns from “Date” to “ds” and “Close” to “y”. DS and Y are the two variables that Prophet will be looking for.

# Python
df = df.rename(columns={"Date": "ds", "Close": "y"}, errors="raise")

This next part of the code starts to set up Prophet. The only variable you should be concerned with is 151. This is telling the algorithm to look out 151 days. Then it forecasts three variables yhat, yhat_lower, and yhat_upper. Yhat is the predicted price with upper and lower being the bounds in which it assumes the price will fall in.

# Python
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=151)
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()

You can see that it predicts the closing price for tomorrow will be 331.52. Remember it is only using data from March 23rd to make this calculation. Given the wild gyrations in the market, this is extremely close to being accurate. The SPY closed today at 338. Prophet predicted it would close at 331. It was off by 2%. This is using a 5-month look ahead forecasting model.

Here is the visual representation of what that looks like.

from fbprophet.plot import plot_plotly, plot_components_plotly

plot_plotly(m, forecast)

And more charts…

plot_components_plotly(m, forecast)

Finally here is the visualization of the predicted price vs. the actual price chart.

Facebook Comments Box

Memory handler errors in MT4 while importing history files or csv files

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

If you have issues with Memory handler errors in MT4 it is because you’re trying to convert too many symbols at the same time. Close all of your charts and only leave open the pair you’re working with. When you’re done close it and go on to the next. This will get rid of the memory errors that MT4 complains about once terminal.exe starts to use more than 1GB of memory.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Monitor Account Balance and Send Email Alerts in Metatrader When Account Drops Below Threshold

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

I had a strategy that I programmed awhile ago that completely drained my account. The strategy itself was fine. In fact it was doing so good I decided to apply it from some of my currency pairs to XAU/USD. After applying I caught a flight to LAX to pick up a Porsche I had found online. I had never traded gold before but judging from the backtest it should have performed relatively well. The problem was I did not anticipate the large spread on gold. The spread was enough to send my strategy constantly opening and closing positions. The buy rules and sell rules were being met because of the huge spread. Once I landed I had picked up the Porsche and headed to my hotel, not realizing at the time I had left my briefcase and laptop in the back of the taxi that I caught at LAX. When I arrived at my hotel I checked my phone only to realize one of my accounts was down around 70%, only 30% of my capital remaining. I immediately freaked out and started my investigation. It was then I realized the large spread in gold was constantly opening and closing positions. Costing me the spread every 5 minutes or so. I called Oanda as I then realized I lost my laptop I could not shut off the robot. Closing the trades manually from my phone only made the account drain faster.

Now you see my reason for writing this code. The purpose of it is to grab your account balance at a specific time and then if it drops below a threshold to send an email notification. This code is in mqh format. Which is an include file. The reason for this is so that it can be applied to any expert advisor.


//+------------------------------------------------------------------+
//| DailyBalanceCheck.mq4 |
//| Copyright © 2011, Jeremy R. Whittaker |
//| http://www.JeremyWhittaker.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Jeremy R. Whittaker"
#property link "http://www.JeremyWhittaker.com"

double todaysBalance, dDouble;
int iHandle, iErrorCode;
extern string sFileName=”dailyBalance.csv”;
int iDecimalPlaces=2;
int sendWarningCount, sendBalanceCount;

void dailyBalanceCheck(){
int count;
double onePercent;

if(todaysBalance<1){
fnReadFile();
todaysBalance=dDouble;
}

if(Hour()==16 && Minute()==59){
count=0;
sendWarningCount=0;
sendBalanceCount=0;
}

if(Hour()==1700 && Minute()==0){
if(count==0){
todaysBalance=AccountBalance();
dDouble=todaysBalance;
fnWriteFile();
if(sendBalanceCount<1){
SendMail(“Account Update”,”Good evening Mr. Whittaker todays balance is “+todaysBalance+”. Your current account equity is “+AccountEquity());
Print(“Sending Balance Email”);
sendBalanceCount=sendBalanceCount+1;
}
count=count+1;
}
}

onePercent=todaysBalance*0.01;

if(AccountEquity() SendMail(“Warning account equity down 1%”,”Account Balance at 5PM was “+todaysBalance+”. Now it is “+AccountEquity());
Print(“Sending Warning Email”);
sendWarningCount=sendWarningCount+1;
}
return(false);
}

//+——————————————————————+
bool fnReadFile()
{
iHandle = FileOpen(sFileName,FILE_CSV|FILE_READ,’;’);
if(iHandle < 1)
{
iErrorCode = GetLastError();
if (iErrorCode == 4103)
Print(“File not found”);
else
Print(“Error reading file: “,iErrorCode);
return(false);
}
dDouble = StrToDouble(FileReadString(iHandle));
FileClose(iHandle);
return(true);
}

//+------------------------------------------------------------------+
bool fnWriteFile()
{
iHandle = FileOpen(sFileName,FILE_CSV|FILE_WRITE,';');
if(iHandle < 1)
{
iErrorCode = GetLastError();
Print("Error updating file: ",iErrorCode);
return(false);
}
FileWrite(iHandle,DoubleToStr(dDouble,iDecimalPlaces));
FileClose(iHandle);
return(true);
}
//+------------------------------------------------------------------+

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Whittaker hourly ATR indicator for Metatrader

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

How MT4 Calculates Spread and How to Manually Change it.

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

MT4 has a crude way of calculating the spread on each trade.  It basically takes the current market spread at the time you run your backtest and applies that to all of your trades.  Unfortunately, if someone is programming and testing on the weekends all of their results are going to be skewed because of the fact that the spreads on the weekend/after-hours are so high.  You can check the spread that your MT4 platform is going to use by clicking on the symbol properties button from within your tester.

If you want to statically set this variable for your backtest purposes you need to download spread changer.  It can be found here.  http://www.jeremywhittaker.com/wp-content/uploads/2011/04/SpreadChanger.exe

Using this utility is not exactly straightforward.  You need to find the file named Symbols.sel within your MT4 program files directory.  Once you find the Symbols.sel file drag and drop it onto the Spreadchanger.exe utility and it will allow you to modify it. 

The last step is you need to add a fake proxy server to your MT4 platform to trick it from accessing the internet.  Because if it can access the server it will over ride your setting.  You must also edit the symbols.sel file while your platform is closed.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Setting up Metatrader for better backtesting quality

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

If you’re working with a default installation of MT4 or Metatrader chances are you modeling quality is not very good. I have composed this post to show how I import data into MT4 for better backtesting performance.

First thing you need is high quality historical data in CSV format. I have found Forex Tester to be very beneficial for that, http://www.forextester.com/data/datasources.html.

1. You will want to download the file that pertains to the pair you will be trading.

2. The next step is unzipping the file using a simple Zip program.

3. Before proceeding to import your new data you will want to go ahead and delete all of your old data first. So that you are not mixing the two up. If you are running Windows7 or Windows Vista you have to look in two locations for the .hst files and delete all of them. If however you are running Windows XP you need to only look in one. These locations can vary greatly depending what broker you download your platform from. I use Interbank but you will have to look and mind and figure out where yours are. Or you can just search your entire hard drive for *.hst files.
C:\Program Files (x86)\Interbank FX Trader 4 – B\history
C:\Users\%username%\AppData\Local\VirtualStore\Program Files (x86)\Interbank FX Trader 4 – B\history\IBFX-MT4 Mini-2

4. Now that you have unzipped the files they should be in .CSV format. From here you can now open your Metatrader platform. Then go to tools>options click on the chart tab and change the “max bars in history” and “max bars in chart” to 999999999. Once you close this window Metatrader will adjust to the highest possible setting automatically.

5. You will now want to go to tools>history center. Double click your currency pair that you are trying to import. Then double click on the 1m timeframe underneath it. Now click on the import button. Browse to the location of the .txt file that you extracted in step 2. You may have to change the rows setting to 0. If it works correctly you will be able to see every row from the file that you are importing. Click ok and all of your 1m data is now complete.

6. The next step is to generate your 5m 10m 30m 60m 240m 1440m and 10080m data. This will get all of the commonly used timeframes. You can also do custom ones if you wish.

7. To do this you need to go to navigator from Metatrader terminal. Select the scripts from the navigator window and look for one named “period_converter”.

8. Open a 1m chart of the currency pair that you just imported.

9. Now double click on period_converter

10. It’s going to ask you for an input labeled “ExtPeriodMultiplier”. The default value is 3. Change this to 5 to generate your 5 minute chart data.

11. If you have your terminal window open in Metatrader select the experts tab. You will see something that says period_converter GBPUSDm,M1: 726279 record(s) written. This is how you know it is complete.

12. Double click period converter again. This time select 10 for 10 minute chart. Continue doing steps 10 and 11 until you have created your 5m 10m 30m 60m 240m 1440m and 10080m data. You are now ready to move on to your next currency pair.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Whittaker volatility breakout indicator

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

I wanted to share with everyone an indicator that I programmed and I find very useful. It is called the Whittaker Volatility Breakout Indicator or WVBI. The purpose of this indicator is to represent the range of a bar in percentage terms rather than in points. I think the flaw of most traders or programmers is they often write code and optimize it for pips of a given pair. This I truly believe is one of the core fundamental flaws of sustainability of a strategy. When people start programming static values. Whether it be in money management, entries, exits, or take profit levels.

What this indicator does is as follows:

  1. Takes the range(high-low) the last x bars.
  2. Averages the range of the last x bars.
  3. Displays as a histogram the percentage of change from the average.
  4. Takes an average of the percentage of change from the average.
  5. Allows you to set a horizontal line at your preference so you can see when the average is breaking out.

This indicator has 3 inputs:

  1. “ATRPeriod” which allows you to specify the amount of bars to average out for the Average True Range of that period
  2. “WVBIAverage” is a setting that allows you to specify the amount of bars to which will be the average of the percentage of the ATR.
  3. The last setting is pretty straightforward it is “TooFar”.  This simply will draw a horizontal line across the indicator so that you can visually see where the percentage is in comparison to other bars.  Its purpose is to simply put things in perspective.

All of this might seem confusing at first. However, I assure you this a very useful indicator for detecting volatility in a market.

You can see from this example of above the bar in question exceed it’s 14 day ATR by 203.95%.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

A Solid Trading Plan

Most beginning traders don’t know where to start or how to apply concepts to the markets. If you are a beginner, intermediate, or advanced trader the following document should be able to help advance or solidify your trading career.

Facebook Comments Box

Whittaker COT index variant a

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

If you are a currency trader it can be quite annoying when you cannot access volume data as you can in other markets. This can be instrumental to ones success if your strategy from another insrument outside of Forex requires some type of volume indicator. Although it is not perfect you can use the futures market COT or Commitment of Traders report to gauge this.

Since 2000 the COT reports are released weekly. However, you must keep in mind the reports are released on Friday but reflect data from Tuesday. As the reports are closed off on Tuesday but not published until 3 days later.

When it comes to the COT report there are a few different sections that are valuable:

Commercial: These are organizations that use the futures market to hedge their positions. They are not traders by nature. They only use futures to guarantee their profits for the future.
Non-Commercial: These are the speculators who trade the futures market for a living. They include hedge funds and other individuals who speculate the market and make the requirements that are set by the CFTC.
Reportable: Positions held above specific reporting levels set by the CFTC.
Non-Reportable: These are individuals or organizations who do not meet the minimum requirements set forth by the CFTC to be categorized.
Open Interest: The open interest is the amount of futures or options contracts which are not offset by another transaction.

The Whittaker COT Index Variant-A is an MT4 or MQL4 indicator. Basically what it will do is go through the data from the COT report and extract the above sections. It will then as a percentage let you know how many traders are long in each category.

To use this indicator you must visit the CFTC website and weekly download the updated report. Here is a link to the report that must be downloaded.

Use the image below to make sure you’re downloading the correct link. Save this file to C:\Program Files (x86)\Interbank FX Trader 4\experts\files. This path is obviously because I use InterbankFX. Depending on your broker this path may be different.

You first must unzip the file that you downloaded. You can do this with any “zip” software. Once you extract this file it must be converted to CSV format for MetaTrader to read it.You can do this by opening the file located at C:\Program Files (x86)\Interbank FX Trader 4\experts\files\annual.xls with Microsoft Excel. Once it is open in Excel go to file>save as. From the save as type window select CSV(Comma Delimited) (*.csv). You will want to name the file annual.xls.csv this by default is what Whitaker COT Index will be looking for.

The actual Whittaker COT Index variant-A can be downloaded here. Save the file to C:\Program Files (x86)\Interbank FX Trader 4\experts Once the file is downloaded simply add it to your chart.

Due to the fact that this is a stripped down version of my EA that I use to trade live it is programmed as an EA or expert advisor. I realize it should technically be an indicator and I will reprogram it when I get the opportunity. Also, if you are testing this out on the weekend it is not going to work. It only generates numbers “on tick”, so if the market is closed it is not going to do anything.

Update:
I have reprogrammed this EA as an indicator so that it does not have to be loaded as an EA. You can download the updated version here. Save to C:\Program Files (x86)\Interbank FX Trader 4\experts\indicators\

Update 2:

The original source file I created this from is here – http://www.cftc.gov/MarketReports/files/dea/history/dea_fut_xls_2011.zip

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Whittaker COT Index Variant-A

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

If you are a currency trader it can be quite annoying when you cannot access volume data as you can in other markets. This can be instrumental to ones success if your strategy from another insrument outside of Forex requires some type of volume indicator. Although it is not perfect you can use the futures market COT or Commitment of Traders report to gauge this.

Since 2000 the COT reports are released weekly. However, you must keep in mind the reports are released on Friday but reflect data from Tuesday. As the reports are closed off on Tuesday but not published until 3 days later.

When it comes to the COT report there are a few different sections that are valuable:

Commercial: These are organizations that use the futures market to hedge their positions. They are not traders by nature. They only use futures to guarantee their profits for the future.
Non-Commercial: These are the speculators who trade the futures market for a living. They include hedge funds and other individuals who speculate the market and make the requirements that are set by the CFTC.
Reportable: Positions held above specific reporting levels set by the CFTC.
Non-Reportable: These are individuals or organizations who do not meet the minimum requirements set forth by the CFTC to be categorized.
Open Interest: The open interest is the amount of futures or options contracts which are not offset by another transaction.

The Whittaker COT Index Variant-A is an MT4 indicator.  Basically what it will do is go through the data from the COT report and extract the above sections.  It will then as a percentage let you know how many traders are long in each category.

To use this indicator you must visit the CFTC website and weekly download the updated report.  Here is a link to the report that must be downloaded.

Use the image below to make sure you’re downloading the correct link.  Save this file to C:\Program Files (x86)\Interbank FX Trader 4\experts\files.

Once you download this file it must be converted to CSV format for MetaTrader to read it.  You can do this by opening the file located at C:\Program Files (x86)\Interbank FX Trader 4\experts\files\annual.xls with Microsoft Excel.  Once it is open in Excel go to file>save as.  From the save as type window select CSV(Comma Delimited) (*.csv).  You will want to name the file annual.xls.csv  this by default is what Whitaker COT Index will be looking for.

The actual Whittaker COT Index variant-A can be downloaded here. Save the file to C:\Program Files (x86)\Interbank FX Trader 4\experts  Once the file is downloaded simply add it to your chart.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Setting up MetaTrader for better backtesting quality

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

If you’re working with a default installation of MT4 or Metatrader chances are you modeling quality is not very good. I have composed this post to show how I import data into MT4 for better backtesting performance.

First thing you need is high quality historical data in CSV format. I have found Forex Tester to be very beneficial for that, http://www.forextester.com/data/datasources.html.

1. You will want to download the file that pertains to the pair you will be trading.

2. The next step is unzipping the file using a simple Zip program.

3. Before proceeding to import your new data you will want to go ahead and delete all of your old data first. So that you are not mixing the two up. If you are running Windows7 or Windows Vista you have to look in two locations for the .hst files and delete all of them. If however you are running Windows XP you need to only look in one. These locations can vary greatly depending what broker you download your platform from. I use Interbank but you will have to look and mind and figure out where yours are. Or you can just search your entire hard drive for *.hst files.
C:\Program Files (x86)\Interbank FX Trader 4 – B\history
C:\Users\%username%\AppData\Local\VirtualStore\Program Files (x86)\Interbank FX Trader 4 – B\history\IBFX-MT4 Mini-2

4. Now that you have unzipped the files they should be in .CSV format. From here you can now open your Metatrader platform. Then go to tools>options click on the chart tab and change the “max bars in history” and “max bars in chart” to 999999999. Once you close this window Metatrader will adjust to the highest possible setting automatically.

5. You will now want to go to tools>history center. Double click your currency pair that you are trying to import. Then double click on the 1m timeframe underneath it. Now click on the import button. Browse to the location of the .txt file that you extracted in step 2. You may have to change the rows setting to 0. If it works correctly you will be able to see every row from the file that you are importing. Click ok and all of your 1m data is now complete.

6. The next step is to generate your 5m 10m 30m 60m 240m 1440m and 10080m data. This will get all of the commonly used timeframes. You can also do custom ones if you wish.

7. To do this you need to go to navigator from Metatrader terminal. Select the scripts from the navigator window and look for one named “period_converter”.

8. Open a 1m chart of the currency pair that you just imported.

9. Now double click on period_converter

10. It’s going to ask you for an input labeled “ExtPeriodMultiplier”. The default value is 3. Change this to 5 to generate your 5 minute chart data.

11. If you have your terminal window open in Metatrader select the experts tab. You will see something that says period_converter GBPUSDm,M1: 726279 record(s) written. This is how you know it is complete.

12. Double click period converter again. This time select 10 for 10 minute chart. Continue doing steps 10 and 11 until you have created your 5m 10m 30m 60m 240m 1440m and 10080m data. You are now ready to move on to your next currency pair.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box

Whittaker Volatility Breakout Indicator

I no longer trade using Metatrader. I noticed users kept hitting an invalid link on my website to this search phrase. So the purpose of this post is to catch those invalid links related to Metatrader. I would recommend learning Python and custom developing your algorithms. It will be much more rewarding.

I wanted to share with everyone an indicator that I programmed and I find very useful. It is called the Whittaker Volatility Breakout Indicator or WVBI. The purpose of this indicator is to represent the range of a bar in percentage terms rather than in points. I think the flaw of most traders or programmers is they often write code and optimize it for pips of a given pair. This I truly believe is one of the core fundamental flaws of sustainability of a strategy. When people start programming static values. Whether it be in money management, entries, exits, or take profit levels.

Download WVBI!

What this indicator does is as follows:

  1. Takes the range(high-low) the last x bars.
  2. Averages the range of the last x bars.
  3. Displays as a histogram the percentage of change from the average.
  4. Takes an average of the percentage of change from the average.
  5. Allows you to set a horizontal line at your preference so you can see when the average is breaking out.

This indicator has 3 inputs:

  1. “ATRPeriod” which allows you to specify the amount of bars to average out for the Average True Range of that period
  2. “WVBIAverage” is a setting that allows you to specify the amount of bars to which will be the average of the percentage of the ATR.
  3. The last setting is pretty straightforward it is “TooFar”.  This simply will draw a horizontal line across the indicator so that you can visually see where the percentage is in comparison to other bars.  Its purpose is to simply put things in perspective.

All of this might seem confusing at first. However, I assure you this a very useful indicator for detecting volatility in a market.

Attached are zip files I had or that I was working on for Metatrader. I don’t know if they’re up to date, if they work, or support them in any form.

Facebook Comments Box