Steemit Crypto Academy Contest / S20W4: Algorithmic Trading with Moving Averages on Steem

in hive-108451 •  2 months ago 

Black And Green Modern Trading Strategies YouTube Thumbnail_20241006_200456_0000.png
Canva

Hello, everyone; I hope you all are doing well. I am here to share my participation in the Steemit Engagement Challenge season 20, week 4. This is gonna be a difficult but interesting topic to participate in. I hope I will fulfil all the questions demands according to the professors.

Explain the concept of algorithmic trading and its significance in modern markets. Provide an example of a basic algorithmic strategy using moving averages and show how it could be applied to the STEEM/USDT trading pair.

First I want to clear the concept of algorithmic trading this is also called as Black box trading and in this trading we use the computer programs to interpret trading which is implemented on already free define rules and regulation.

So basically these rule or algorithms are used for the technical analysis of market data and we can enhance our decision making capacity and then precisely accurately we can do trading.

Importance in market

Efficiency ability has been increased to avoid human error because this is an automatic trading.

Secondly within seconds algorithms can be made and speed is very much improved again due to its automatic programming. The most important thing is large amount of data is analyse within second in this way scalability is improved so much.

And for example if we have to hire so many people for trading so we have to give salary to each person but in this automatic trading there is less cost we use less manual labour cost. And this is dominating market competition trading.

Moving Average Crossover

We use two types of moving averages

  • SMA which is 50 period from its name it is predicted this is used for analysis of short term price movements.

  • Long-term moving averages this for 200 periods and this is a very important indicator for the long term price movements in the market.

Trading logic

Buy signal

So when SMA is crossing above the level of the long term moving average this is a signal for a buy signal

Sell signal

It is easy to understand when SMA is crossing below the levels of the long-term moving average, this is the indication of a cell signal. As I always mentioned, there are risks associated as well. For example, the market is always volatile, and there is the risk of flash.

As I mentioned, it is automatic, so there are maybe chances of connectivity problems, or sometimes there may be technical issues. In this graph, the Ema weighty prices, which you can say is around 9.4k, are holding as support, which means BTC will increase.

So, I am using the moving average indicator analyser for 100, 50 and 200 days, and I am showing this on the same chart. What we can see from this chart is support and resistance lines that may be overlooked.

IMG-20241006-WA0059.jpg
Source

Compare different types of moving averages (SMA, EMA, WMA) and discuss their benefits and drawbacks in an algorithmic context. Which one would you prefer for your algo-trading strategy and why? Provide a practical example on a Steem chart.

First, I will describe the term moving average. This is a technical analyser that gives us the average price of any asset during a specific period or set period. This is most commonly used because of its simplicity and loyalty.

For calculating the moving average, you need to know specific information about previous data. For example, let me give you an easy example: you want a 10-day moving average, and you need data for 10 days in the same way a 200-day moving average needs 200 days of data.

This provides the direction for any asset price and will let us know the indication for a trend change. There are many types of moving average

SMA

Simple moving average This is a very simple calculation of the average price of an asset in a given period. For example, to calculate the SMA for 40 days, you need to take the close prices of the last 40-day candle on a given one-day chart, and then divide by 40.

IMG_20241005_171833.jpg
Source

Now I am giving you an example of the chart of one day you will long the period of SMA, it is going to lag behind the price. For example 62 SMA from the recent price than the 30,5 SMAs. As I already mentioned, 62 SMA will add a closing price of the last 62 period, and then, we divide it by 62.

In the chart, we can see the upward trend, and this gives us a broader view and helps to get the price movement in the general direction.

Benefits and drawbacks

If I talk about the benefits and dropback of SMA this is very simple to use and it is very less responsive to price fluctuations

And drawback it is very very slow to be reactive to market price fluctuations another important thing to discuss his it is lagging behind the price movements

EMA

Exponential Moving Average

SME is easy because this gives us the Average of all prices in a specific period where, whereas EMA provides more weightage to recent period prices.

EMA = Closing × multiplier + Last day × (1-multiplier)

Let me elaborate more clearly: this is the charge of 4-hour Bitcoin and SMA 60 EMA 60.

IMG_20241005_171940.jpg
Source

Just look at the red line at EMA 60, which is very close to the price rather than the yellow line, so let's say if the trend changes, the EMA will change direction more quickly than the sma.

This is due to the reason I already mentioned EMA is gaining more weightage in the recent price, and it also protects you from the fake false signals which are used by the simple moving average.

Benefits and Drawbacks

This is very faster to respond to any market changes and this is more than Sensitive and more reactive to recent price changes

The drawback is I think sometimes we may attract false signals if we are using this for trading, and it requires strong parameters for reaction.

WMA

The last time is the weighted moving average. This is one line even faster than the EMA, and it provides us with higher priority indications than EMA, and it is the prediction of linear weighted prices to make sure of the most recent price.

Benefits and Drawbacks

This is a collaboration of benefits of both categories and this is also more reactive to recent price changes. It is very complicated, and its calculations are very difficult to calculate, and still,l, it is lagging behind the price changes.

What I am using

I am using the for-algo trading strategy the EMA. Because it is faster and this is, I think, faster to react to changes. Another thing is that it is very sensitive to the market's recent prices, and another thing is that there is a wide range of technical analysis to do trading.

SMA and EMA

So from my point of view, the EMA is always the best choice rather than the two others because it protects from fake signals, it protects us from the local trends which are going on, and there is a chance of getting significant profit when you are doing trading.

SMA is very simple but you may miss a lot of chances of getting profit. In this graph, we can see Ema's weighty prices, which you can say is around 9.,4whichit is holding as support, which means BTC will increase.

IMG-20241006-WA0055.jpg
Source

Create an algorithmic trading strategy for the Steem token using moving averages. Define your entry and exit signals and risk management rules (such as stop-loss levels), and explain how you would backtest your strategy to ensure its effectiveness.

So another important question is the moving average crossover strategy for steem. So basically, we use this strategy. We are using two types of moving averages to predict the buy and sell signals. So we mainly see the crossing over the SMA (20 period) at Long-term MA (50 period). This is an indication that we are going to begin buying signals. And if the signal is vice versa.

Buy signal

As I already mentioned in my last question if the crossing over of SMA (20-period) is above the level of Long term MA (50-period). So we will see the price of the steem which is 200 period moving average.

Sell signal

If SMA (20-period) is going to cross over Above the level of long term-MA (50-period).
So we will see the price of Steem is going to be below the level of the 200-period moving average.

Risk solution rules

Stop loss

Stop loss should be 5 per cent under the entry price level. And profit can be up or below 10 per cent.

Backtesting

For an hour time frame, I select the data duration from 6 months to one year on finance by selecting steem/USDT.

So firstly, for this process, we need to calculate and collect all the previous historical background data, and then we need to do the application of MA after that, the technical analysis of signals. Then, we need to see the MA period selection of stop loss and profit.

Discuss the tools or programming languages ​​you would use to implement your algorithmic strategy (eg, Python , TradingView , MetaTrader ). Provide a brief code snippet or logic diagram demonstrating how your strategy could be automated.

For algorithmic strategies I would like to use there are so many but what I prefer is going to tell you.

Python

So there are so many good features of it for example pandas and scikit learns and due to its simple use I always prefer Python.

Trading view

This is another one of my favorites for getting graphical and technical analysis I always use this most of the time.

Meta trader

One of the best platforms for automatic trading.

IMG-20241006-WA0058.jpg
Source

IMG-20241006-WA0057.jpg
Source

Python is very simple to use and this is having the feature of versatility means it has the power of automation so that it can save your time whether you belong to any category for example technical data analysis something you are doing it provides you with a wide range of processing.

If your using the excel file and you want the automation for reading/writing data just use this.

IMG-20241006-WA0056.jpg
Source

This is basically a request to recall any Url link you want to process it automatically or want to get online sources. To import requests this is code used.

IMG-20241006-WA0045.jpg
Source

Evaluate the performance of your algorithmic strategy using historical Steem market data. How well did it perform during different market conditions (bullish, bearish, sideways)? Provide your findings and suggest improvements.

In order to evaluate the performance of algorithmic strategy by use of Steem data. I am going to use the historical steem data from binance for the time frame one hour 2020-2022.

Backtesting

MetricValue
Sum up trading247
Winners of Trading138 (53.5%)
Lose of trade111 (41.5%)
Profit/Loss ratio is in1.18
Drawdown10.5%
Sharpe Ratio0.78

Market sceneries

Market valueProfit and Loss RatioWinners Trading (%)
Bullish1.4859.5%
Bearish0.7843.5%
Sideways1.1247.0%

Calculation

Now I will tell you somehow about that technical analysis actually during the bullish market if I tell you about the ratio it was 1.48.

And the ratio of profit and loss during bearish was 0.78 and same for the sideways it was 1.12. The maximum drawdown was 11 percent sum up.

Improved solutions

We can do more stop-loss settings while the bearish trending markets. We should have keen eyes on the market volatility.

We should do analysis for many multiple time frames to prevent loss by rely on false signals. Should not use single signal should be used in addition of others for example Bollinger bands ,MACD.


This was all about my participation. I hope you all like it & share your valuable feedback. I would like to invite my friends @m-fdo, @goodybest and @pea07 to share their participations. Thank you.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
Loading...

Upvoted! Thank you for supporting witness @jswit.

Upvoted. Thank You for sending some of your rewards to @null. It will make Steem stronger.

image.png

Curated by : @malikusman1

Thank you.

Hi @ashkhan you have presented a good post related to algorithmic trading.

Algorithmic trading helps us to automate the trades in an effective way with Hugh precision. It automatically detected the buy and sell signals and proceed the trades in that direction.