September 18, 2006 | Leave a Comment
It is amazing how often the way something works in one area of life is similar to the way something else works in a different area. We often find ourselves thinking that the computer works exactly like the brain, or that the techniques used to win board games are similar to those that are appropriate for winning in markets. Music is one of the fields where the techniques and procedures often seem directly transferable to another field like art or games. Perhaps this is because it is a universal language of its own, and as such is subject to the same general physical and biological regularities as other 'languages.' The similarities between different fields are often so great that I find myself working in one field, then I find that just by changing the nouns, or substituting a market for a physical device such as a machine or magnet or resistor, the meaning is entirely transferable.
Perhaps this is due to the general applicability of physical principles, like the conservation or gravitation laws, or perhaps the similarities occur because of the common principles of life contained in Hoagland's The Way Life Works, which can never be repeated too often.
I have felt for a long time that everything that happens in the world of electronics specifically, how the components and all the circuits work, is an exact analogy to how the markets works. I am going to focus on just one aspect of this today which is the uses of comparators based on op-amps. I am going to use Michael Merchant's chapter on op-amp applications from the book Exploring Electronics, a highly recommended non-mathematical text for trouble shooting in the field, filled with diagrams and simple examples. As a second source, Try here.
I will focus on applications of the op-amp that deal mainly with comparators and skip some of the more involved applications that relate to filters, oscillators ,summers, integrators and differentiators. An op amp is a integrated circuit consisting of a differential amplifier with two inputs ,and a following output. The inverting input sends out a voltage completely opposite in phase to the input, (turns positive to negative, or negative to positive). Depending on whether the net sum of the voltage at the source is positive or negative, the output is magnified about 100,000 times up to the total voltage supplied by the power supplies — usually 16 volts. a good diagrammatic description of it can be found here.
The whole idea of an op-amp is based on negative feedback. The output gets connected back with a wire to the inverting input thru a component like a resistor , a capacitor , or a diode, in order to stabilize the output and reduce the gain from 100,000 to a moderate level. Amazing things can happen with negative feedback in electronics or the markets.
Let us start by looking at the most basic application of an op-amp ,one that does not involve feedback: the comparator. The idea here is to compare the level of the input to a certain specified value, and then take action based on whether it is above or below that value. The procedure is to establish that basic level on the inverting input and then let the positive input vary above and below the basic level to detect the threshold. Such a circuit is often used in real life to sense temperature or wind, light, sound or pressure. Actions are then taken to control a device such as a motor or machine. Indeed, in the my home, such a procedure is used to automatically open and shut a toilet cover.
In the market, such a circuit would be used first to compare the moves in price to zero, or perhaps to the previous high or low. When the signal moves to above the level, action is take to buy or sell.
The next set of applications involves a Schmitt Trigger. The idea here is to let the input swing to two certain levels, called the upper and lower threshold, which trigger a new reference level in the op-amp, which then takes action only when the input goes above or below the new reference level by a certain amount. This is an example of hysteresis, a delay between changed action. The idea here is to reduce the frequency of false detections in the signal due to noise or randomness.
Such a situation arises in markets often. The prices moves near a high or low. But action must be delayed to see if it is a true move, or whether it is caused by merely running or stops, an ephemeral factor relating to news, or perhaps just some random buying or selling by a big player (where the market moves completely out of bounds to accommodate and give bad fills to such a player.)
The next set of comparators is based on bounded comparators, i.e. window comparators, where the configuration is set up to detect whether the signal is within a window — between the upper threshold and the lower threshold. Such a configuration requires feedback in the circuit through diodes. The idea here is to see if the input is within a normal range.
The market situation here is, for example, whether to continue a buy and hold strategy. Such would depend on the stability of another signal that you were watching, say the moves in interest rates or foreign exchange. Or perhaps you have a position in a stock, and you wish to measure its strength relative to the market, triggering investigation or action when it goes outside of the window. All quality control actions where no-action is taken as long as the output is within control bands would seem to be of this nature.
The next set of op-amp applications seeks to find the peak or minimum voltage of the input. Such a circuit usually requires two components , a diode and a capacitor in a negative feedback configuration. and allows for constantly changing levels of the high and low. The usual application would be to see if you are nearing the breakdown level of the input or output you are controlling. Is the noise too loud, or the pressure being applied to the output above the breaking strength of the material?
Applications where the market is constantly monitored require more effort in markets also. When you are going to buy or sell would often be effected by whether the highs or lows keep going in the same direction. or whether a previous level has been broken by the current high or low. Indeed, the entire basis of pivot or swing trading would seem to be subsumed by peak detectors.
Other applications of op-amps relate to the creation of oscillators where an output is created that stays within a cyclical pattern, as long as the input signal is within certain bands. That would lead to the whole subject of cyclical moves in the markets, how individual cumulative changes in the input should be amplified, what frequency of individual time intervals would be considered, and the levels from peak to low that would be allowed to happen?
Another set of op-amp applications is based on the instrumentation amplified, which is used to detect signals that are very attenuated or subjected to noise. This is used to detect and amplify the true signal and eliminate the random component. Such configurations are a bit more involved in electronics, often requiring three or more op-amps before actions would be taken.
The market applications would involve more complicated procedures such as to consider the moves in markets that are not based on ephemeral factors such as economic announcements, or hyping by brokerages. Or perhaps the idea would be to eliminate all moves in an average that are caused by a individual component that goes above or beyond a peak level of 10% or so? The applications here are move involved and sophisticated, limited only by one's imagination, and as in the case of the instrumentation amplifier, require the monitoring of several different inputs.
The extent of op-amp applications is endless. Indeed, many programs have been developed to show the output that can be developed if various components of varying magnitudes, are connected to the input and output. A random simulation of what might happen by starting with some of the usual electronic components such as resistors, inductors, capacitors, diodes, transistors, switches, lasers, etc. might be of interest to the electronics engineer. In turn, the study of the uses of op-amp circuits that have been used by engineers in practice and that cover almost all digital and analogue configuration would be inspiring and fruitful to the market engineer.
These are just preliminary thoughts, but the subject seemed rich enough to put up in order to gain feedback both positive and negative, so that our knowledge can be improved upon.
Jeff Sasmor comments:
The history of op-amps stretches back to the time of vacuum tubes and analog computers. Today's digital computers use the binary number system to represent quantized, discrete-time values; analog computers used voltages and current to represent continuous voltage and time along with math operations (hence 'operational') like addition, subtraction, integration, etc. When I first started in electronics (around the time when Fred Flintstone was still listening to his avian record-player) op-amps were just transitioning from modules a few square inches in size (containing discrete components such as transistors and resistors 'potted' in epoxy) to inexpensive integrated circuits like the infamous uA741 from Fairchild Semi-conductor. It was cheap in price and lousy in performance. Audio ciruits created with 741's were disdained by audio folks as Pieces of $%*&.
It is no stretch for any googler to find interesting and informative articles on analog computers or op-amps.
One informative statement that I found was:
The similarity between linear mechanical components, such as springs and dashpots, and electrical components, such as capacitors, inductors, and resistors is striking in terms of mathematics, or even as it were direct mapping as in simulation. They can be modeled using equations that are of in essence the same form. Other methods include direct observation without the aid of mathematical operations. For example, water pressure can be simulated by voltage and water flow in terms of gallons per minute can be simulated by amperes. [read more]
I agree with what the Chair has said regarding similarities between electrical circuits and markets; I recall this subject has come up before. In June '06 there was a thread about Hysteresis - part of my comment is appended to the end of this post.
One of the interesting differences between op-amps was a parameter called slew-rate. It is the speed at which an op-amp circuit can move from one voltage level to another. Audio designers (such as myself at one point) usually went for the higher slew rate op-amps (when we could convince my boss Richard at Eventide Clockworks to spend the extra pennies) due to their reduction in distortion — they could follow the high-frequency waveforms with greater accuracy.
I have been playing around with the notion of price-change slew rates — how to quantify them and how to interpret them. I have been writing some Tradestation code in this vein, for example, there seems (to me) to be a big difference in how to react to a slow-moving intraday change in price as opposed to a fast-moving one.
Fast-moving price changes tend to overshoot major price points like whole-dollar amounts (also .5 and .25), anecdotally I see more overshoot (or undershoot) for faster-moving price than slower. It seems to create larger retracements (or bounces). Apologies for hand-waving here … but the analogy to electrical circuits is very apt and fits my intuition. Fast slew-rate in op-amps allows the output to more closely follow the input but also adds overshoot and undershoot (distortion) effects that the designer needs to control.
I suppose you could somehow model the universe of all markets as a very complicated electrical circuit. Certainly the money flow into and out of various securities can be considered to be an alternating current (of money).
There is probably a relation between futures and their underlying; they could probably be modeled as capacitors and inductors. Futures as capacitors because the current (money) leads the voltage (price) in phase (time) and stocks (commodities, etc) as inductors because the price (voltage) leads the current (money) in phase. That may sound weird, just think about it a bit.
The reactance of the overall market is thence a complex function; actually, a time-varying complex function (even worse). Push/pull a lot of current (money) in/out of it and the voltage (price) reacts accordingly. I think that this applies to an individual component of the overall market, like the stock market. Overshoot and undershoot from step functions in price (gaps) help a lot of people make money every day.
Jim Sogi mentions:
Speaking of amplifiers, an electric guitar sounds best through vacuum tube amplifiers. One of the best amps is a 1972 Fender Pro Reverb which is known as a "vintage amp" based on technology that was popular during the 2nd World War. In fact it is hard to get vacuum tubes now except in places like Russia, China and Slovakia where they must still use them for other purposes as well as playing rock and roll music. Another great amp is a new version of the old amps.
Tube amps are an endless topic of discussion among guitarists seeking the perfect tone. What goes on in the amps is not well understood and has a degree of mysticism involved. It is not well understood what is going on inside the vacuum tubes as they glow and hum with an eerie glow as power surges through the ether. Some time in the early 1970s CBS bought out Fender and in an attempt to improve the circuits made modifications which made them sound worse. Now the older pre-modification amps are prized for their tone and amps are routinely returned to the older specs before the "improvements" . I sent my 34 year old amp to Kendrick in Texas who completely rebuilt my amp to the old specs and now its sounds better than ever.
The tone of the amp when playing a guitar is based on the fact that the amps have a clean sound, a distortion/overdrive mode, and a feedback mode. The clean sound is the country sound, Chet Atkins. Distortion over drive is used by Blues guitarists like BB King, Stevie Ray Vaughn to give a warmer tone. Feedback is the sounds of Jimi Hendrix. This article has a good discussion and some quantitative specs on the balance of inputs and tone which might apply well to market input and volatility and tone. The excerpt below discusses the effect of increasing supply on the market dynamics. The vintage tube amps had a balance of dampening and power transformers dual stage amplification that allowed versatile tone, clean sounds, overdrive and feedback all in one amp.
As applied to markets in line with Chair's idea, the Fed model is a power supply idea basically. Other sources of power input might be the bond market, money supply, foreign buying, internal buying, insider buying, payrolls, buybacks, productivity gains, crude price increases, real estate increases, interest declines. The dampening provided by resistors are the market mechanisms and rules, and the market makers themselves. When the resistance is overcome by input a feedback loop generates.
Markets have tones. The clean tone is the average daily range with partial oscillations within the day. The overdrive distortion tone are the days with expanding intraday ranges or swing within the day that are as great as the daily range and rougher sine wave oscillations comparable to those of distorted guitar sounds. Feedback days are the days like last week where the tone outputting circled back to the input and buying began more buying driving the market up into new highs. From a quantitative view point, the market tone set early in the day seems to set the rhythm and tone for the day and the market player seem to play along like a band in a jam session.
Feed back in guitars, when controlled can sound good, but for vocal microphones it is bad. Often the acoustics of the room affect feedback loops and you only hear feedback in certain frequencies, usually the higher frequencies. The same seems to be true in the markets. The acoustics of the market tend to encourage feedback at the high price ranges. A noticeable number of the large traders seek confirmation and momentum, and pile in on new highs in strength. While these are descriptive, prediction is difficult, but as with guitar playing after hours and weeks and years of practice these ephemeral conditions can be harnessed through feel to create good tones and music. There are some digital signal processing algorithms that have been applied to markets in various ways and may provide a good basis for testing.
Kashi Vishwanath comments:
Victor mentions "…the same general …regularities" between seemingly disparate fields. I couldn't resist bringing up Christopher Alexander's wonderful A Pattern Language and Danny Hillis's The Pattern on the Stone. The former is about universal architecture principles followed (at some level of the (un)conscious) by people of disparate cultures around the world and over the eons. The latter is on principles of software and computer engineering by one that has been at the cutting edge of that field. Written well after the former and obviously very influenced by it, Danny comments with fluency and erudition on how patterns and themes in software engineering are alike to those mentioned in Chris Alexander's treatises. Fascinating reads, both.
Gary Rogan adds:
One of the most interesting things about how op-amps are used is that a powerful, yet extremely variable component is converted by relatively simple means into a much less powerful, but much more precise one. Op-amps by their very nature have very high amplification, but the absolute magnitude of it is not well controlled: for a particular type it could vary from, say, 20,000 to 70,000 (and I am not even going to get into their "frequency response" problems). However, if you surround them by two resistors which are easy to make precise, but are obviously not "powerful" in any meaningful sense, you can get a circuit that amplifies by a relatively small factor, like 10, with a degree of precision limited pretty much only by the precision of those resistors, thus .2% is fairly easily achievable given .1% resistors, and with a frequency response so high and relatively more predictable that you often do not have to worry about it. There has got to be a general lesson about taming powerful forces in there.
Interestingly, the triumph of digital technologies over analog techniques (as in digital computers replacing analog ones that used to use op amps) is more of the same. We give up even more of the raw capabilities of the underlying circuits to switch fast to have them switch precisely and between only two levels, 0 and 1.
What is the unifying theme? Predictability. It's worth a very high price.
On another note, the non-intuitive idea that I should magnify my response and gain precision by adding dampening is a key feature of the nervous system. Our brains are full of inhibitory feed-back circuits, and cases of parallel inhibitory circuits to stimulatory ones.
The retina, for example, performs a huge amount of edge-detection by itself before the information even enters the brain. The photo receptors are stimulatory, and synapse on several inter-neurons, one type of which are horizontal cells, which are inhibitory, passing an inhibitory signal to regions nearby. These inter-neuron layers propagate forward to the final output of the retina, the retinal ganglion cell. The response of a cell is a classic center-surround field. where light in the center of a cell's receptive field stimulates the cell, and light off-center inhibits it. If you record from these cells, and throw the stimulus response patterns across the retina up on a screen, you see gross representations of the edges of the image.
Parkinson's in the motor system is a classic case of the inhibitory system being impaired, and throwing off precision.
The implications for trading systems are clear. One can sharpen one's responses to a trading stimulus by looking for ways you should inhibit the response, perhaps using orthogonal information, or looking for cases of negative correlation. I've long thought that that would be a great way to hone a trading system. We spend so much time looking for ways things are correlated with each other, but perhaps we can build a more precise system by adding in non-correlated or negatively correlated information. I'm sure there are very smart people, probably on this list, who are already doing this and are telling me to keep it down.
I have been trying to gain insight into the economics and sociology of the number of friends one has. Some concepts that are relevant are the substitution of family ties for friendship, the reduced time that we have for friends when we have children, the opportunity cost of having a friend when you have other high value uses for your time, the amount of investment that you place in a friend and what the rate of return on that investment is (and how to measure it). Mobility is often reduced by the amount of friends one has, but life-span is increased and apparently friendship is a more important determinant of happiness than money. Here is a simple mathematical study on friendship and its rewards, based on having 150 friends.
I believe that many of the same factors that determine the number of friends you have determine the number of markets or stocks that you own, and the loyalty that you place on them. Perhaps the methods of studying friendship and the concepts that help us determine our choices could be of use when determining what to buy or sell, and where.
We all could be better friends in one way or another, and I plan to reach out to a few people and become a better friend today. Perhaps this will make me happier and more profitable in my investments also?
Rod Fitzsimmons Frey adds:
There are those who are skilled at being a friend. The adolescent view of a good friend is that he is a good listener, concerned for you, sympathetic, etc. That also describes a Labrador Retriever. I think Optimism is the defining quality of somebody who is good at friendship.
He pays you a visit because he is optimistic you want to see him. He buys a small gift for you when he spots it because he is optimistic you will like it. He telephones after a year because he is optimistic the news will be good. Conversations are about the present and future and not past faded glories. Making new friends is the ultimate vote of confidence in the future.
Not quantitative, unfortunately, but relevant to market activities.
C. Kin comments:
Friendship is in some ways an early form of credit … the accumulation of "favors" receivable. I seem to recall from Sidney Homer's History of Interest Rates that kings would make overtures of friendship with other neighboring kings. Gestures of goodwill, tributes, etc., would require reciprocity with a slightly higher value in the future. Failure to reciprocate (a default) would be met with derision, anger, distrust, a disruption of commerce, and all of the other unpleasant things that occur when royalty gets slighted.
Vince Fulco mentions:
While I am a strong believer in the more altruistic reasons for developing friendship vs. the commercial ones laid out here, Charles' historical mention scratches at some great work by Robert Cialdini, a psych professor, regarding reciprocity. It is a generally inherent trait, some call it a mental flaw, of all humans. A flaw because as Cialdini's studies point out; upon receiving something of only nominal value from a friend or acquaintance, we have a tendency to respond in kind with a return favor or gift many times the value.
This phenomena and many other excellent examples are found in his book Influence: The Psychology of Persuasion which I highly recommend for the reference library.
Jeff Rollert adds:
I differ with the implied symmetry of value. Last weekend I traded $20 and an old stereo for a very nice mountain bike for my son at a place where we normally donate stuff. They had a lot of bikes which were not selling. The receiving area needed a new stereo. I clearly won in my mind, they in theirs, yet on market value a third conclusion may have been reached.
Steve Leslie says:
One thing that I always admired about Winston Churchill was he would invite friends and associates for long dinners at his estate house. His suppers were legendary as some of the great politicians, diplomats and thinkers of his era were invited to discuss the events of the day. And these suppers would last long into the wee hours of the morning. I can only imagine the discussions and as I recall, Churchill continued these especially through World War II. Now if Churchill could find the time to have over a group for supper while the fate of the free world hung in the balance what does that say for us.
Speaking personally, there is no greater enjoyment for me than to be invited to someone's home for dinner. There is just something wonderful about being liked so much that another would want you in their most cherished and private part of their world. It is as if they are saying to me "We are welcoming you to be a part of our inner circle of trusted friends."
Kashi Vishwanath mentions:
Your book and website indicate that you (and your colleagues) are willing to look at alternate explanations than the conventional party line. Here is one on Winston Churchill for your consideration and debate.
Conventional thinking has put Churchill on a pedestal. Witness the recent comment in your thread on friends. Ditto the innumerable books and hagiographies on him. Etc.
All that for someone that sought to continue colonial exploitation, ridiculed and disparaged MK "Mahatma" Gandhi, abused the native population of the Middle East and Africa in his time there and sought to maintain that going into the future, supported slavery, and so on. To call him a "leader of the free world" raises weaknesses in one's own critical and independent thinking. Free for what and for whom? and at what cost?
Jan Petter-Janssen continues on the topic:
As a student on a foreign continent the first weeks are really exciting. Since most students know no one or very few when they arrive, making friends is really easy. Everyone is in a kind of friendship vacuum. After a while the number of friends declines a bit since one cannot find enough time for everyone. This is like in micro economy where a monopolist sets marginal revenue equal marginal cost.
Adapting economic thinking and finding how to increase the social revenue and reduce the time cost of a friend may be a good idea (with the risk of such an idea being regarded cynical - which would imply your friends reducing their revenue of having you as a friend).
Another aspect with friends is to balance socializing with working. You work in order to buy goods and services, so you could say that the marginal benefit of interaction and transaction should be equal? I can definitely see myself in such a dilemma because trading stocks gives me the benefit of competition, achieving goals, and studying the mystery of the marketplace, but little social benefit. However, the balance is found by cutting out TV and video games, so then I have enough time for socializing too.
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- September 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- Older Archives
Resources & Links
- The Letters Prize
- Pre-2007 Victor Niederhoffer Posts
- Vic’s NYC Junto
- Reading List
- Programming in 60 Seconds
- The Objectivist Center
- Foundation for Economic Education
- Dick Sears' G.T. Index
- Pre-2007 Daily Speculations
- Laurel & Vics' Worldly Investor Articles