In the last 5 years, there were approx 12,400 competitive football matches across the English Premiership & Championship, the Italian Serie-A, the German Bundesliga, the Spanish La Liga, and the group stages of the UEFA Champions League and Europa League.
In 6,484 of those games one of the teams took a 2-goal lead during the game. Within this sub-group, the leading team failed to achieve a victory in 438 cases at the end of 90 minutes.
How does this relate to trading?
I like playing with statistics and with probabilities, and the bigger the data sets that I am looking at, the more fun it becomes.
Using code to collect trading statistics
Having learned some EasyLanguage coding, I realized I could now go about collecting data about price behavior. If I find anything “non-random”, then I could design a trading strategy using that non-randomness as a starting point, as a foundation. As opposed to starting with an trading idea, writing code, and seeing how it turns out.
This reminds me of the ‘Master the Gap” trading room I frequented some years ago, in which a US-based trader placed his buy/sell decisions on statistics collected in regarded to opening gaps of the US indices as well as on the 1-hour opening ranges. Incidentally, that room is still around but is now called Investiquant.
Since I have been doing a bit of work with pinbars lately, I decided to use that as the experiment.
I had already written a few lines of code with which I am able to identify bars that meet a certain criteria in terms of their shape and size. As far as size is concerned, I had originally opted for setting an ATR-based threshhold for the candle’s high-low range. That said, today I chose a threshold based on the range being a minimum multiple of the instrument’s typical transaction costs (spread+commissions converted into ticks/pips). Why are transaction costs important? Read my Roulette-comparison discussion for my views on that.
Regarding shape, the eligibility criteria relates to the upper wick, the lower wick, the body and how they all compare to each other in size, as well as the final close relative to the candle’s high-low range.
Thus, I have created a custom indicator in Trade Station that automatically identifies bar that meet the criteria in real time (i.e. as soon as the bar is completed). This removes some discretion in that whether a bar meets the criteria or not is based on hard calculations. However, most of the time these candles should jump out at the trader in any case. The real benefit is to then use the identified candle as part of an automated trading strategy and be able to back-test over years of historical data.
Examples of collected data
Now the part where I start to feel ‘productive’. With a few more lines of code, I was able to quickly extract a whole lot of data in the time it takes to drink a cappuccino. I simply clicked thru 20-30 FX instruments and with each instrument, TradeStation automatically registered a whole of information into a file – this being information as at the time of the pinbar – such as the moving average levels, the ATR etc – basically anything you want.
I then used Excel to do some simple analysis using pivot tables – note this is for 27 spot-FX instruments, on the 4-hour timeframe, over the last two years:
- 4,095 candles met the pin-bar criteria, around 500-600 each on the bar closings at 2am, 6am and 10am – around 800 each (800 – 806 – 813 to be exact) for the 10am, 2pm and 6pm closes [all London/UK time].
- There were six instruments which had less than 30 pinbars each – that was quite a surprise to me, 14 instruments had between 70 to 200, and 7 of the instruments had between 275 and 315 each – all of these 7 involved the same single currency.
- I started playing around with where the pinbars were closing in relation to the moving averages and also whether the moving averages were in alignment – this allowed me to ascertain whether price was potentially over-extended – additionally I was measuring the distance from the relevant moving averages and equating in units/multiples of the pinbar’s size.
At this point, I started running out of time and figured I would carry on with this on Monday.
I will be looking to see whether there are patterns in how price behaves depending on the pinbar’s location. That will also be done via coding. I can identify the maximum favorable and adverse excursion (MFE and MAE) over a specified subsequent number of candles. Looking for non-randomness.
Have a nice Sunday everyone.