New for 2027The MonsterDesk course and run-it-yourself software. Founding prices can be reserved now.Course and run-it-yourself software.See what is on offer
MonsterDesk

Free lesson · Module 1: Setting up · about 10 min

1.5 Your first script: read prices, draw a chart

A short video intro to the lesson. The full lesson videos come with the course in early 2027.

Let's put it together: load the bars you saved, add a 50-hour average, and draw a chart.

The script

Save this as first_chart.py and run it:

import pandas as pd
import matplotlib.pyplot as plt

bars = pd.read_csv("spy_1h.csv", index_col=0, parse_dates=True)
bars["avg50"] = bars["close"].rolling(50).mean()   # average of the last 50 hourly closes

ax = bars[["close", "avg50"]].plot(figsize=(10, 5), title="SPY hourly close and its 50-hour average")
ax.set_ylabel("price ($)")
plt.tight_layout()
plt.savefig("first_chart.png")
plt.show()

last = bars.iloc[-1]
side = "above" if last["close"] > last["avg50"] else "below"
print(f"The last close, ${last['close']:.2f}, is {side} its 50-hour average (${last['avg50']:.2f})")

Reading the chart

When the price is above the line, the market has been rising lately. When it's below, it has been falling. That one idea is the seed of the first agent you'll build in Module 2.

It is not yet a reason to trade. In Module 3 you'll see why a rule that looks good on a chart can fall apart on data it never saw, and how the exam catches it.

Module 1 done

  • Python and VS Code installed
  • A paper account with keys kept safe
  • Real market data saved to a file
  • Your first chart

Next, Module 2: your first agent. Lesson 2.1 is free.

Add MonsterDesk to your home screenOpen the live desk like an app.
Follow the desk free