Nano Course On Python For Trading
==========================
Module 3-B (Bonus)

In this Bonus Module, I will attempt to teach you how to write an algorithm to create a Stock Screener based on @markminervini 's Trend Template from his book Trade Like A Stock Market Wizard.

+

Some of the readers asked about how to create a stock screener. So, I thought before jumping to the cloud and deploying an algorithm on the cloud, I should address this. Whatever algorithm we develop in this module, we will deploy it on the cloud in Module number 4.

+
Pre-requisites:

• Read Module 2, so that you can download the historical data. A small assignment for you - write code to automate EOD data download and save it in the folder. We need to have the latest data for the screener. Hint: set end_date = https://t.co/u2N2I53cm4()

+
The rules are:

• The LTP of the stock > 150 SMA & 200 SMA
• The 150 SMA > 200 SMA
• The 200 SMA must be greater than 200 SMA 30 days ago.
• The 50 SMA > 150 SMA & 50 SMA > 200 SMA
• The LTP > 50 SMA
• The LTP must be greater than 30% of 52-Week Low

+
• The LTP is close to 25% of the 52-Week High
• The Relative Strength(RS) should be greater than 70

SMA = Simple Moving Average
LTP = Last Traded Price

Let's get started with its coding.

+
We are going to use pandas and pandas_ta library.

+
Then we define the universe on which we are working. This universe is the same as that defined in Module 2.

+
DATA_BASE_FOLDER is the folder where your data is saved. This varies and will be different for you. Then, you define a data frame cols with all the parameters: Stock Name, LTP, RSI, 50,150, 200 moving average, 200 moving average 20 days ago, 52 weeks Low and 52 weeks High

+
We also define the main Dataframe MarketWatch that holds all the data on which we will do our calculation. Let us call it MarketWatch.

+
Then you iterate through these stocks. In order to calculate RSI, Simple moving average we use pandas ta library. It is very simple to use these functions, just call these functions ta.rsi, ta.sma .

+
Note that, when you use the above functions it returns a series. You have to fetch the latest value so access the latest value by using -1.
To calculate 52 weeks high/low, I assume that there are on average 253 trading days in a year. If you take 365 days, results will vary.

+
Finally, we create a temporary data frame df2 and append it to the Marketwatch. Finally, the market watch looks like this. 70% of our job is done. Next, we just need to write some conditions over this MarketWatch and identify all the stocks that satisfy the screener conditions.
+
Let's iterate through all the stocks in the Marketwatch. We have a variable isStockFiltered which is set to False if it fails any of the 7 conditions for the screener.

+
We check for all the 7 rules we stated above from Mark Minervini's template. If a stock fails to match any of the conditions, we reject that stock entirely. If it matches the condition, we say that the stock has met the requirement.

+
Unfortunately, in the current market scenario and worldwide market corrections, there is no stock coming under the screener for buy. If you comment out some of the conditions you may see some stocks coming, say I remove condition sma50 > sma150 > sma200 and then I see

+
some stocks are being thrown by our screener.

Note: This module will help you understand that there are details to anything to use in your trading voyage. For e.g. you may use 365 days instead of 253 to calculate 52 weeks high/low. You should also understand the underlying

+
formula on how you calculate RSI, SMA, etc. But, more than anything, you should educate yourselves so that no one can fool you into selling you random magic indicators.

Link to colab notebook (no output attached this time): https://t.co/559olcN9jj
+

More from Python

Nano Course On Python For Trading
==========================
Module 4

In this post, I will attempt to teach you how to write a trading strategy in Equity Segment that runs on your PC and create a Telegram bot that sends you buy/sell signals with Stop Loss.


Prerequisite: If you hadn't gone through the earlier modules, I strongly recommend you go through them all. Module 2: https://t.co/pciDOJXyVI

Note:
If you liked my content, you can donate, tip and support me on this link (any amount you prefer)


We are going to implement below strategy:

Rules: There should be three candles -> high of candle 1 > high of candle 2 > high of candle 3 and low of candle 1 < low of candle 2 < low of candle 3, where candle 3 is T-1 day, candle 2 is T-2 day and candle 1 is of T-3 Day, T = today.


If on today(day=T), the stock crosses yesterday high(candle 3), then send a buy signal to your telegram handle with candle 3 low as SL.

Before we get started with code, let's create a telegram bot using BotFather.

Step 1: Search BotFather in the telegram.
Step 2: type /newbot and then give the name to your bot. Refer to the second image as an example
Nano Course On Python For Trading
==========================
Module 1

Python makes it very easy to analyze and visualize time series data when you’re a beginner. It's easier when you don't have to install python on your PC (that's why it's a nano course, you'll learn python...

... on the go). You will not be required to install python in your PC but you will be using an amazing python editor, Google Colab Visit
https://t.co/EZt0agsdlV

This course is for anyone out there who is confused, frustrated, and just wants this python/finance thing to work!

In Module 1 of this Nano course, we will learn about :

# Using Google Colab
# Importing libraries
# Making a Random Time Series of Black Field Research Stock (fictional)

# Using Google Colab

Intro link is here on YT: https://t.co/MqMSDBaQri

Create a new Notebook at https://t.co/EZt0agsdlV and name it AnythingOfYourChoice.ipynb

You got your notebook ready and now the game is on!
You can add code in these cells and add as many cells as you want

# Importing Libraries

Imports are pretty standard, with a few exceptions.
For the most part, you can import your libraries by running the import.
Type this in the first cell you see. You need not worry about what each of these does, we will understand it later.

You May Also Like

First thread of the year because I have time during MCO. As requested, a thread on the gods and spirits of Malay folk religion. Some are indigenous, some are of Indian origin, some have Islamic


Before I begin, it might be worth explaining the Malay conception of the spirit world. At its deepest level, Malay religious belief is animist. All living beings and even certain objects are said to have a soul. Natural phenomena are either controlled by or personified as spirits

Although these beings had to be respected, not all of them were powerful enough to be considered gods. Offerings would be made to the spirits that had greater influence on human life. Spells and incantations would invoke their


Two known examples of such elemental spirits that had god-like status are Raja Angin (king of the wind) and Mambang Tali Arus (spirit of river currents). There were undoubtedly many more which have been lost to time

Contact with ancient India brought the influence of Hinduism and Buddhism to SEA. What we now call Hinduism similarly developed in India out of native animism and the more formal Vedic tradition. This can be seen in the multitude of sacred animals and location-specific Hindu gods