Understanding My Trading Bot Like a 12-Year-Old

Imagine a Robot Watching the Stock Market

Think about a robot sitting in front of giant TV screens all day watching companies like:

  • AAPL (Apple)
  • MSFT (Microsoft)
  • NVDA (NVIDIA)

People around the world buy and sell these company shares every second.

The robot’s job is simple:

“Only buy or sell when the situation looks good.”

That robot is called a trading bot.


What Is a Stock?

A stock is a tiny piece of ownership in a company.

If a company does well:

  • more people want to buy it
  • price usually goes up 📈

If a company struggles:

  • people sell it
  • price usually goes down 📉

Example:

CompanyPrice
Apple$280
Microsoft$520
NVIDIA$170

These prices move all day long.


What Does the Trading Bot Actually Do?

The bot checks stock prices every few minutes and asks questions like:

  • Is the stock moving up?
  • Is the market too quiet?
  • Is the market too messy?
  • Is there a strong trend?

Then it decides:

DecisionMeaning
BUY“This may go up.”
SELL“This may go down.”
HOLD“Do nothing right now.”

Why HOLD Is Actually Smart

Many people think:

“A trading bot should trade all the time!”

But smart traders know:

Sometimes the best move is to WAIT.

Imagine playing soccer.

A bad goalie jumps at every ball.

A smart goalie waits for the right moment.

The bot is trying to be the smart goalie.


Understanding SMA (Simple Moving Average)

The bot uses something called:

SMA = Simple Moving Average

That sounds complicated, but it’s just an average.

Example:

If Apple prices were:

10, 12, 14, 16, 18

The average is:

14

The bot compares:

  • current price
  • average price

to understand the trend.


Example of a Trend

Upward Trend 📈

100 → 102 → 104 → 106

This means:

“People keep buying.”


Downward Trend 📉

106 → 104 → 102 → 100

This means:

“People keep selling.”


Understanding ATR (Volatility)

The bot also measures something called:

ATR = Average True Range

This tells the bot:

“How much is the stock moving around?”


Quiet Market Example

100 → 100.02 → 100.01

Very little movement.

The bot says:

“This market is sleepy.”


Active Market Example

100 → 103 → 98 → 105

Lots of movement.

The bot says:

“Now things are interesting!”


What Is “LowATR”?

Sometimes the bot logs this:

Reason: LowATR

That means:

“The stock is too quiet right now.”

The bot avoids trading in boring markets.


What Is “SidewaysMarket”?

Sometimes prices move like this:

100 → 101 → 100 → 101 → 100

No real direction.

This is called a sideways market.

The bot says:

“I can’t tell where this market wants to go.”

So it waits.


Why Waiting Is Important

Most beginner bots make this mistake:

BUY SELL BUY SELL BUY SELL

all day long.

That usually loses money because the market becomes noisy and confusing.

A better bot:

  • waits patiently
  • ignores weak signals
  • trades only when conditions improve

What Is Paper Trading?

Right now the bot uses:

fake money

through Alpaca.

This is called:

Paper Trading

It allows learning without risking real money.


What Happens During a Good Trade?

Imagine this happens:

  1. Apple starts moving strongly upward
  2. The bot sees a trend
  3. The bot buys
  4. Price continues upward
  5. The bot sells later
  6. Small profit earned

That is the goal.


What Happens During a Bad Trade?

Sometimes the bot is wrong.

Example:

  1. Bot buys
  2. Market suddenly drops
  3. Bot exits quickly
  4. Small loss only

This is why the bot has:

  • stop losses
  • risk rules
  • safety filters

Why the Logs Matter

The bot writes logs like:

LowATR
SidewaysMarket
NoConfirmation

This is like the robot explaining its thinking.

Instead of:

“Trust me.”

It says:

“I avoided this trade because the market looked weak.”

That’s important because humans can understand and improve the system.


What Is the Real Goal?

The goal is NOT:

be rich overnight

The real goal is:

make careful decisions automatically

This is similar to how professional trading firms work.


What Skills Are Being Learned?

Building a trading bot teaches:

  • programming
  • math
  • logic
  • automation
  • risk management
  • patience
  • decision making

It combines technology and business together.


The Most Important Lesson

A smart trading system is NOT:

always trading

A smart trading system is:

careful about WHEN it trades

And that is exactly what this trading bot is learning to do.

The world of honeybees

If you also think of yourself as useless, then you must read this…

The world of honeybees is one of nature’s most astonishing miracles, where every individual is busy performing a specific role. Inside this tiny hive operates a complex social system whose two most important figures are the queen and the drones. Their lives are so different that it is hard to believe they belong to the same species.

The queen bee is the heart of the colony, a monarch who lives among her subjects yet is so unique that she stands apart in every way. Her body is noticeably longer and more elegant than other bees, and when she moves inside the hive, worker bees surround her like guards protecting their queen. Interestingly, however, the queen is not born a princess. She comes from an ordinary egg, just like any worker bee.

The only difference is that when the colony needs a new queen, worker bees begin feeding certain larvae a special substance called “royal jelly.” This milky white food is so powerful that it changes the entire genetic destiny of the larva. A larva that might have become an ordinary worker instead becomes a queen. It is a masterpiece of nature’s chemistry: simply by changing the diet, a bee’s entire life, size, lifespan, and abilities are transformed.

One of the most fascinating chapters of the queen’s life is her mating flight, which happens in daylight rather than at night. When the queen matures, she leaves the hive only once in her lifetime for this purpose. She flies high into the sky, and drones chase after her. It becomes an extraordinary competition, with hundreds of male bees pursuing one queen, though only a few reach her. The queen mates with several drones in the air and stores their sperm inside her body, enabling her to lay millions of eggs over the next five years.

Now consider the story of the drones, perhaps among nature’s strangest creations. These male bees are born without a father. When the queen lays unfertilized eggs, they develop into drones containing only the mother’s genes. These bees are larger, have big eyes, and live carefree lives. They have no sting, do not make honey, do not collect pollen, and do not even gather their own food. Worker bees feed them, almost as if idle princes are being raised.

A drone’s entire life has only one purpose: to mate with a queen. But here lies the irony—any drone that succeeds dies immediately after mating because his reproductive organs remain inside the queen. Success itself leads to death. And the drones that fail in this competition do not fare much better.

When winter approaches and food becomes scarce, worker bees throw the lazy drones out of the hive. It is a harsh decision but necessary for the colony’s survival. The drones die from cold and hunger, while the workers and the queen survive the winter safely inside the hive.

This system is strange yet remarkably successful. A queen, who can live up to five years, lays more eggs daily than her own body weight. Imagine laying around two thousand eggs per day—one every few seconds—continuing for months. She releases special chemical signals that keep the entire colony united. If the queen dies or becomes weak, the colony realizes it within hours and immediately begins raising a new queen.

Though the drone’s story may seem tragic, their existence is just as essential as the queen’s. They bring genetic diversity to the colony. By mating with multiple drones, the queen ensures the next generation carries a mix of traits, improving resistance to diseases and increasing survival chances in different conditions.

Honeybees possess an astonishing ability that scientists call the “waggle dance.” When a worker bee finds a good source of flowers or food, she doesn’t simply bring honey back. Instead, she returns to the hive and performs a special dance.

Through this dance, she tells the other bees the direction of the food source, how far away it is, and how abundant it is. The angle of the dance indicates the direction relative to the sun, while the duration of the dance communicates the distance.

The most fascinating part is that bees also account for the movement of the sun. Even if the sun has shifted position, the bee still communicates the correct direction in her dance, as if she possesses both a natural compass and an internal clock.

In other words, this tiny insect uses a system involving mathematics, navigation, time calculation, and collective communication—one that has functioned for millions of years without any teacher or school.

Thus, within a tiny hive exists a complete kingdom: a queen who rules, thousands of hardworking workers serving the colony’s welfare, and drones who play a temporary but essential role in producing the next generation. This system has functioned for millions of years without law books, police, or armies—perhaps far more organized and successful than human societies.

UBUNTU disk size increase

To increase disk size, first we need to see disk status;

df -h

If it’s a VM, make sure VM has allocated enough space before performing next actions.

Here’s the list of steps for a simple scenario where you have two partitions, /dev/sda1 is an ext4 partition the OS is booted from and /dev/sdb2 is swap. For this exercise we want to remove the swap partition an extend /dev/sda1 to the whole disk.

  1. As always, make sure you have a backup of your data – since we’re going to modify the partition table there’s a chance to lose all your data if you make a typo, for example.
  2. Run sudo fdisk /dev/sda
    • use p to list the partitions. Make note of the start cylinder of /dev/sda1
    • use d to delete first the swap partition (2) and then the /dev/sda1 partition. This is very scary but is actually harmless as the data is not written to the disk until you write the changes to the disk.
    • use n to create a new primary partition. Make sure its start cylinder is exactly the same as the old /dev/sda1 used to have. For the end cylinder agree with the default choice, which is to make the partition to span the whole disk.
    • use a to toggle the bootable flag on the new /dev/sda1
    • review your changes, make a deep breath and use w to write the new partition table to disk. You’ll get a message telling that the kernel couldn’t re-read the partition table because the device is busy, but that’s ok.
  3. Reboot with sudo reboot. When the system boots, you’ll have a smaller filesystem living inside a larger partition.
  4. The next magic command is resize2fs. Run sudo resize2fs /dev/sda1 – this form will default to making the filesystem to take all available space on the partition.

That’s it, we’ve just resized a partition on which Ubuntu is installed, without booting from an external drive.

https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed