Mike Fishy and Automation System Programming (Bots)


Thanks @Mike_Fishy

Awesome stuff - So, based on your last comment, is ML eventually going to take all our jobs? Makes me wonder.


LOL, not in my lifetime, but then I’m already old :stuck_out_tongue:

Stay Fishy


Man this is so amazing, really man! I did a MSc in Finance and entered crypto in January 2018. Unfortunately only in ICX at a very high price aeound $7. I really was looking for some info like this man! Also investegating programming, however, the time it takes to learn the skills is a lot so maybe not worth it. Would it be possible to share your bot as a service in the near future man? That would be really really great man! :slight_smile:



I really liked your insights into how to analyze the order books to set the stop/loss orders. I’ve been looking at ways to improve my strategy here was often stopping out of a trade earlier than it needed. I was starting to think of of singling out buy and sell walls as means of setting both the stop and limit prices such as they’re neither too aggressive nor too “lossy” and the idea of simply finding where the sharp uptick in order amounts is a really good approach.

One thing I wonder about is Binance’s iceberg orders where you cannot really know exactly how much quantity is offered at each price point. Are your bots coded to account for that possibility or do you strictly go off exactly what’s on the open books?

Also, here’s another write up on applying trending and mean reversion trade strategies that was beneficial to me:

Its a good basic overview of the two approaches to frequent trading and how to combine the two and I think it compliments your step-by-step write up.


I am of like-mind. To put it another way, when I started my own bots, I experimented for a couple of weeks with BTC/USDT with idea that I buy USDT on BTC downtrends and buy BTC when it started to trend up. It is, after all, an easy thing to visualize. Either BTC is going up or USDT is locked in. So, in terms of fiat, the mindset is to preserve the USD or fiat value of your portfolio at worst, but ideally, constantly growing it’s value.

The problem is, it’s just one trading pair and severely limits your ability to trade across many different token pairs (i.e. CDA’s). You must make correct trade calls far more consistently with one pair like this and USDT never really gets away from $1.00 mark by much. In other words, less opportunity for a “breakout” while sitting in USDT.

So when one starts generalizing the trading strategy, one realizes end-goal is to steadily increase token quantity counts with each trade on BOTH sides of the traded pair. If you have X BTC and you buy as much ALT as X BTC will buy, your aim is to sell that ALT to gain X + n% BTC. Next time you buy the ALT again, you’re buying X + n% + k% of the ALT (where k% is however much that ALT decreased in value against the BTC you’re holding).

The advantage here, is if you happen to be in an ALT when it surges 15% or 30% or whatever, you gain tremendously, whereas USDT isn’t going to surge beyond $1.02 ~ $1.04 unless it’s a fluke, so you never have that tremendous gain opportunity. Meanwhile, your bot is managing your max loss potential, returning you to BTC if you exceed whatever threshold you’re setting on it.


i found a thread to read and learn this weekend… yoooooo
. I might print the whole 105 comments. i like paper reading … haha


Yes, you can’t really see the Iceberg orders, the bot just goes off what data it can get, the rest is just strict decision making.

Also, the ALT’s really do trade better than USDT, I mean STEEM decided to do a 30% run and I was lucky the bot actually did it, since it was suppose to be off. The bot has enough funds to pretty much trade all the alts at once and normally I shut it down on Sundays to do analysis, but this weekend I was out at a Sake tasting shindig and kinda didn’t remember :stuck_out_tongue:

I do love my imported Japanese Sake, that’s my weakness :slight_smile:

I’m waiting on the analysis to finish at the moment, then kick off the backups and going to sleep.

Stay Fishy


@Mike_Fishy, Thanks for sharing the detailed play-by-play. Your simple 4-7-9 EMA + < 50% RSI + Increasing volume selection criteria was a big improvement over my own attempts. I don’t think I’d ever would’ve aggressively pursued such a tight EMA as I was experimenting with values ranging from 20 to 100.

You just got honorable mention in my trading bots.

Not only that, it’s already outperforming all the others so it’s the only one running. And this is before I even add the increasing buy volume filtering.


A question about taking advantages of P&D’s…I know you mentioned way early on that when you take up a position, you open a limit order at some X factor of the price higher than your entry to catch a P&D.

I just saw one come across on mine:


But since I’m maintaining live stop/loss orders, I see no way to have both a take profit limit and stop/loss limit at the same time. How do you manage this scenario to capture those P&D’s or did you back off that strategy in favor of better managing stop losses?


Nice, love the Fishy @mwlang

I’m also glad you are learning that bots can be quite aggressive and when done so, they perform admirably.

Edit: re the stop loss vs the pump and dump catch.

When you are trading manually, you setup the stop loss orders, because as a human you cannot react fast enough when things start dropping, it is to limit your risk while while doing things manually.

However, the bot can react with sub millisecond speed, so you setup the double value pump and dump catcher and only cancel it when you need to setup the sell limit order. Because the bot can track prices and trends, you don’t need to setup a stop loss order, as the bot tracks when it is getting close to your calculated threshold and can respond quickly, cancel the PnD order and setup a normal sell limit order and track it appropriately.

Remember, two thirds of the bot code is in Buy and Sell Order Management, only one third is in the TA and decision processing.

Stay Fishy


Makes sense. I can see you’re programming more offensively than I am. I chose the defensive route of keeping stop/losses in place at all times in case of the bots crashing or the exchanges becoming unreachable.

So, even though the bots can react quickly, they can only do it when they have connectivity and up until last 3 or 4 months things really weren’t all that reliable with Bittrex and even Binance suffered it’s fair share of outages. Cloudflare has had some issues too, causing spurious 502 Bad Gateway errors.

Amen on 2/3rds of the bot code being the buy/sell order management. This is also the area I have the most rigorous testing spec’d. So many ways placing and canceling live orders can go wrong!

The hardest part is building an abstract layer that the bots talk to, yet adapt and work equally well across different exchange API implementations (i.e. the Gang of Four’s Adaptor pattern). I really hated simulating market orders with Bittrex which doesn’t expose such an order type via APIs, but once I got a reasonable strategy around that, it’s been fairly smooth sailing building bots that think they’re placing market orders when they’re really not.


Next for the thread is ways in which you can recover from mistakes.

Lets take an example using this graph

So lets assume that for some reason you bought some RDN at 0.000245
Then you didn’t pay attention and forgot to setup your stop loss and it dumps like above.

So now the price is 0.000223 which means your loss is now at 9% which is pretty hefty.

The idea is we want to limit our loss or even turn it into a profit where possible.

So we buy more at 0.000223 at the same quantity we bought at 0.000245.
Thus, now the average price we paid for the CDA is (0.000223+0.000245)/2
Which means the average price we paid for all the CDA’s is 0.000234
So we can setup a sell order for 0.000237 and wait for it to recover, which gives us a profit of 1.26%

When a CDA dumps like this, it will often recover, but not all the way to where we purchased the amount at the much higher price.

So while it may not be likely the CDA will recover back to our original 0.000245, it will likely recover to 0.000237, which still allows us to make a small profit and exit the trade on the same day.

The bots do this and is basically called “Averaging Down” - though is still kind of risky and needs funds.

Stay Fishy


Hmm im never a fan of throwing good money after bad. Why not just cut the loss and hit another new trade that comes a long with more size?

If the data says the probability of it mean reverting a portion shows that as an edge, then i think thats ok to do but only if data supports that idea.

For example, if the CDA tanks on a low volume move, then its likely to mean revert but on huge volume id avoid… anyway just my 2c - From my experience, doubling down when wrong tends to end up being a bad idea, over time.


Yes, it is risky, but can be used to recover from mistakes. It’s a tactic often used in Forex markets, probably a lot more risk in CDA’s, but there’s no fun without risk :slight_smile:

Talking of which, I took a punt when I saw a familiar sign and it paid off.

It appears our pump and dump friends are back, I did a 3x Trade on SYS, turned 20k into 60k :smiley:

There’s other CDA’s getting pump and dumps as well around the same time, it’s actually refreshing to see some of the shenanigans return, things could go more to the upside if interest is back.

Given what time these happen, it would be unlikely these are US players, I’m thinking possibly China or Japan.

Also, yes, there is tell tale signs of when a pump and dump is about to start, look at the chart, see if you can pick it :slight_smile:

Stay Fishy


Yea, averaging down is a pretty common strategy but ive never seen it work over time. Most times you get away with it but that one time it doesnt bounce and turns into a huge loss that wipes out any wins from the other 50 times it workss. If it works for you though, awesome! Personally if a trade is working for me, i like to average up to get those outside positive gains. Imagine you added size into your last trade on that PND. Would pay for many losers going forward!

Nice work mate - Wasnt this pnd off the back of a binance exploit around the API or something?

Did you trade that with discretion or your algo caught it? Im assuming the vol + rsi was a nice little tell something was going on :slight_smile:


I have used the averaging down on many occasions, it actually can limit the loss amount if you have to exit, but if you are willing to hold on and keep averaging down, you can still turn it into a profit. The good thing about averaging down is the average price you paid, even when you stop loss out, it can change a 9% loss into a 4% loss, but on a larger volume. In the case above it did bounce up to 0.000235 before it started trending down again, so could have exited with a break even result, which is a good outcome on recovering from a mistake. We all make mistakes, even bots do (because of intermittent network connectivity or bugs in the code). No one writes perfect code, it needs to be iterated on constantly.

I have no idea of the shenanigans with the API or anything, I just saw the very familiar trend that always seems to happen right before a pump and dump and took the chance.

The trend is, for exactly 45 mins before the pump and dump, there is market buy orders for exactly the same volume, no matter what price the CDA is currently at. Bots and normal traders don’t do this, so it tends to stand out. When you see it, 90% of the time there will be a pump and dump within 40 mins of the activity.

No idea why, I just trade what I see :smiley:

Anyways, finished my analysis for the next week trend, my programs say with 61.2% probability, the bear market will continue. This is a slight improvement on last week and we do need to see a period of time where there is flat sideways trading before I would expect any upside.

However, the return of the shenanigans, which hasn’t been around much for over a month, might spark some renewed interest.

Stay Fishy


Interesting - So what made you aware of these buy orders? I assume you are capturing executions across many pairs and filtering persistent sized orders to flag that CDA for discretionary review? So that was a discretionary trade? Nice work mate.

What data sets are you using to define trend probability? If we re-test the lows and hold, i’d be interested to get long with stops around 1 ATR from entry.


Hi Entropy,

Yes, my Hound program pages me on things I consider interesting.
It doesn’t trade it, it just notifies me under certain circumstances, mostly shenanigan stuff as I find it interesting.

Stay Fishy


You carry a pager? So 80s


Seems we are in a period of sideways trading :slight_smile:

Edit: another interesting change is that some ALT CDAs are trading outside of the common theme of BTC trends. Normally all the ALTs follow the BTC up/down trend, but lately, it seems a few of them are outside the trend and setting their own path. This is a good sign that some ALTs are maturing.

Stay Fishy