Understanding Algorithms
7 responses | 0 likes
Started by joj - May 7, 2022, 6:36 a.m.

I don't understand algorithms and I've never heard anyone explain them in a clear manner.  Just commentary like:  "Oh when Powell took 75 basis point increase off the table the market algorithms kicked in and we rallied all afternoon."  That may be an accurate statement but it doesn't lead me to understand algorithms.  

It occurs to me that if I were to understand them I might have been inclined to go short S&Ps  on the close of Wednesday's trade.

If we are talking about Artificial Intelligence then I don't expect I'll ever understand.  Surely MM is familiar with the AI machines that crush the human world champion.  Even when they review the game chess masters don't understand the reasoning for the moves of the AI machine. 

By TimNew - May 7, 2022, 7:15 a.m.
Like Reply

I'm far from being an expert,  but I have worked with some Business Intelegence (BI) software for assorted industries over the years, and I am guessing there is some overlap. 

In the early days, software would "crawl" though the web looking for key words/phrases and then email articles meeting the criteria to a distribution list.  Usually executives that may find the info useful.

I've never been involved in a system that made decisions on it's own based on news.  They've always left that up to a human.   But I have worked on systems that completely manage inventory with no human interaction, based entirely on scheduled demand and inventory levels/alocations, and as I understand it, there are BI systems that also track trends to forecast demand for finished products, and feed that data to Inventory Management systems.  Essentially, the IM issues a purchase order to an approved vendor.  The vendor ships product and sends an invoice via EDI and the payables system issues a  payment via EDI, all with no human intervention.

I am guessing the same principles, or at least something very similar, apply in the trading algorithms. They scan the internet for information based on a set of keywords.  And those keywords are linked to a list of investment/financial instruments.   I also guess that  this list gets more sophisticated every day.  If it's true AI,  it will add to the list on it's own.  It's also going to use some form of pattern recognition, and again,  this would have started with human input,  but the AI will be teaching itself to learn new patterns all the time.   IE, When A B and C happens, there is an X% Chance that D will follow.

So,   the short answer is...    I am betting the guys who designed this stuff would need weeks, maybe months to explain exactly why the apgorithms made it's last decision.  The data base that it's using is growing by the minute. So,  what they do..   When the system makes a wrong turn,  they adjust how it teaches itself and/or how it reacts to what it's learned.

By metmike - May 7, 2022, 10:37 a.m.
Like Reply

Thanks for the question and topic joj and to Tim for his valuable input. 

As somebody that was studying actuarial science(because I love math and numbers) my first 2 years at the University of Detroit, this is the sort of question that almost causes me to pee my pants with excitement.

That was another example of hyperbole for you, Wayne (-:


My response is going to be a NON expert response from the standpoint of never using them personally but I've watched how they work enough and studied technical trading, statistics and human reactions  to THINK I have a pretty good understanding and we can learn more together here. 

I would bet my house(hyperbole) that Larry, who actually does have a degree in statistics and has shown incredible knowledge and sharing stats here and has mentioned the algo's lots of times can add wonderful insights.

Tim makes some great points but I believe that he is describing Artificial Intelligence. There may be some trading systems capable of incorporating this concept into their memory banks and constantly updating their programs as a result. 

Let's start with a basic explanation from Wikipedia. I'll try to apply it to my personal observations in markets and especially to natural gas.

By metmike - May 7, 2022, 11:07 a.m.
Like Reply


Algorithmic trading is a method of executing orders using automated pre-programmed trading instructions accounting for variables such as time, price, and volume.[1] This type of trading attempts to leverage the speed and computational resources of computers relative to human traders. In the twenty-first century, algorithmic trading has been gaining traction with both retail and institutional traders.[2][3] It is widely used by investment banks, pension funds, mutual funds, and hedge funds that may need to spread out the execution of a larger order or perform trades too fast for human traders to react to. A study in 2019 showed that around 92% of trading in the Forex market was performed by trading algorithms rather than humans.[4]

The term algorithmic trading is often used synonymously with automated trading system. These encompass a variety of trading strategies, some of which are based on formulas and results from mathematical finance, and often rely on specialized software.[5][6]

metmike: I can see from the explanation, that this is going to encroach into some realms that I don't know about.....at the moment, so we can try have fun learning together. 

My personal experience from observations in the futures trading, especially natural gas has me thinking that algo's are computer trading based on many thousands of programs and data that use pattern recognition based on analyzing current, LIVE data and comparing it to historical data of support/resistance, moving averages, momentum, various trends, oscillators/indices, volume(and volume reaction trends) and so on.

Here's a list of some of the indicators that might be incorporated/programmed into an algorithm:

7 Technical Indicators to Build a Trading Toolkit


But in many cases, it's more than that or even much less than that based on human psychology and the way humans reaction to prices, when they see it and.........very importantly, how other algo's react to the same things.

In other words, there's is a self fulfilling prophesy going on in the markets, not just because humans are conditioned to think if A, B and C happen, then D is coming next and their next reaction, after C is to CAUSE D to happen from expectations but this can be programmed into a computer.

The biggest advantage, especially in the short term is that computers can do sophisticated calculations a million times faster than a human by the time a human would figure it out, the opportunity is gone(on short term trades).

But there are countless different algos in different situations.

They can really feed on themselves as mentioned above. 

Let's say that we have several key indicators that huge trading funds use to trade. A 100 day moving average/momentum or support/resistance for instance, when these break thru a certain level, enough fresh buying and selling of thousands of contracts will be triggered simultaneously from the algos to trigger a self fulfilling prophesy...which can keep feeding on itself to trigger even more fresh buying/selling.

This mentality can be triggered with seasonal trading to. Programs can dial in seasonal tendencies that occurred in the past for strong fundamental reasons enough times that the market EXPECTS IT TO HAPPEN in the current time frame and traders CAUSE IT TO HAPPEN from their expectation actions that cause the  market self fulfillment.

Extremely short term trading algos often don't care a bit about fundamentals. They use high probability trades based on a set of technical conditions, A,B,C,D and so on that line up just right and trigger a trade E but only if the just right conditions, all line up right.

And it could be a 1 minute trade to take out stops in ng or a day trade or longer.

Some longer term algos that position trading funds use, totally care about fundamentals and are designed to hold for as long as months, often with triggers to add and build a position. They work in tandem with fundamentals.

Added: In the long run, the FUNDAMENTALS gradually take control in determining prices based on demand/supply dynamics. However, speculators using algos in todays world of trading will often control the markets IN THE SHORT RUN.

By metmike - May 7, 2022, 11:51 a.m.
Like Reply

There are some very short term trading, using algos in NG that would appear in  irregular sequences but several times on most days, as odd glitches/spikes at specifiic points in time that are clearly trying to take out protective stops placed at key locations(sell stops just below key support-buy stops just above resistance).

In the market described above, the algos are extremely short, sometimes seconds based on knowing where a bunch of stops are likely to be and its taking an extremely short term trade AGAINST THE TREND usually. 

It makes trading natural gas extraordinarily challenging and if you use tight stops in locations that made great sense in the past, I can assure you that your position is not likely to last very long............unless we have another type of market going on.

What I like to call a "running" market that feeds on itself from algos.

When this algo is being triggered we have a massive OVER reaction, all in one direction that has positive feedback that triggers other traders/programs that tell traders to do the same thing. One like you described in your first post joj.

A non computer influenced trader can recognize this happening and jump on board because they recognize it happen..........the trend is your friend as they say.

But this can be like the trend is your friend on steroids, human growth hormone and crack at the same time. The problem is that the up or down volume is so massive from herd mentality in the direction of the trend(if they are all getting strong buy/sell signals at the same time), maybe using the same indicators and similar algos at the same time, that it just runs over anybody that knows its way over done and tries to take the other side.

In fact, in some extreme markets, traders trying to get in the way can end up as the fuel to accelerate the move, when they are wrong and cry uncle by covering that wrong position. 

Short squeezes are the quintessential example of this but not usually algos? A parabolic move higher from panic buying that can result from margin calls or people with AT THE  MARKET, get me in/out at any price right now vs picking the price and time based on a resting order. 

Those could often be more emotional HUMAN trading too but losses that hit a certain point, might trigger a computer signal.

No doubt, there are astute algo's that are very familiar with these running days  that we've been having in ng and played a role in the last 2 weeks, when ng was up 20,000/contract in 2 weeks, based in a large part because of the first heat wave, low storage and expectations of a hot Summer, along with positive seasonals all adding to the same bullish mentality that caused an extremely over done, not justified fundamentally and mostly speculative move, likely, in part because computer generated signals(algos) were triggering buy signals in the direction of the move. 

That move, was greater than the range of ng during some entire years!

Then, without that much change, ng was down 8,000/contract, on Friday which was more than the entire  range for many consecutive months in a lot of  years. 

So these were running markets.

If you step in front of a running market, that's feeding on its own speculative momentum too soon, even just hours too soon, you can get RUN over. 

Wait until the positive feedback RUNS out. 

That's often impossible to know near the top. A big reason for that is that near the top, every time the market makes a new high.........it can trigger a brand new surge in buying........from algos being triggered and traders selling too soon trying to pick the top(which they know is over priced) getting run over and bailing out by adding more fuel to the fresh buying. 

If you sold too early ......on Wednesday for example,  even if you were convinced the market was way overvalued and was coming back down.......on Thursday, you were crying uncle and behind 8,000/contract and more likely to bail before that in a market like this. 

When we started collapsing on Friday, everybody chomping at the bit to sell or even take profits jumped in at the same time and we had tremendous downward price momentum feeding on itself, partly because computer algos were telling traders we were in a downward run and at the least, the upward running was over.

Natural Gas Intelligence, after the close around $9 on Thursday, in their headline news stated that $10 was the next target. 

Then, suddenly we did the opposite and plunged to $8.

I believe that everybody who was going to buy (short term) had already bought to cause the price to go up to $9 and when trading reporters started declaring expectations of $10 coming up, it was like a buy the rumour, sell the fact news/reaction. The heat subsided a tad but everything bullish was dialed in the last 2 weeks at $9 and announcing what traders had been speculating on during the run up..............caused that reaction.

After going up 20,000 in 2 weeks on OVER amplified bullish info, there wasn't enough MORE amplified bullish ammo/fuel to keep the run up going...........we went the other way.

Added: Tops and bottoms are tricky. New highs can trigger a new buying surge from many algos signaling the move up is amplifying or resuming..........but some algos, especially in overnight, thin trading will intentionally trigger the buying needed to barely hit the new highs (from stops) because they want to sell them for a very short term trade. ......and the market will quickly come back down from their selling and they can cover by buying back for a few ticks of profit.

So it's sort of an algo that tries to manipulate the price briefly, to  trick other traders or programs to take an action, that their algo trades against after the action is triggered.

It might involve knowing where resting orders are at the time.

For example, hypothetical....if there were 3 contracts to sell the next 3 ticks up to the contract high and 10 contracts to buy at the market/stop at 1 tick above that contract high but 20 contracts to SELL at the price above the stops, you could satiate the selling orders by buying 3 contracts, cause the buy stops to be hit..........AND SELL INTO the buy stops, knowing the big, resting sell orders above the market will hold it(and the resting sell orders above COULD BE YOU).

Then, when the price drops back below the contract high, cover the rest of your shorts for a tiny but often high confidence profit because your algorithm knew where the resting orders were.

Yeah, I know it sounds complicated and almost unethical but it happens. Larry will confirm it. I'm certain that there are countless algos that I'm not familiar with at all and this example probably is a bit flawed but it explains some of the shenanigans going on in natural gas and other market trading at times.

By metmike - May 7, 2022, 2:41 p.m.
Like Reply

Does that make sense to you?

By WxFollower - May 8, 2022, 10:14 p.m.
Like Reply

Mike said:

“Yeah, I know it sounds complicated and almost unethical but it happens. Larry will confirm it. I'm certain that there are countless algos that I'm not familiar with at all and this example probably is a bit flawed but it explains some of the shenanigans going on in natural gas and other market trading at times.”


Mike, Yes I can confirm 100% that this occurred regularly when I was trading. A lot of funny business going on, which was a big turnoff and helped lead me to be done with it.

By metmike - May 8, 2022, 11:24 p.m.
Like Reply

Thanks Larry.

I’m really, really, really sorry to hear that you’ve given up trading but very much understand the frustration.

I used to make Massive amounts of money using weather and being right almost every time as long as I didnt hold a huge position and hold over a weekend.

Until just over a decade ago when the extreme non weather, unpredictable gyrations started to make it more challenging.

I lost all my money on Halloween 2011 at MFG Global, 6 figures because of Jon corzine bankrupting the company after raiding the segregated accounts to meet margin requirements on a massive bond trade.

I was one of the segregated accounts that authorized absolutely nobody but me to touch the money. I didn’t t have a broker.

Then I borrowed a bunch to open an account at PF G Best.

when The money came back from MFG, I put it into PFG.

then PFG went bankrupt in July 2012  from the owner committing fraud and I lost much of the MFG money + the borrowed money.
I’ve never had a great year since then.

So this explains you not making ng posts anymore.

when did you stop trading?

is this for good?