Reader small image

You're reading from  Zero to Hero in Cryptocurrency Trading

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781837631285
Edition1st Edition
Right arrow
Author (1)
Bogdan Vaida
Bogdan Vaida
author image
Bogdan Vaida

Bogdan Vaida is a seasoned private investor who has backed over 300 crypto startups. He is a founding member of Iron Capital, a VC company incorporated in Dubai. Eight years ago, he founded his own company and has managed teams at various stages of development. He is an advisor for several blockchain projects, including Gravvity, Blockchain Valley Virtual, Gentlemen Capital, Bountie, MetaVill and Umay. For fun and profit he trades daily, having his own trading course and programming his own trading indicators and strategies.
Read more about Bogdan Vaida

Right arrow

Automated Trading

In this chapter, we are going to delve into the technical side of trading strategies by focusing on the process of coding. Our journey will begin with creating a custom indicator in TradingView, a platform renowned for its robust charting capabilities and custom scripting language, Pine Script. Crafting your own indicator can empower you with the ability to analyze markets in ways that align with your unique trading philosophy.

Following that, we will move on to the task of coding a strategy in Freqtrade, an open source algorithmic trading bot that supports cryptocurrency trading. With Freqtrade, we can take our custom strategies and convert them into algorithmic trading bots capable of executing trades 24/7 with precision and speed. This section is not merely about writing code but also about combining your trading ideas with technical execution to create powerful, automated trading systems.

Whether you are a seasoned coder or a novice in the field, my goal...

Technical requirements

As Freqtrade uses Python, a basic understanding of Python is a prerequisite. This book does not cover Python programming; however, I’ve provided a link to an Udemy course titled Cryptocurrency algorithmic trading with Python and Binance that will expedite your Python learning journey, covering Python, Pandas, algorithmic trading, and statistics.

Let’s start!

Coding trading strategies – from Pine Script to Python and beyond

In the intermediate phase of my trading journey, I found myself crafting Pine Script indicators and strategies for clients. Pine Script is the coding language used to create custom indicators on the TradingView platform. Initially, I began this journey by developing tools for my friends in our private trading circle. As my proficiency grew, my clientele expanded through their endorsements.

Interestingly, many of the strategies proposed by my clients were not profitable. While these strategies had shown promising results over one or two months during the manual development and backtesting stages, they often failed to generate profits when deployed live. At times, any profits realized were more attributable to Bitcoin’s general bullish trend rather than the efficacy of the strategy. However, amidst this sea of underperforming strategies, some stellar performers sustained profitability over the years. The...

Coding an indicator in TradingView

Pine Script, the scripting language native to TradingView, allows users to construct their unique indicators and strategies. It operates on TradingView’s servers, meaning it doesn’t burden your machine’s resources beyond displaying data, and the scripts are stored on TradingView. Furthermore, TradingView offers access to over 100,000 community scripts.

As of the time of writing this book, Pine Script is in its fifth version, which will be the focus of our discussion. Importantly, with each new version, backward compatibility is maintained, enabling the running of older scripts. While I have updated some strategies from V3 to V4 and subsequently to V5, others remain in their V4 form.

However, it’s essential to clarify that this book will not delve deeply into Pine Script. My aim is to introduce you to Pine Script, show you how to modify existing scripts to create your own, and provide resources for further learning...

Coding a strategy in Freqtrade

Having written numerous strategies for TradingView, I noticed a degree of dissatisfaction among some of my clients. Their meticulously crafted strategies, once thought to be effective, fell short of expectations. While these strategies did generate the anticipated entry and exit points, they invariably led to financial losses when tested over more substantial periods and sample sizes.

They were losing due to statistics.

For instance, a strategy might show promising profitability, but if it’s accompanied by substantial drawdowns, its practical implementation becomes exceedingly risky. Consider a scenario in which the strategy suffers a 25% loss in the first month, reducing the capital from $10,000 to $7,500. In such a situation, it would need a 34% return just to break even.

There are other issues such as days in drawdown or weeks with no trades, which can affect your psyche if you’re live-trading.

Of course, every problem has...

Trading ideas

The following is a collection of trading concepts, presented without a particular sequence. Feel free to explore and utilize any that appeal to you. However, bear in mind that you might come across some that are initially difficult to comprehend and that might require further research:

  • Start easy. Learn about some good indicators for beginners such as the ones I mentioned in the indicators template provided in Chapter 4 (and also found in the Chapter_04 directory on GitHub).
  • Most of the strategies that work in bull markets don’t work in bear markets and vice versa. Instead of creating a new strategy, why not dedicate your time to defining a correct trend (bullish or bearish), maybe coding a TradingView indicator, and setting an alarm for when the trend changes? Then, you can trade (automatically) using the proper strategies for the current market. (Technically, look into ADX, MA crosses and gaps, Hidden Markov Models, and the Hurst exponent.)
  • If...

Summary

In this chapter, we explored the intersection of trading strategy and technology by touching on the learning aspect of how to code a custom indicator on TradingView and an algorithmic trading strategy on Freqtrade. This process allows us to convert our unique trading philosophies into precise, automated systems capable of continuously monitoring and executing trades in the cryptocurrency market.

My goal here was to illustrate the potential of Pine Script and Freqtrade. This chapter was designed to ensure you’re aware of these tools, to be revisited when you have your own manual strategy. Embracing the ability to automatically test and deploy strategies 24/7 is a key advantage in trading.

The following is our final chapter in which we conclude our journey together and I will give you some further resources for the road ahead.

Further reading

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Zero to Hero in Cryptocurrency Trading
Published in: Sep 2023Publisher: PacktISBN-13: 9781837631285
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Bogdan Vaida

Bogdan Vaida is a seasoned private investor who has backed over 300 crypto startups. He is a founding member of Iron Capital, a VC company incorporated in Dubai. Eight years ago, he founded his own company and has managed teams at various stages of development. He is an advisor for several blockchain projects, including Gravvity, Blockchain Valley Virtual, Gentlemen Capital, Bountie, MetaVill and Umay. For fun and profit he trades daily, having his own trading course and programming his own trading indicators and strategies.
Read more about Bogdan Vaida