Mike Fishy and Automation System Programming (Bots)


@mwlang it was basically, using the trends/RSI, trade BTC to BNB, then immediately use those funds in BNB to trade to an alt that looks promising, then keep an eye on both the BNB and BTC trends to trade back to BNB then BTC or directly back to BTC.

I wrote experimental code that traded BTC, ETH and BNB trends and the ALTs for each. There was a lot of opportunity due to the “lag” that exists between them.

When you go to this level, you don’t use 5 second or even 2 second intervals, you connect to the Web Sockets and the data streams in at real time (with 100ms internet lag). See the Web Socket API’s in the PHP Binance Framework documentation.

One of the most interesting things I found was during a pump and dump, they tend to be done with BTC and both ETH and BNB lag behind by up to 3 seconds on the price action, which opens short timeframe doors of opportunity.

Think for a moment, a pump starts on BTCADA, but ETHADA is lagging behind. You can buy ADA using ETH and immediately sell it to BTC at around 1-2% in 300 milliseconds - multiple times during the pump period.

Do ethics go out the window while taking advantage of poor Binance code and pump’n’dumps?

Never really talked about some of my experimental code, it tends to be a bit of the risky side.

Also, I do keep 6 months of data as I do extensive data analytics. So if you are wondering how I know when things happen, it is because I’m good at analysing data :slight_smile:

Stay Fishy


You know…I’ve long been considering ditching the loop approach and going to event-driven approach. I’ve seen enough in the data I’ve collected myself telling me the profit margins are at the fringes of near instantaneous response to favorable conditions, especially deterministic ones where you know before you even execute the orders, if they all execute, you’re guaranteed a profit. This is what I had working very well for a while with arbitrage bots, but the margins just got smaller and smaller and smaller over time to the point where the only way I could see to get profitable again in that scenario was to be trading closer to real-time. I just wasn’t convinced there was enough profits still there to make the retooling from ground up to be worth the time/effort.

I think you just sold me. :slight_smile:


As you can probably guess, this is what I’m thinking most about and why I hammered out most of the code edits I did today. I want to focus on capturing the cycle times from low - high - low, but I need a little more practical guidance to what works well.

Let’s say for example, first leg, low => high is 3.5 minutes and high => low second leg is 4.8 minutes and then it’s 3.75 minutes back to low for final leg. How does that translate to factoring the duration values for the three trends?

Does it matter if each leg’s duration is imbalanced or is the total time of the cycle all that matters for our purposes?

How many cycles should be tracked low - high - low before the settings are adjusted dynamically?

Do we only track the low - high - low cycles of the pairs that were suitable to enter a trade on, or track all of them and adjust all dynamically? i.e. is the only cycle that is statistically significant to us are the ones meeting our criteria for entering trade to begin with?


Perhaps we build with adapter pattern and build filesystem, redis, and mongodb and the trading bots don’t care what’s driving the backend since they interact with it using same service contract.


On Binance, select a trading pair, click on the “Time” button top left, then add a single moving average of a MT guess and zoom right out.


Pretty clear to see the trade cycle there is around 2.5 hours.

It’s just a matter of coding it in :slight_smile:

Edit: kind of interesting the first half of that chart resembles BTC for this year, so what is coming next year resembles the second half of the chart? After a while, you get to see all the usual patterns :slight_smile:

Stay Fishy


Making progress with Mongo. I have it running on Windows 10,the same PC. Will get a reasonable laptop and run Mongo on there with Linux.

Just in the fiddling stages getting to terms with how it works. I can see what is coming. To use an API bit of code to pull in data in a similar way as we have already done using PHP.

I am not quite there on this yet but with a bit more homework I should be.

One thing to consider is data pairs. and tables. It may be a good idea to do some of the number crunching for some of the indicators on the mongo db so you have a smaller bot to look at the data.

I am learning lots of stuff about nosql and I can also see applications for this in my current job. Very interesting. Always been using relational databases and never worked with un related ones. All pretty interesting.

Cheers Guys, will keep you updated of what I am up to.



Good observation on that chart!

I fully understand what we’re shooting for in terms of measuring distances between peaks and valleys and I can capture that trend to variables in code. Where I’m unclear is how to apply it, hence the various questions on whether it’s the whole cycle that’s most important or if each leg of the cycle is significant (i.e. downtrend takes 1.3 hours, uptrend takes 1.2). And next, given a 2.5 hour trend cycle overall, what does that translate to in terms of ST, MT, and LT periods? Are we supposed to cover the whole trend with the LT period? i.e. 2.5 hours => 9000 seconds / 5.seconds => 1800 entries in the LT trend with our current 5.second loop. Which, to me, doesn’t make sense in the context of the numbers we’ve been using (all under 300 LT entries).



What I would look at would be how does the LT MT and ST change as well as the RSI surrounding those peaks and troughs? Can you see definite variables that pick up those peaks for that time frame? Once you roughtly know what these numbers are you can then see if it accurately works in practice.

How does this sound?



can you explain further? When I look at it, I look at it somewhat like this:

where the red box is the long trend period.


Nope. I see it as all your red boxes together form 1 LT period man. It depends on the time frame we look at. If all we get are hints we cannot move further in my opinion.



I think given the timescale of the information what are the corresponding values of LT MT and ST, RSI that then gives the correct output to indicate a sell and a buy. You might want to start to look at shorter time frames.

Using Historical data to pick up the value of the Indicators that leads to a positive result for either a buy or a sell.

Mike I am currently working on making a Linux based datacenter. Its going to be a beast of a thing. 32 GB DDR4 Ram, 500 GB SSD hard drive etc. I have the weekend to figure out how to get MongoDB working and pulling the data in. I guess we can go fetch historical information as well as current information using API so we can populate the last six months.

I would then look at doing some number crunching in excel on LT MT and ST + RSI to see the exact correct signals on this timeframe to buy and sell. May be there is an internal reference to the timeframe of repeating patterns and this could be used to indicate the timeperiod that you are likely to see a reversal.

I am looking at how to get the data, then look at trying to read it into excel and start to do some maths on it… if any one has any better ideas on this … all good.



If we apply a bit of maths to the problem and consider the gradient and rate of change the white and yellow lines are nearly intersecting when the trade conditions are correct. What does an adjustment of this do? Can we get it to match better?

I think we need to stat to analyse data and see what is pointing the correct way to be able to make a smart decision.



All smartphone discussion will be in the following thread Smartphone Trading Bot


@Mike_Fishy your lessons started of great. However for me it is turning into Chinese now. If you want to make it underatandavle we really need some code examples just like in the start man! :slight_smile:



I do not find your post very useful. You should be spending your time to learn code and understand how it works so you can implement stuff. You have the guts of the plan here. Nothing ever comes at you on a plate. I strongly believe you need to have a very clear understanding how something works otherwise you are unable to fix it when it goes wrong.

This bot will go wrong and it will be up to you to fix it. Actually it is up to you to make it too. Mike has given us the heads up on how this goes. I certainly have enough here to be able to start to put together something on my own. I would use your time to start to understand all this code, do some research into how it will get put together.

For example I am spending my time looking at Mongo DB. I am also putting together a datacenter so I can start to analyse data and pick up trends and answer the questions he has asked us in a post above.

You need to put effort in bud.



Also there is lots I dont understand. Might be a good idea to start to write a list on what you need to do to get it to work.

My list is something like this at the moment:

  1. Work on knowing how to implement Mongo DB.
  2. Work on making a new Datacenter desktop with linux and install Mongo DB on it.
  3. Figure out how to network it to my Windows 10 PC.
  4. Figure out a API connection using Mongo or something else to put the dtata in the datacentre
  5. Analyse data on my PC somehow in Excel.
  6. Make a bot to analyse data and adjust some variables. exactly what I dont know.
  7. Figure out how to implement buy sell APi, we need to add in volume to the API.
  8. Look at testing it and see what improvements you can make.

There are tonnes of stuff in there that I have no idea . However, I do have the desire to fund out and figure it out. I am a chemical engineer and I like getting things to work. This is a bit like this.

I see this as a challenge of learning new skills and I really love data orientated tasks. Really happy that I have started down the road to get this to work.

Try and break it down into steps and get one bit to work at a time. The way at times will not be clear but with enough vision and “pointers” from some really intelligent guys here on this forum I am sure I can get there.

Its not just about giving the code. This is more than that. Its giving you new skills and abilities if you are interested in aquiring them.

Hopefully, I am not being too harsh, trying to present this as a one hell of an opportunity for you to learn new skills and do something really cool and “massive” and awesome.



Thanks man. You are completely right and sorry about my complaints above here.! :slight_smile: :slight_smile: )


I have provided links to some of what is required in the smartphone thread.

As you know I am using C++ but PHP is similar and I believe there are pre-built PHP routines readily available.


Yep. Thats what I was kinda thinking. The items before this one it what is taking up my time. I like to understand stuff.
Cheers @Blynker


Mike so far has been helpful with teaching us how to fish, but we have to learn how to build the boat and learn to row by ourselves. :wink:

Check out codeacademy. I’ve been trying not to rush into this and spending hours just understanding the basics. So far I’ve been doing the “learn the command line” course and it got me to understand to some extent what was going on at the first tutorial that Mike posted.