Mike Fishy and Automation System Programming (Bots)


#81

Have you thought about getting other people in the pub to get into this and taking a cut? Cause I would totally do that.


#82

Actually, one of the reasons for putting it all in Azure, is so I can turn it into a service.
It has a lot of challenges, being technical, financial and the big one -> security.

There is still a LOT to do before I would let anyone else use it, for their own safety :slight_smile:

However, I will make a post shortly that will be fun and give you something to do and learn a little on the way of how to accumulate CDA’s manually. The biggest secret is not to worry about fiat price, just concentrate on collecting all them lovely CDA’s you want to have.

To be honest, if you have spare time while watching your favourite TV shows or sniffing Roo balls while placing underwear on your head at watching Peter’s Youtubes :stuck_out_tongue: - you can make some extra CDA’s quite easily once you know the process.

So the next post is - how to play along at home like a bot

Will be complete with screen shots and strategy in an easy step-by-step process that even someone new to trading can follow.

Stay Fishy


#83

Nice one - Looking forward to additional insight.

Not into sniffing roo balls - @peter had some media visiting his place that were into that though haha


#84

very nice :fish: I wish I had your skills


#85


#86

How to play along at home like a bot

I know many people read my thread and want to participate with CDA trading.
So this quick post is a method you can use to play along at home like a bot.

Standard disclaimer. You can loose money trading, therefore you do so at your own risk.

The good thing about this method, is that it is easy and quite fun if you have a few hours.

Don’t just start trading CDA’s right away, make a notepad of what you would have done and
see how you would have faired. It’s about learning a new way of thinking which can take a
bit of time and practise. So practise, practise, practise and record how you would have
done and what mistakes you made in the process and learn from them. This way, when you
start trading with real CDA’s, it will be a little easier as there will be secondary things
you need to concentrate on, such as making sure orders complete and watching out for the
shenanigans and possible rapid dumps, which will need quick reaction times.

So, play along on a notepad or spreadsheet and see if you can do 3 or 4 at a time. Most
day traders will often do 6 or 8 at a time, whereas a bot can do hundreds at a time.
This is really the only advantage a bot has over a human, in fact the bot is not very
smart and a human trader will generally do better when done right, it is just a bot
can do much more at the same time and work faster.

I am going to assume you have used Binance and have an account on Binance and understand
the basics of the interface and concepts around trading. If you have never used a trading
platform before, there are many posts and youtubes that explain the interface and using
the order book. Just remember, every time you buy, you are buying from someone else that
is selling and vice versa. So knowing why people are buying and selling and when they do
this, either on a schedule or because they are trading at different time periods can be
used to your advantage. Watch how the market trends and after a while you start to see
the patterns.

I am going to use Binance for the trading example and assume we want to make some BNB.
However, you may choose what to trade provided it fits with the basics.

The basics are this:

We want to look for a CDA that has a high volume of trades, low volumes have more risk.
So in Binance, use the dropdown and click on 24h Volume to sort from highest volume to lowest.
It does not matter if the CDA is showing a positive or negative daily trend.

We now select one and look at the 15minute candles to see if it has some up and down action.
By this, I mean you are seeing ups and downs on the trade prices showing good movement.

Select a CDA and click on the window with the candles, so you can scroll the mouse button to
zoom in and out. Quite handy so you can see if there is good action going on over time and
also see how it is trending. Anything trading with low volumes or flat is more difficult,
pick another one until you find one that shows up and down movements like a wave.

In this example, I chose ADA as it had good volume and good action going on.
Plus, it’s ADA and who doesn’t love Cardano?

3L-1

In this strategy, we are only going to use the 5 minute candles and two indicators.

  1. The RSI, which gives us an idea of if it’s a good time to buy.
  2. the EMA, which tells us roughly when to buy and when to sell.

The RSI is the Relative Strength Index. It is a calculation done on the number of trades
that had a gain, the number of trades that had a loss and calculates it as a percentage
over the time period. The default time period is 14, which if we use the 5 minute candles,
then the time period is 14 times 5 minutes or 70 minutes of historical data.

The EMA is the Exponential Moving Average. It is a calculation done on the closing value
of a candle for each time period and then averaged over the time period. So if we are using
the 5 minute candles and the EMA is set to 7, then this is 7 times 5 minutes or 35 mins.

Playing with these values can help you see trends based on historical data and everyone
will have their own favorites for different candle time periods.

Both of these are known as lagging indicators, which means they are telling you about
the price history and trend of the history. So we are using historical data to try
and identify the most probable value of the future values. As you can already see, this
is not a fool proof system, you cannot predict the future, but we can take steps to
minimise the risk of our future prediction.

So we are keeping it really simple, which also means it is not perfect.


#87

How to play along at home like a bot

So under Indicators, select EMA and then RSI so they both show.

The screen should show the candles with 3 EMA lines over them, then under that is the volume
bars, which show the volumes being traded and then under that is the blue RSI line.

In the top left, you can click on the spanner icon to change the colors and values of
the EMA. For our exercise, we are going to use Green, Yellow and Red like traffic ligths
and also set the values to 4, 7 and 9 respectively.

The strategy is quite simple.

For the buy, we are looking for the RSI to be on or below the middle 50 line, plus for the
EMA, we want the Green line to be above the Yellow line, which is to be above the Red line.
So Green higher than Yellow and Yellow higher than Red is the trending up, while the RSI
indicates that the CDA is in an over-sold state. Little secret here, there is no over-sold
state when it comes to markets, it could go up or down regardless. The other thing we look
for is the green volume bars showing some strong buy trades, this is indicative that people
want to buy this CDA and it may have a bit of a run. People will have varying ways in what
values they look for in these indicators for an entry, which is why practise is good.

So if there is some recent volume and the RSI looks ok, plus Green is above Yellow which is
above Red, we make a limit order. In this example, I bought it at 0.00905

Now a lot of people might say I placed that order a bit too early, but the way it works is
that you need the order to complete, so placing it a bit early means it is more likely to get
filled, but increases the risk you are taking on the trade. This is your classic example
as well as the price did dip slightly below my buy price, but ensured my order filled.

So the math here, you need to be fairly quick at and we work in percentages.
Assuming we are willing to accept a 1% loss, we plug in 0.00905 * 0.99
That brings the price out at 0.00896 as the lowest price we can accept as a loss trade.

So as soon as the limit buy order completes, we immediately setup a Stop Limit order.

3l-5

The values I used are:

  1. Set Stop at 0.00898
  2. Set Limit at 0.00896
  3. Set value at all of em (or the amount you want to sell for this trade)

The way this works is:
If the price drops down or below 0.00898, it will trigger your limit Sell order.
The limit Sell order will be placed in the order book at the limit value with your quantity.
Then its a matter of praying that someone buys it, which generally happens, but may require
you to manually adjust it if the market suddenly dumps.
This is the risk part and is not predictable, so you do need to keep an eye on it.

Now, as fortune may have it, sometimes your Sell order won’t complete as the price might start
going up again before it hit the 0.00896 value of your order. In which case, cancel your sell
order and re-create it again just as before.

So, assuming our stop loss didn’t kick in and our trade is a good one, then the price
will continue to trend up with the Green above Yellow and Yellow above Red as it should.

As the price moves up, so does our Stop Limit order and this is where you need to make
a reasonable guess at your next level using the volumes in the order book. The price shown
in the center of the order book is actually the last traded book price, so it was the last
trade done. So someone bought from the asks or someone sold to the bids in the order book.

The order book in Binance has the asks in magenta and the bids in green.
Bids are people placing bids to buy the CDA.
Asks are people placing Sell Orders to sell their CDA.

If someone buys from the Ask price, then the trade value to the right shows a green Buy.
If someone Sells to the Bid price, then the value to the right shows a magenta Sell.
So the colors to the right tell you if people are buy or selling and the colors of
the traded value is the opposite of what you see in the order book. This can take a
little getting use to, but makes sense when you realise it is weighted towards the person
doing the action, not the actual order book placements.

So, as the price moves to 0.00915, you cancel your stop limit order and place a new one.

Looking at the order book, you can see a very small volume in the bids at 0.00911
Then udner that is one with a reasonable volume at 0.00910 and again at 0.00909
Then at 0.00908, there is more than twice the amount of volume in the bid order.

We don’t want our Stop Limit order to trigger unless it has to, so we use this information
to set our next stop limit.

So cancel our stop order we set before and create a new one using values as:

  1. Set Stop at 0.00909
  2. Set Limit at 0.00908
  3. Set value at all of em (or the amount you want to sell for this trade)

So now all we do is keep watching the three lines and the order book and adjust our stop
limit order up as the market values change.

At the point where the bots or other people start profit taking, the price will trend down
and our stop limit order will trigger and hopefully will be sold. You have to keep an eye on
your orders and make sure they complete and adjust as needed. Then after it sells and our
little trade is done, we either made a profit or a loss.

In my example my stop limit order sold at 0.00928

So in this trade, my buy was 0.00905, sell was 0.00928
The math here is
100*(1-(buy/sell))

So about 2.448%

However, when we did the buy, Binance charged us 0.1% and same on the sell.
So we subtract the 0.2% in fees and we are left with about 2.248%

That is what a bot generally does, but we are up 2.248% more BNB which can now use
for our next trade and with 2.248% more volume. So as you can see, this can compound
fairly quickly, but after a while you start doing larger trades and hit the problems of
there not being enough volume on the CDA to complete your orders. That is why a bot does
better as it is splitting the volume over multiple CDA’s at the same time, so it takes
advantage of spreading both risk and the volume to get orders completed. This is why you
need to practise a lot and get use to running a few at the same time.

Hope you found this fun and get to play along at home.

Stay Fishy


#88

Wow. That was a great write up. Gg


#89

Great stuff @Mike_Fishy - Great write up!

So what happens when you get ‘fake outs’ like the below or another way to ask, what proportion of the time do you get faked out like below? Just curious in understanding. That first candle was quite a wide ranging bar and on relatively decent volume but it didnt follow through until a few hours later - See the red box below.

In addition, do you have some type of time filter? Ie if market doesnt provide a sell signal after X bars, then exit?

I think your analysis is really good and well written. Awesome stuff!

Have you ever considered using a thing called ‘RVOL’ aka Relative Volume. Simply RVOL is taking the volume for that time of day on that candle and comparing it back against say the last 30 days. If that candle for the most recent day you are trading has a very high volume relative to prior candles at that time and averaged over 30 days back, that may provide more robust signal. I use it a lot in trading. If something is > 3-10x relative RVOL for that time of day for that candle, then i am more inclined to take the trade as its a likely outlier event and likely to follow through. You may want to look at adding that to your automations to drown out noise and get better signal - Will likely increase profit factor too considering less brokerage and better p/l.


#90

Yup, it doesn’t always work, hence the stop limit orders.

With the fakeout you highlighted, you might have been ok as you should have still got the buy in at 0.00905 and it didn’t drop below your stop loss, so you are on the waiting game while sniffing Roo balls and putting underwear on your head and watching Peters Youtubes :stuck_out_tongue:

However, you want to see at least 3 green bars on the volume and a small consolidation followed by a bigger green volume bar as a signal it could be on a bit of a run. However it was trading pretty flat and also near it’s 24 hour low point, which is still generally a good time to get in. The more green bars and height on the volume amounts, the more likely you will see a bit of a run. Watching the order books for those orders which appear and disappear is also a good indicator the other bots are testing the waters to get in on the bids, but if you see it on the asks, its more of an indication it could go down. If you see it on both bids and asks, it’s like to continue trading flat.

It’s an art, so playing along on paper first and looking at all the stuff that happens before a run, gives you some experience on what to expect.

However, even if you stop loss out, it’s not a problem as the price will go down a reasonable amount, which allows you to buy in with more on it’s next run.

There are other strategies you can take as well depending on how much risk you are willing to take, but I’d leave that for later once someone new gets the hang of a standard process. After which, if they are willing to post their mistakes, I can probably show them how to improve and improvise, which allows them to capitalise even on mistakes that are made.

You could also check the MACD which helps.

Us oldies know a few tricks :stuck_out_tongue:

Stay Fishy


#91

Love reading your posts. So clearly explained. Just a quick thought, binance is doing scheduled maintenance right now, does this knock the bot off? Do you make provision for these times?


#92

Well, I just checked and the bot never missed a beat, so I guess the API’s have different maintenance schedules. I do notice occasional timeouts around midnight UTC on Sundays, but generally they are pretty good. Kucoin and Cryptopia seems to have longer schedules.

When the bot cannot access the data, it’s pretty dumb at the moment and just sits there re-trying.

Once it can access the data, it carries on as if nothing happened making the decisions as per normal.

So far it hasn’t cause any real issues, but I generally stop the bots from running on Sundays as that is when I run the analytics and the weekend volumes are generally too low to trade. Low volumes have a much higher risk of orders not completing.

Stay Fishy


#93

Thanks @Mike_Fishy. So interesting.


#94

How to play along at home like a bot

So, now we have an idea of how to chase BNB with green candles, lets take it to the next level.

Lets chase ICX using BTC.

So in this example, we are not looking for bullish action, we are looking for bearish action.
So we actually want to look for ICX declining against BTC, not going up.

So here, we wait until ICX is near a high point against BTC, then we sell to BTC after we see some indication of a consolidation or bearish action.

We watch the volume candles for increasing sell off and sell our ICX to BTC.

Then when the price drops down lower, we buy back our ICX, but buy more of them.

In this example, the Volume was showing increasing sell action and the three lines crossing over showing a downward trend. So we sell our ICX to BTC and follow the trend down.

When it starts to show more bullish action with green volume candles and the three EMA lines crossing over, we buy back the ICX, but we buy more of it, cause you can never have too much ICX!

So in this example, I sold ICX at 0.0002622
Then bought back more ICX at 0.002575
The result is (after transactions fees) 1.5% more ICX in my hands.

Now, if you look at the fiat value, you probably noticed that ICX didn’t loose any value, it was just BTC gaining some fiat value, which in turn makes ICX drop against the BTC value. So I actually gained some more ICX even though it’s fiat price didn’t even change. This is quite useful when BNB is doing a run and every other ALT Coin is falling against it, use this to your advantage and gain more of your favorite ALT Coins!

This is harder to do as you have to think in reverse of what we did when chasing BNB.

Stay Fishy


#95

So, hopefully now the penny has dropped.

When trading between CDA’s - all you are doing is shorting the other CDA you trade against.

So in the BTC and ICX example.

When ICX is climbing against BTC, you are shorting BTC against ICX and on the switchover you are buying more BTC from the ICX.

Then as ICX is falling against BTC, you are shorting ICX against BTC and when it switches over, you are buying more ICX from the BTC.

So in both directions you are gaining more of both BTC and ICX.

So who doesn’t want more BTC and ICX?

This is where the bots shine, they simply do the switching for you automatically, but nothing stopping you from doing it manually as well, it is just less efficient.

So now you know why traders don’t care if it is up or down, we make more in both directions and I have over 50K of ICX from doing exactly this. Strong hands are made from switching.

Edit: now you know why traders hate the market when it’s just flat… when there is no action either up or down, we are not making more.

Stay Fishy


#96

Brilliant. But just one niggling question if I may. Using your example, buy icx, ride it up then sell to btc, on the decline, my thinking is for me manually would it be better to sell to usdt? Reason being as you sell back to btc the BTC value declines also. Not really autobot related but will help me understand better. Thank you.


#97

So where does the weibull logic fit into this? :slight_smile:

Just trying to understand where your algorithmic activity really engages especially around nearest neighbor distributions.


#98

Just a quick thank you my friend… this is absolutely, why the pub is such a great place…
Awesome of you to take time out and do such a great write up…
Cheers!! :beer:


#99

I’m not worthy. Damn, nice job Fishy!


#100

For the questions.

  1. I don’t like USDT or TUSD, I don’t feel like they are CDA’s I want more of. I would rather get more ADA, ICX, VEN, ONT, NEO, QTUM and so on. It is just a personal preference, I would rather more CDA’s of a good project I like, than the stable coins (plus I still don’t trust Tether). However, you are right, the process is no different and you are just using USDT to short BTC and vice versa on switching over with the trends.

  2. Weibull is used to predict the volume of the next trade cycle. The real life use of Weibull is with Weather prediction. When we know it is likely to rain, the Weibull algorithm is used to predict the volume of rain based on past history of when it rained. So when you see the weather and it says chance of rain is 80% with 12mm of rain, the 12mm of rain (the volume of rain) is predicted using Weibull. So in the case of the bot, it tracks all trades and the volume of all the trades. The Weibull algorithm predicts the volume of the next trade cycle. So if we are expecting some trend up action, it predicts the estimated volume of trades for the trend up. I use this to help get more orders completed by “guessing” the volume that is likely to be traded next (volume of trades vary a lot, so don’t expect that your $100k of ICX order is going to get filled very quickly, if at all). Getting orders completed is a challenge and they do need management, which is why there is so much code in the bot, it’s mostly managing orders and making decisions based on the orders getting filled or partially filled or not even touched and need to be cancelled to wait for the next cycle (or use the funds on a different CDA).

At lot of things we do as humans without even thinking about it as it just seems natural, is where AI and Bots do not shine, they can’t just think like this and need all those rules built in. The amount of code needed to do simple things we just take for granted is actually quite staggering.

Stay Fishy