Several weeks ago, I presented a scalping idea: SAT2021-09 Moderate Scalp 1 . That idea was to take a trade with a small profit target, based on the position of the Kaufman’s Adaptive Moving Average (KAMA) within a bar. This scalping trading idea is a variation of that idea.
Firstly, the KAMA must be between the open and close of a bar, or within the body of the candlestick (Open to Close), if you are using that style chart. Secondly, we determine if it is an up or down bar. Finally, we look to see where the KAMA is within the body of the candle: Upper 25%, Middle 50%, or Lower 25%.
We take these three conditions to decide whether to go long (buy) or go short (sell short). In the example below, we would go short next bar with a small profit target.
The aforementioned scalping system was a failure, which is not surprising; a vast majority of trading ideas fail under rigorous testing. Well, enough chatter, let’s get to it!
Phase 1: Plan & Design
1. Trading Idea
I believe that when the KAMA moves to within the open and the close of a bar, or the candlestick body, we are reaching price equilibrium and could expect some price oscillation (I hope). We need a few pieces of information to guide our entry decision:
- KAMA: Between Open and Close
- Direction: Did bar close Up or Down? (we will not trade a flat bar)
- KAMA Location: top, bottom, or middle of the candlestick body?
Long entries:
- Direction down and KAMA in the middle (MidLong)
- The idea here is that we are ranging and expect the price to move in the opposite direction (contrarian)
- Direction up and KAMA in the bottom quartile (BottomLong)
- Go in the direction of the trend
- Direction up and KAMA in the upper quartile (TopLong)
- Go in the direction of the trend
Short entries:
- Direction up and KAMA in the middle (MidShort)
- We are ranging, so go in the opposite direction
- Direction down and KAMA in the bottom quartile (BottomShort)
- Go in the direction of the trend
- Direction down and KAMA in the upper quartile (TopShort)
- Go in the direction of the trend
I will use limit orders for entry, using the Close price for the limit entry price. I will try this on futures and forex instruments.
2. System Definition
Position Sizing:
- Futures: 1 contract
- Forex: 100,000 lot size
Stop: Stop loss, optimizable
Exit(s): If still in position at the end of the bar, exit next bar at market
Profit Target:
- Optimizable, but do not get greedy and take what the market gives us
Input Parameters:
I will use the following input parameters:
Input(Default) | Data Type | Optimizable? | Comments |
ProfitTarget(100) | Double | Yes | This will vary by instrument, so I will need to work on this a bit, but not overfit. As noted later in the Unit Testing section, I am taking profit target based on points for the instrument. |
StopLoss(1000) | Double | Yes | Used to calculate our entry price (limit order) |
Challenges:
- None
3. Performance Objectives
The system will meet the following objectives:
Objective | Goal | Achieved via Testing? |
System Type (trend, mean-reversion, day, swing, etc.) | Scalp | |
Risk of Ruin | 0% | |
Profit Factor | > 1.5 | |
Win Percent | > 70% | |
Max Drawdown % | < 35% | |
Profit/Drawdown Ratio | > 2.0 | |
Ready Date | 2021/4/23 |
This idea is S.M.A.R.T.: Specific, Measurable, Achievable, Realistic, Time-bound
4. Market Selection
Markets:
Energies | Currencies | Fixed Income | Agriculture | Metals | Softs | Indexes | Equities |
---|---|---|---|---|---|---|---|
X | X | X | X | X | X |
Instruments:
I am looking for instruments that demonstrate long wicks to the up and down sides on the selected time frame. I want an extremely high probability that the instrument will move up and down, regardless of whether I am long or short.
Market Group | Instrument | Symbol | Comments |
Energies | Heating Oil, RBOB Gasoline, Crude Light, Natural Gas | HO, RB, CL, NG | |
Currencies-Futures | Futures: Euro FX, Australian Dollars, Canadian Dollars, Japanese Yen, British Pound | EC, AD, CD, JY, BP | |
Fixed Income | 10-Year U.S. Treasuries, 30-Year U.S. Bonds | TY, US | |
Agriculture | Soft Red Wheat, Oats, Lean Hogs, Soybeans, Corn | W, O, LH, S, C | |
Currencies-Forex | EUR/USD, USD/CHF, and AUD/NZD pairs | I have a theory that AUD/NZD will do well, because they mean-revert well, and that EUR/USD will not do well, because it does not mean-revert well. | |
Index Futures | E-minis: S&P, Dow, Russell 2000, Nasdaq | ES, YM, RTY, NQ |
Chart Type, Timeframe, Session, Time Zone:
Attribute | Value | Comments |
Chart Type | Regular Candlestick | Charting is only useful for validating entry and exit signals |
Timeframe / Interval(s) | Daily, 360 minute, 720 minute | |
Session | Regular | |
Time Zone | Exchange |
Phase 2: Build
5. Manual Test
I looked at Silver (SI) on a daily chart for my manual test and it looks like it will work well. I look for any instrument that has a lot of high and low ‘wicks’ on the candlestick chart, which tells me there is price movement above and below the bar.
I looked at a few other instruments and it seems like this idea is worth pursuing. Like mean reversion systems, I expect the occasional large loss with many small wins. Let’s build this and see if this moderate scalping trading idea draws water.
6. Build
Process Diagram
Comments:
The build was a little more difficult than some other systems because I have a total of six entry conditions.
I learned a valuable lesson here: I built the code first and drew the diagram second. If I had built the diagram first, I would have found an efficiency while writing the code. I need to draw the diagram, which can be difficult, then write the code. This is the discipline that wrote about a couple weeks ago in my newsletter that applies here. The more efficient code may have accelerated the testing process.
7. Unit Test
The unit test is a test to determine if the code is executing as designed in step 6. This is a pass/fail or binary test: it either works or it does not. The code for futures had a few bugs, but I worked through them and all is well.
Forex was incredibly painful to test. The results were….strange. I tested over two platforms and datasets, and got entirely different results. The signals were taken, but the data was a mess. Given the short amount of time allocated to this system, I am setting forex aside to focus on futures. The currency futures I selected should give me an idea of this will work with spot forex trading.
Sometimes while validating trades against expected signals, a bug is discovered, and it results in something potentially valuable. This happened on one of my other systems here on Systematic Algo Trader several weeks back, but that was not tradable. This one appears to be tradable for silver futures (SI). I have set aside the buggy code, as it has some potential. This is not as uncommon as it may seem. I am glad to have another ‘happy little accident’ to explore.
Complete?
Phase 3: Test
8. Optimization
With my last scalping system, I experimented with point-based profit targets. Although I implemented it in my code, it was more trouble than it was worth and a comparison between the results of each was negligible. In the end, I found that it does not matter too much if I am using points versus currency, so I will keep it simple and have a currency based profit target.
I gently optimized the two input parameters, for a total of 70 iterations:
Input Parameter | Range | Step |
ProfitTarget | 50 to 200 | 25 |
StopLoss | 0 to 2000 | 200 |
These optimizations have 72 combinations of parameters. The MA_Trend_Period , used for the SMA trend filter, is optimized based on an idea from Perry Kaufman, who sometimes favors an 80 day moving average for determining the long term trend.
9. Walk-Forward Analysis
The results of this test were very interesting. Among all instruments, Silver appeared to be the most robust with respect to the in/out periods used. Here are some select metrics from my Walk-forward Analysis (WFA):
There are a few things I would like to address:
- Out Prd: this is my Out Period, or the period that is tested based on the optimized parameters generated from the In Period sample. I like longer out periods if possible because it demonstrates robustness and it means I do not have to optimize as often.
- R^2: this tells me how steep the equity curve is, or slope if you will. Higher is better.
- Ret/Max DD: this is the ratio of Total Return : Maximum Drawdown. Higher is better, and if you recall, our goal is >= 2.0.
- WF Eff: this is Walk-forward Efficiency. I do not like anything lower than 50%, but I want to see how AD and EC perform in Monte Carlo and (hopefully) Incubation.
I did a little more analysis on profit factors, as my Walk-forward tool sometimes has results that do not always match my own calculations. AD and EC both failed and will not advance to Monte Carlo Simulation:
- AD: Profit Factor = 1.41 (fail)
- EC: Profit Factor = 1.39 (fail)
It is interesting, though maybe not significant, that the Walk-forward Efficiency was very low for both. It could just be the nature of the instruments (both are forex futures).
All the rest advance easily.
10. Monte Carlo Simulation
I was born in the Rubber Capital of the World, so as we say, this is where the rubber meets the road. Monte Carlo results, as I expected, were good.
The RTY results are puzzling, as my Return/DD ratio in WFA was over 2.0, but in Monte Carlo was only 1.64. I will advance this to incubation but keep an eye on it. Incubation will typically root out the remaining bad apples.
11. Incubation
I was interested to see how Silver does in in February 2021. This is when which members of the r/wallstreetbets subreddit started trading heavily in silver futures. I suspected that it will not be negatively affected, as some of our other silver systems did not show any anomalous results during the same period.
Here are the results:
RTY and SI passed, ES is a ‘maybe’, HG is a fail. Or is HG a fail? HG’s median drawdown in Monte Carlo is 10.2% of 12,500, or -$1,275, which we did not quite hit. We did not quite hit that median, though the median is only a point of reference for decision making. I will not go live with HG, but I will watch it. I believe that given it’s Monte Carlo results that it will bounce back in the next six months.
This is what a scalping equity curve typically looks like; very zig-zaggy for Silver. If silver was impacted by the #wallstreetbets crowd, it was only positively. The increased volatility may have worked in our favor.
Phase 4: Deploy
I did not see this coming. I expect nothing from scalping systems, but we have a few that may be useful. I particularly like RTY, even though the median return is low (at least for a leveraged instrument): it only trades about 40 times per year, is in and out the same day (usually), and keeps capital free for trading other instruments.
I will add these three to our portfolio, which is now looking more diversified:
- 1 swing system, futures
- 2 mean-reversion system, futures
- 1 mean-reversion system, equities basket
- 3 scalping systems, futures
Overall Result: PASS
Notes and Commentary
Scalping systems are directly opposed to the trading adage, ‘Let your profits run’. The adage for scalping should be: ‘Take your profits and run’. I did not expect this scalping to work, but it did. Who knew? I do not really have more analysis on this system, other than to say I have variations of this for the future ideas.
Unexpected Consequences
There were some strange and amazing things that happened during development and testing. Firstly, I found a bug when doing my unit testing, which produced much, much better results on Silver than what we see. The bug involved taking the wrong direction for a couple of the conditions. So, I set aside the code to treat this as a separate system for further testing.
Secondly, there is another bug that I found, but this goes back to the original Moderate Scalp 1 system from a few weeks ago. If we did not hit our profit target in the entry bar, then we should exit the next bar. I was exiting two bars later. Ugh. This caused most symbols in this current system to fail. I just overlooked it, but fixed it, which may explain why a few of these passed WFA.
Finally, I found that I must return to Moderate Scalp 1 to fix that issue and run the the testing process. I have a saying: “The greatest evil in the world is rework.” This may be hyperbole and you may/probably disagree, but that is a separate topic for debate. Here it means that:
- Moderate Scalp 1 results are wrong
- I must go back to this moderate scalping trading system, fix the code and retest
Time is something we can never regain once lost, so… rework. On the plus side, it is possible that Moderate Scalp 1 works.
Idea for future systems:
- Utilize ATR to calculate the amount to scalp; I think this will allow the system to adapt to current volatility
Next time we will be looking at an idea I stumbled across that uses Perry Kaufman’s Efficiency Ratio to trigger trade entries. I have no idea if it is a good idea or not, but I like the Efficiency Ratio (it is part of the KAMA, after all) and want to explore this a little further as a system.
Thank you so much for reading. If you have any comments, suggestions, or just want to say ‘hi!’, please leave a comment below. You can follow me on LinkedIn or Twitter (top of the page) and if you have not subscribed to our semimonthly (no more, no less) newsletter, you can do so below (keep scrolling, it is down there somewhere).
Trading System Result: SUCCESS
Sources/References
Did you like what you read? Do you want to see more? Subscribe now and receive our email twice per month, with a new Trading System Idea and other fun stuff.
Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.
Did you like what you read? Do you want to see more? Subscribe now and receive our email twice per month, with a new Trading System Idea and other fun stuff.
Don’t worry, we will never, ever, ever sell, overuse, or donate your email address. Promise.
i tried to replicate your test but the iteration count was off by a factor of 10. can you confirm what parameters you used? and did you use multiopt for the testing?
Hey Jon, yeah, I used MultiOpt. What instruments are you testing? If it is the same ones, then you should, in theory, get the same results. If you are going micros, that might explain the factor of 10. Send me an email and maybe we can puzzle this out.
For those who do not know about MultiOpt, this is a cool tool that works with the TradeStation desktop platform to accelerate optimization and testing:
MultiOpt