Cryptocurrency analysis and predictions using AI and big data

Discussion in 'CryptoCurrency' started by healzer, Jan 3, 2018.

  1. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    The reality is that most AI prediction ICOs out there are just out there to promote their own coins. They just talk and try to bait you into "investing" in their thing. I don't care a dime about ICOs because in my opinion only the biggest coins matter (BTC, ETH, LTC, BCC, ...), everything else is just a duplicated scheme. I've seen very few organizations out there that go as detailed and deep into AI and trading like we do. So there you have it. :)
     
  2. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Profitable Crypto trading strategies part 5: Voltra

    In today’s episode I will reveal, analyze and discuss our latest trading strategy which we named “Voltra”. This strategy yield can yield ROIs between 40% and 90% per month with relatively few trades, but also depending on which market you focus on.

    [​IMG]

    The name Voltra is actually the combination of “Volume” and “Trades”. The reason is pretty obvious: the Voltra algorithm is primarily constructed on the traded volume. This means that it generates buy and sell signals using the price and its traded volume. This is actually our very first algorithm where trading volume is a key component.

    The first unfortunate part is that the algorithm has four hyper-parameters which are tough cookie to optimize. Matter of fact, I had to run the (brute force) optimization code all night because it takes several hours to finish. The second part is that, like all our previous methods, it is not some magical formula that wins every trade. But if you know a tad about investing or trading then this does not come as a surprise.

    Let us now take a look at Voltra’s buy and sell decisions. The chart below shows the Bitcoin (BTC-USDT) market at 30-minute intervals for 30 days. As you already know by now: the “B” marks indicate buys and “S” indicate sells.

    [​IMG]
    Voltra for BTC-USDT yielding an ROI of 52%
    The signals from the chart above yield an ROI of 52% over 30 days, but even better it did all of this in exactly 7 full trade cycles (buy low to sell high).

    The tricky part is to get the hyper-parameters right. Actually, there is no way to get them right. By optimizing the parameters we try to maximize the ROI, but in actuality we are optimizing them against the 30-day data set. For instance, if we then take a different 30-day data period, these same parameters may not end up being the most optimal ones, i.e. generating the highest possible ROI in that scenario. But on the other hand, as long as our parameters are within a certain range they will more or less revolve around the maximum ROI. To illustrate this, have a look at the chart below. In this case I have slightly adjusted all of its hyper-parameters, and even though most buy and sell signals remain the same, the ROI on the other hand has decreased from 52% to 42%.

    [​IMG]
    Sub-optimal — Voltra for BTC-USDT yielding an ROI of 42%
    We also know that some algorithms perform way better (or worse) in some markets compared to others. In my research I have used three markets: BTC, ETH and LTC. My results indicate that the Voltra algorithm works best for ETH-USDT than for BTC or LTC.

    The chart below shows the buy and sell signals from Voltra for ETH-USDT. It generated two more full trade cycles (nine in total), and yielded an ROI of 82% over a 30-day period, which is way better than it did for BTC.

    [​IMG]
    Voltra for ETH-USDT yielding an ROI of 82%
    When I applied Voltra to LTC-USDT, I noticed that it generated nine full trade signals just like it did for ETH. But the overall ROI was way lower: only 45%, making it not much worse nor better than with BTC.

    [​IMG]
    Voltra for LTC-USDT yielding an ROI of 45%
    Conclusion
    What I find most fascinating is that Voltra (like all of our other algos) is able to generate pretty good entry and exit (i.e. buy and sell) signals. These may not be the most optimal ones, which no system can ever guarantee, but they are pretty solid. For instance, sometimes it is too hasty and sells to early, and sometimes it generates a buy when there is a localized “dump” in progress.

    These deficiencies make this strategy too risky to be used in a fully autonomous trading bot, but they are extremely useful to assist us at trading manually. To give you an example, a human is capable of detecting when a rapid dump is going on, if so he/she would either sell or do nothing. On the other hand, if there was a stable period followed by a rapid pump then one ought to take advantage of that and enter the market as quickly as possible. A system like Voltra isn’t yet sophisticated enough to take all these factors and anomalies into consideration.

    But as I reflect on our progress, it becomes a huge motivational drive; as we keep moving forward our algorithms become more robust and reliable — it is only a matter of time before we reach new heights.

    Thank you for reading and have a wonderful day!
    - Ilya
     
    • Thanks Thanks x 2
  3. fredfredricks

    fredfredricks Registered Member

    Joined:
    Jan 2, 2017
    Messages:
    77
    Likes Received:
    11
    You are phenomenal. Thank you buddy
     
    • Thanks Thanks x 1
  4. geneticwaste

    geneticwaste Junior Member

    Joined:
    Apr 4, 2008
    Messages:
    152
    Likes Received:
    23
    I was going to buy your Pinterest bot but then you sold it and I decided to hold on. That's how I landed here.

    I just played around with the predictions chart and changed the datetime to two days ago, but the chart will still render predictions for now, not for the datetime.

    Also, how can I generate or display those buy and sell signals from your Voltra algo?
     
    • Thanks Thanks x 1
  5. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Hey :)

    Thanks for dropping by.

    On the predictions chart, try clicking the "generate" button after having changed the datetime.
    The voltra algo (including all other algos) are not yet available for the public yet.
    We are still working on our second app. We are having some delays though, so I'm estimating it will be ready in two weeks time.

    Cheers!
    Ilya
     
    • Thanks Thanks x 1
  6. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Profitable Crypto trading strategies part 6: Good entries

    One of the most unique features in our upcoming app are the trading signals. I have already written five posts about different trading strategies. In this post I’ll discuss and compare some of our existent strategies — more specifically I want to investigate their potential use and purpose.

    About two weeks ago I’ve plugged-in our trading strategies to our real-time simulation framework. This framework simulates a real trader. The trader is obligated to buy and sell according to the signals generated by each algorithm in our system. This way we compute the ROI in a real-time fashion, which is much more accurate than running an inaccurate back testing simulation.

    Recall that our algorithms generate signals based on various criteria, one of the important criteria is the interval size of candlesticks.
    The table below displays the most recent strategies with their corresponding ROI. The ROI, in this specific scenario, is computed using the signals of the past 30 days (= period duration). You’ll see that there are two crypto markets included: Bitcoin (BTC-USDT) and Litecoin (LTC-USDT), but also two distinct interval sizes: 30min and 60min. In the final version we’ll have many more markets such as Ethereum, Ripple, Bitcoin Cash, and more.

    [​IMG]
    Crypto trading strategies with their corresponding ROIs
    It’s satisfying to see that all of the ROIs are positive, which means that the algos are doing a good job. But there is a pretty large difference between them. Some ROIs are below 10% while others are close to 30%.

    To understand why this is so, we have to look at the buy and sell decisions of each algorithm individually. But I don’t want to spend countless of hours comparing every single possible combination — so instead I will analyze the algorithm with the highest and lowest ROIs and see what we can learn from it.

    The lowest
    In our case, Voltra 1.0 for BTC-USDT at 30 min intervals, is the algorithm that generates the lowest ROI (of 5.2% to be exact). By click the “show chart” button I make it show all buy and sell decisions it has made:

    [​IMG]
    Voltra 1.0 (BTC-USDT) at 30min intervals yields 5.20% ROI
    There are two things we learn just by looking at this chart:
    1. Not every buy signal is optimal.
    2. Not every sell signal is optimal.
    In reality we can never make “perfect” trades, because we cannot know if some price has reached its ultimate localized peak or valley. Instead of trying to reach perfection, we’ll take a different approach to increase our ROI. If you think deeper about this issue, we can agree that optimizing for better buy decisions is harder than optimizing for better sell decisions.

    Good buys
    With buy decisions you can just buy during a stable period, by taking the calculating risk that the price is going to go up in the near future. Or you can wait for a mini-pump and buy-in as soon as you detect it. Most of our algorithms are pretty good at making decent buy decisions, at least way better than most newbies and even some “experts”.

    Mediocre sells
    But the algos are not very good at making sell decisions. Sometimes the sell occurs too early — sometimes the human eye can see that the price will keep going up, but the system decides to sell after all. And sometimes it waits too long and the price just keeps crashing. To illustrate this, have a look at the next chart. It’s the same one as above, but this time I’ve marked the sub-optimal “sells”.

    [​IMG]

    The highest
    At the time of my analysis, Voltra 1.0 at 30 minute intervals for the LTC-USDT market had the highest ROI of over 29%. The chart below shows its buy and sell decisions:

    [​IMG]
    Voltra 1.0 (LTC-USDT) at 30 minute intervals yielding 29% ROI
    Even though the ROI of this algorithm is pretty darn good, it can be optimized quite a lot. Because once again, some of the sells are sub-optimal, as a result, there are many regions where the system sells too early and a few intervals later enters a buy trade. This heuristic of entering a buy shortly after a sell is quite costly due to the 0.1% trading fees, as a result it has quite an impact on the final ROI.

    On the chart below I’ve indicated some regions where the sell trade occurs too soon. The system should instead have waited a couple of hours before selling, or in one case (the first marked area) it should’ve sold sooner.

    [​IMG]

    Conclusion
    All of these drawbacks are not a problem at all, because these algorithms aren’t optimized for auto-trading yet — but instead should be used as a tool in manual trading.

    Most people don’t know when it’s a good time to buy, so they are better off by using the buy signals from our algos. On the other hand, once they’ve bought, it’s a good thing to regularly monitor the price and wait until it has reached a desired ROI (e.g. of 1%). The sell signals should then be used as a notification or reminder that you should either sell immediately or wait a bit longer, if the price is going up that is.

    Lastly, on the ROI table you may have noticed the “Macd 1.0” and “Macd 2.0” algorithm — this is our latest algo which I’ll discuss in more detail in the next part. So definitely stay tuned for that one! And as always, thanks for reading & have a great day!

    — Ilya
     
    • Thanks Thanks x 3
  7. HofiKingston

    HofiKingston Junior Member

    Joined:
    Jul 28, 2017
    Messages:
    114
    Likes Received:
    23
    Gender:
    Male
    This is pretty awesome!!
    One question tho, do you know when this app will go live?

    Or can those trading signals be found somewhere else but in the upcoming app? :)
     
    • Thanks Thanks x 1
  8. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    We expect the app to go live in a week or two.
    These signals can not be found anywhere else yet. You'll have to stay tuned :D
     
  9. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Why intra-day trading crypto can be better than holding

    If you are relatively new to trading crypto currencies, then this tutorial is what you need. In this tutorial I will try to explain how you can use crypto to grow your capital base by at least 1% per day.

    [​IMG]

    Don’t just Hodl
    Hodling (a.k.a. holding currencies) is the strategy of buying some crypto asset (e.g. Litecoin) and holding it for many days, weeks, months or even years. This may be a good strategy for newly launched ICOs that may double, triple or quadruple in value soon. But I personally advise you against holding, in other words, don’t follow the herd and don’t be a headless chicken.

    In my examples I’ll be using the Binance exchange. Keep in mind that I am not affiliated with Binance in any shape or form.
    The reason why holding isn’t a very practical move for well established coins is because of their volatility. For instance, Bitcoin (see chart below), increased by ±30% over a period of ±20 days. But it doesn’t mean it had a linear increase of 1.5% per day, some days went down while others went up.

    [​IMG]
    Bitcoin at daily intervals
    Risk of holding
    Assume you use the chart above to forecast Bitcoin’s growth — by looking at the chart the price should reach $12.4k in another 20 days or so. The reality on the other hand is not some linear calculation — there is no way one can predict the price to reach even $10k by tomorrow. The price could even crash to $8k. And so your investment of $9.6k would then be worth much less because you took a wild guess and lost. Holding is more like gambling than trading, simply because the risk is too high and there’s too much uncertainty.

    My strategy is to trade them continuously. I am a huge believer that assets unused diminish — meaning: whatever you don’t use, you lose. Saving piles of coins under your bed, hoping their value will increase isn’t always the best way — unless you are willing to take that risk or you know with high certainty that the price of some crypto coin will go up in the next few days, weeks or months.

    Day Trading
    Trading assets on a regular basis could be a safer bet and might be more profitable for you. From the previous section we learned that Bitcoin grew by an average of 1.5% per day (during the past 20 days). So you can actually take the risk of buying today and selling tomorrow or within the next couple of days. There is no guarantee that tomorrow’s price will be higher than your current buy price — but it’s still better than crossing your fingers and holding indefinitely.

    You can set a limit to how low the price may go, for instance, if your investment decreases by 5% and keeps going down, then you should sell to avoid more losses. On the other hand, keep holding until you’ve got an increase of at least 1%. In this context, day trading is less risky than holding — because it’s more calculated.

    Intra-Day Trading
    I always vouch for day trading over holding, but can we actually do better than 1% per day? How about we generate 1% two times, three, four or even five times a day? This is possible and the proof is in the numbers.

    If you analyze many crypto currencies, you’ll notice that they have high volatility, that is they can go up or down in value really quick by a significant amount. Have a look at the chart below, which shows Bitcoin’s price at 30-minute intervals:

    [​IMG]

    In matter of hours the price can go up or down by 1%, 2%, 3% and sometimes even more. This is a great thing, because all we need to do is wait for a good entry position (i.e. buying) and then sell a couple hours later once it has gone up by some percentage. By repeating this process, you can make a decent ROI on a daily basis. Even during down trend periods (where the down trend is visible on the daily chart), the intra-day intervals will still have these high margin opportunities.

    Using indicators
    Many traders use indicators (such as MACD, EMA, SMA, RSI, …) to stay ahead of the game and detect their golden buy/sell opportunity. These indicators “can” work but never rely on them blindly.

    The “wave riding” strategy
    Remember that profits come from buying as low as possible and consequently selling as high as possible. So everything starts with finding a good low entry position. On the chart below I have drawn orange rectangles to indicate good buy positions.

    [​IMG]

    In this strategy you wait for at least 2–3 hours, and if (almost) every candlestick was green, then you should buy. Then wait until you’ve reached your desired ROI (e.g. 1%) or until the price starts dropping. But don’t be scared because you will encounter a few red candlesticks along the way. And remember, not every trade you make will be profitable, but if you keep at it then you’ll have more wins than losses.

    The “turn-around” strategy
    On the chart above I’ve used 30-minute candlesticks to trade by. Alternatively you may want to use shorter intervals. We may, for instance, use 5-minute candlesticks. By using smaller intervals we’ll usually aim for a lower ROI such as 0.5%, and on the other hand have more opportunities.

    The 5-minute interval strategy is to look for “turn-around points”. I have marked these on my chart below. These are moments when there is a “U” or “V” shape in the candlesticks. Once you detect these then it is time to buy. An even better position is to buy at the lowest point (the valley) of the “U” shape, but this requires guesswork and isn’t practical to detect.

    [​IMG]

    Notice that I’ve used two different rectangles: orange and blue ones. The orange one shows entry positions where a profit can be made, by buying in that region (preferably the lowest point) and then selling a few intervals down the road. The blue ones are the trades that would result in a loss or break-even situation.

    The idea is to avoid making trades that are categorized by the blue rectangles, and focus only on the orange marked ones. This isn’t practical for us humans, because of uncertainties and the complexity of the market. This is a quest we are trying to solve by using machine learning and A.I. technology.

    Conclusion
    In this post I explained three methods for making a daily ROI of at least 1% by trading crypto currencies, Bitcoin in particular. Even though trading can be a risky business, it is only so if you don’t have a clue of what you’re doing. But once you have a basic plan that works, you are set. I hope this post served useful to many aspiring crypto traders. Remember: An ROI of just 1% per day turns into 3396% in 365 days — which is a heck of a lot.

    Thanks for reading & have a great day!
    - Ilya
     
    • Thanks Thanks x 1
  10. mpikxfx

    mpikxfx Registered Member

    Joined:
    Dec 20, 2013
    Messages:
    82
    Likes Received:
    9
    Following my friend. Good interesting post
     
    • Thanks Thanks x 1
  11. Michael Goode

    Michael Goode Newbie

    Joined:
    Aug 7, 2016
    Messages:
    23
    Likes Received:
    2
    Gender:
    Male
    @healzer

    How can I message you privately? As someone experienced in python who is also developing trading algorithms specifically for Binance I would love to chat
     
  12. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Hi mate :)
    Hit me up on Skype, id: healthchants

    Cheers,
     
  13. EinnivDwain

    EinnivDwain Newbie

    Joined:
    Apr 4, 2017
    Messages:
    29
    Likes Received:
    6
    Gender:
    Male
    Awesome Op
    Keep up the great work!
     
    • Thanks Thanks x 1
  14. fredfredricks

    fredfredricks Registered Member

    Joined:
    Jan 2, 2017
    Messages:
    77
    Likes Received:
    11
    Thank you. I am following
     
    • Thanks Thanks x 1
  15. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Profitable Crypto trading strategies part 7: Macd 1.0
    MACD stands for Moving Average Convergence Divergence, it’s nothing more than an over-complicated name for a basic indicator. The Macd indicator simply shows the relationship between two different moving averages (simple or exponential ones). In this post I will analyze and discuss our first Macd based trading strategy.

    [​IMG]

    MACD explained
    If you don’t know or understand the Macd indicator then have a look at the candlestick chart above. The upper chart is the daily BTC-USDT chart, the lower plot is the Macd indicator. The indicator consist of three components: the purple and yellow lines are two different moving averages. When we subtract the yellow line from the purple we obtain the red/green bars (bar plot). Values greater than zero are indicated by green bars and the negative are red. That’s all there is to it.

    MACD trading strategy
    How can you use it to trade then? Macd is a pretty useful indicator that has some surprisingly interesting properties. One can invent several trading strategies, but here’s one of them: when there is a transition from red to green; this indicates a “buy” signal. But to sell it’s less evident, using the green to red transition may leave you with low success rates. So instead aim for making a 1% or 2% ROI, thus selling whenever you reach a certain ROI.

    Another more theoretical strategy: try to detect the lowest (red) point on the bar plot to buy; then sell at the highest (green) point. Unfortunately we cannot know for sure whether the “current” value is the lowest (or highest) point and involves a lot of guesswork. Machine learning and AI on the other hand can do a much better job at determining the probability of some “current” value being the highest or lowest point, but this is a topic for another time.

    MACD 1.0
    Our Macd trading strategy is slightly more sophisticated than the one I explained above. Without going into the details, let us look at how it performs against the market. In the backtesting results below I’ve computed the ROIs based on 3 different markets: BTC, ETH and LTC (in USDT) using 60min intervals over 30 days.

    The plot below shows the LTC-USDT market with our generated signals, from 2 April until 2 May. The ROI by these signal is exactly 20.26%, which is about 0.66% per day.

    [​IMG]
    Macd 1.0 on LTC-USDT (2 April to 2 May)

    On the next chart we see the ETH-USDT market with the buy/sell signals — yielding an ROI of 12.44%.

    [​IMG]
    Macd 1.0 on ETH-USDT (2 April to 2 May)

    And finally the BTC-USDT chart with an ROI of 16.64%.

    [​IMG]
    Macd 1.0 on BTC-USDT (2 April to 2 May)

    It’s important to note that the exact ROI value is less important than the bigger picture. That is, Macd 1.0 performs better for LTC than for ETH and BTC. The reason why is not very evident, and a lot has to do with the shape of the market and the timing of the buy/sell signals (i.e. luck).

    Our Macd algorithm has 5 different hyper-parameters which we can optimize. But doing that will require hundreds of thousands of computations, which will take many hours (or days) to complete. This means one thing: the ROI can always be optimized, but since the market is always changing, the most optimal “general” hyper-parameters do not exist — thus it’s not worth the effort, since we’ll be playing a game of catch that we cannot win.

    The shape of the market
    I’ve mentioned several times already that the shape of the market matters a heck of a lot. Our trading algorithms are nothing more than programmed heuristics, and right now they are still early stage (i.e. dumb machines).

    To illustrate this, let us backtest the Macd 1.0 strategy on a different set of recent data. The chart below shows the LTC-USDT market and our buy/sell signals from 17 April to 17 May. The ROI of these signals resulted in a negative -8.61%.

    [​IMG]
    Macd 1.0 on LTC-USDT (17 April to 17 May)
    Next up is ETH-USDT, yielding a negative ROI of -3.23%.

    [​IMG]
    Macd 1.0 on ETH-USDT (17 April to 17 May)
    And finally BTC-USDT, resulting in a negative ROI of -4.38%.

    [​IMG]
    Macd 1.0 on BTC-USDT (17 April to 17 May)
    Why is it that these ROIs are all negative?
    The state and shape of the market matters a lot. Until May 6 the markets were in up-trend but then the prices started going down aggressively. The markets changed but the algorithm(s) remained the same, they keep generating the buy/sell signals as they were instructed (i.e. programmed) to do.

    Does this mean you can’t make money in down-trend periods?
    No, but it’s much riskier to trade during these periods, the proof is in the numbers. I notice that even during down-trend periods there are a ton of opportunities to cash out on.

    On the candlestick chart below I’ve indicated very lucrative periods where you can aim to buy at a valley and sell at the peak. This again requires some guesswork as it’s pretty hard to know for sure if the “current” is at a valley, so it’s a risk you have to be willing to take.

    [​IMG]

    Timing matters
    Alternatively, I also mentioned that there is some luck involved (i.e. the timing of the buy/sell signals). For instance, two people can follow the same signals for 30 days, and one of them will end up making 10% ROI while the other one will hit break-even (0%) or worse. I actually saw this happen earlier today.

    On our (newly upcoming) app people are able to look at the buy/sell signals for any given strategy. Over the past 30 days the Macd 1.0 (at 30min intervals) for LTC-USDT generated the signals as shown on the image below, yielding an ROI of 10.90%.

    [​IMG]
    App: LTC-USDT Macd 1.0 signals (OHLC plot)
    If I run the exact same simulation in my other backtesting framework (image below) I get an average ROI of -0.80%.

    [​IMG]
    Backtesting: LTC-USDT Macd 1.0 signals (one of the many runs)
    Why is it that the same strategy, the same market shape and state result in extremely different ROIs? Why is one positive (10%) the other one negative (-0.80%)? It has all to do with timing.

    A buy/sell occurs when the price passes a certain threshold and meets certain criteria. Since neither of our system are analyzing the price in real-time, a window of opportunity is sometimes missed, as a result no buy/sell occurs. The app algo follows the price with a 10 to 20 second delay, while the backtesting framework takes a random price from the [Low, High] range.

    Our backtesting framework runs one hundred simulations, computes their ROIs and spits out the average value (which is -0.80%). But it also gives the standard deviation which is 6.43%. This means that in reality, for most people (68%) who’ll be following these signals will end up earning an ROI between [-7.23% and 7.23%], during these 30 days (i.e. state of the market) that is.

    The ROI from our app is almost two standard deviations away from the mean, making it an exception — but it’s a good exception. On average it is notifying us really well, the timing is exceptionally well.

    Conclusion
    All our trading strategies will need to be reworked and improved to cope with down-trend periods. Either I’ll have to make them stop trading when a down-trend period is detected or have the system adjust its own hyper-parameters in function of the state of the market. The latter approach would be quite experimental but might turn out to be an exciting adventure.

    I hope you enjoyed the analysis, make sure to stay tuned for the next part.
    - Ilya
     
    • Thanks Thanks x 1
  16. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Profitable Crypto trading strategies part 8: Macd 2.0
    In yesterday’s post I explained the MACD indicator, how you can use it for trading and analyzed our Macd 1.0 trading strategy. In today’s post I will introduce the second version of our Macd strategy and explain how it differs from the first one.

    [​IMG]

    Macd 1 vs. 2
    The only difference between Macd version 1 and 2 is that the second one has more sophisticated “buy” criteria. This means it’s more calculated on when it decides to enter “buy” trades. It may come to you as a surprise, but just a couple lines of additional code can actually double the ROI.

    Using hourly candlestick intervals, a 30 day period from 2 April to 2 May we obtain the following ROIs:

    LTC-USDT
    Macd 2.0 yields 29.09% (±7.22%), while Macd 1.0 only 18.59% (±6.11%).

    [​IMG]
    Macd 2.0 for LTC-USDT
    ETH-USDT
    Macd 2.0 yields 79.90% (±9.93%), while Macd 1.0 only 11.08% (±4.11%).

    [​IMG]
    Macd 2.0 for ETH-USDT
    BTC-USDT
    Macd 2.0 yields 22.12% (±4.57%), while Macd 1.0 yields 22.03% (±5.65%).

    [​IMG]
    Macd 2.0 for BTC-USDT
    It’s fascinating how much ROI was generated (on average) by trading ETH compared to all the other coins using the exact same strategy and market conditions.

    The state of the market matters
    This is a concept I emphasized a lot in our previous post, simply because it’s that important I have to press it again. These wonderful ROIs by the Macd strategy are only possible during favorable market conditions (i.e. shape of the market favors the strategy).

    Let us repeat the same analysis but for more recent market conditions, specifically from April 17 to May 17:

    LTC-USDT
    Macd 2.0 yields -4.17% (±4.58%), while Macd 1.0 only -6.71% (±5.32%).

    [​IMG]
    Macd 2.0 for LTC-USDT
    ETH-USDT
    Macd 2.0 yields 37.01% (±6.27%), while Macd 1.0 only -2.05% (±1.96%).

    [​IMG]
    Macd 2.0 for ETH-USDT
    BTC-USDT
    Macd 2.0 yields -1.13% (±3.37%), while Macd 1.0 only -5.58% (±2.23%).

    [​IMG]
    Macd 2.0 for BTC-USDT
    Does all of this mean that Macd 1.0 is obsolete? Definitely not, it serves its purpose and the data proves. On average the Macd 1.0 strategy has a lower ROI deviation from the mean, meaning its more predictable in its outcome. While Macd 2.0 has higher ROIs, it also has more unpredictable outcomes.

    But even by taking the standard deviations into account, the ROI of Macd 2.0 (on average) remains better.

    Conclusion
    The ROI in the second part of our analysis was much worse, and even negative for both the BTC and LTC trades. The reason is because there were too many losing trades from 6 May to 17 May, due to down-trend market conditions. This means the strategy is unable to generate profit during bad market conditions.

    Up to this point our algorithms were not designed to take down- and up-trend conditions into account. So that’s an additional variable I am going to include in all our algorithms in the near future. The basic idea would be to completely stop trading during bad conditions, or minimize their effect. Alternatively we can develop and use different strategies specifically designed for generating revenue during bad conditions as a backup mechanism when things go bad.

    I thank you for reading and make sure to stay tuned for the next episode.
    - Ilya
     
    • Thanks Thanks x 1
  17. Michael Goode

    Michael Goode Newbie

    Joined:
    Aug 7, 2016
    Messages:
    23
    Likes Received:
    2
    Gender:
    Male
    Great findings! I've explored EMA,BB,RSI, stochRSI on backtests similar. We can compare notes if you like.

    One thing I notice is you are trading a maximum of 1 at a time. From my own research I find allowing maybe 3 simultaneous trades on a market can help massively - an early buy resulting in a poor trade can be offset by another trade that buys at a cheaper price some short time later.

    Another thing to note is are your buy signals merely based off of a single indicator. Are you doing any sort of analysis on the short term trend to buy when it looks when price has stopped failing?
     
    • Thanks Thanks x 1
  18. healzer

    healzer Jr. VIP Jr. VIP

    Joined:
    Jun 26, 2011
    Messages:
    2,950
    Likes Received:
    2,934
    Gender:
    Male
    Location:
    Somewhere in Europe
    Improving the Macd 2.0 crypto trading algorithm using bearish detection
    Previously we analyzed and discussed our brand new Macd 2.0 algorithm. If you’ve been reading our posts then you’ll know I mentioned that these algorithms can be improved a lot. In this supplementary post I will discuss my progress on improving the Macd 2.0 algorithm.

    [​IMG]

    Trend trading
    As I mentioned in my previous posts, the state of the market is extremely important. For instance, don’t enter trades when the market is going down (a.k.a. bearish), unless you really know what you are doing.

    Right now none of our algorithms take this into account, that’s why the 30-day ROIs went from over 40% (two weeks ago) to less than 15% (right now):

    [​IMG]
    Signal ROIs as of today
    You may recall that the MACD indicator is determined by subtracting two moving averages. We can then use this new data and come up with a trading algorithm/heuristic — and this we’ve been doing until now.

    The challenge is now to optimize our Macd 2.0 algorithm by taking other features into account, such as the fact whether the market is bearish or not. By adding additional lines of code into our program we increase its complexity, and making it harder for hyper-parameter optimization. To keep the latter as simple as possible we have to keep the code as basic as possible, yet effective.

    Bearish detection
    I’ve spent many hours trying out various indicators and designing algorithms that would allow me to detect bearish conditions. But the harder I tried the more complex my code became, which was highly unfavorable. Eventually I came up with a method that was basic, yet effective.

    Let us evaluate my new bearish detection technique through back testing. In the results below I ran trading simulations and computed its ROIs. These tests all used 5 months worth of data, from 1 January to 24 May.

    ETH-USDT
    The next chart shows the Buy/Sell signals without bearish detection code. Its average ROI is 78%.

    [​IMG]

    The next chart shows the Buy/Sell signals with bearish detection code. Its average ROI is 97% (+19% more than the original algorithm).

    [​IMG]

    LTC-USDT
    The next chart shows the Buy/Sell signals without bearish detection code. Its average ROI is 41%.

    [​IMG]

    The next chart shows the Buy/Sell signals with bearish detection code. Its average ROI is 51% (+10% more than the original algorithm).

    [​IMG]

    BTC-USDT

    The next chart shows the Buy/Sell signals without bearish detection code. Its average ROI is 12%.

    [​IMG]

    The next chart shows the Buy/Sell signals with bearish detection code. Its average ROI is 36% (+24% more than the original algorithm).

    [​IMG]

    Results analysis

    The bearish detection code clearly did a good job. It improved the ROI of all algorithms by an average of 15%, and had the biggest improvement for BTC.

    These improvements are also clearly visible on the charts themselves (that’s why I’ve shown them) — you can notice that during periods where the price is going down: there are way less buy/sell trades thanks to bearish detection. This eliminates many of the losing trades. The end result is a higher ROI.

    Conclusion
    For this analysis I’ve used 5 months worth of data, as opposed to our traditional 30 days. This was done on purpose to emphasize the impact on the overall ROI. This long period also has way more bearish periods than a 30-day period would have. If I run the same analysis on a randomly selected 30-day range, we would probably see a much lower change in ROI, because after all it’s not that big of an impact on a short-term basis.

    This bearish detection code is the best I was able to come up with, which also had a positive impact on the overall ROI. So the optimization journey doesn’t end here, it’s just the beginning. After some more successful analysis I will adjust our existing app algorithms/signals with this bearish detection code.

    Thank you for reading! If you enjoy our content feel free to give this post a clap. And follow us to stay tuned for more.
    - Ilya
     
    • Thanks Thanks x 2
  19. Elegante

    Elegante Newbie

    Joined:
    Jul 6, 2015
    Messages:
    40
    Likes Received:
    9
    Impressing results. You should share all of this knowledge inside your own website!
     
    • Thanks Thanks x 1
  20. Michael Goode

    Michael Goode Newbie

    Joined:
    Aug 7, 2016
    Messages:
    23
    Likes Received:
    2
    Gender:
    Male
    I would like to understand more about the core mathematics behind the trend analysis