NexusFi: Find Your Edge


Home Menu

 





Attack of the Robots - An Algo Journal


Discussion in Trading Journals

Updated
      Top Posters
    1. looks_one vmodus with 357 posts (859 thanks)
    2. looks_two SMCJB with 38 posts (84 thanks)
    3. looks_3 kevinkdog with 27 posts (70 thanks)
    4. looks_4 bobwest with 13 posts (53 thanks)
      Best Posters
    1. looks_one bobwest with 4.1 thanks per post
    2. looks_two kevinkdog with 2.6 thanks per post
    3. looks_3 vmodus with 2.4 thanks per post
    4. looks_4 SMCJB with 2.2 thanks per post
    1. trending_up 94,155 views
    2. thumb_up 1,141 thanks given
    3. group 61 followers
    1. forum 478 posts
    2. attach_file 181 attachments




 
Search this Thread

Attack of the Robots - An Algo Journal

  #441 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853

Before moving on to my next idea, I wanted to look at the Williams %R forex system I've posted here, but applying a weekly timeframe. The results were, uh, very surprising. Here is a comparison of the four pairs, same system, no optimization, trading period 2010 through mid-Feb 2022:



The two symbols that I expected to not mean revert well, EUR-USD and JPY-USD, were better than the other two that I expected to mean revert better.

On an account size of about US$12.5k, the annual return comes in at 36.9% (includes spread, slippage, and borrowing costs). This is something that I would add to my portfolio today, if I were able to trade forex. The time in market is about 11%, so borrowing costs are low.

Taking this idea one step further, I will have to try this using RSI instead of the %R. The %R was an experiment, but RSI has worked very well for me with mean-reversion. That is for another day in the future.

I settled on my next idea: forex momentum. I have no idea what to expect, but I want to exploit an idea I have around momentum, since I am not that familiar with momentum systems. I decided to use forex again since the data is fresh and easy for me to work with. I will post my progress here later this week.

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #442 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853

As if I did not have enough work to do, I have to let my curiosity get the best of me. The AUD/NZD forex pair was bothering me, mainly because I expected to see better mean-reversion from it, so I decided to look at the hourly resolution. Mean-reversion was better with my %R system at the hourly level (probably better if I used RSI), but I ended up going down a rabbit-hole.

I recall something @kevinkdog mentioned about Andrea Unger, fellow algo trader and World Trading Cup champion: he optimizes daily. I don't recall when, where, or how it came up (correct me if I'm wrong and you're reading this Kevin), but I wanted to know what would happen if I optimized this system on this instrument daily: 1 day in sample/1 day out of sample. During my first attempt, I made a mistake and optimized at the 5 hour (5 bars in/5 bars out) level, so I just let it run to completion. Then I adjusted to 1 day, then 5 day, 6 month, and 1 year, then compared to my base parameters. Here are the results:



(Adjusted Profit Factor is a 'worst case' calculation; I find it to be a good predictor of Monte Carlo simulation outcomes. Adjusted profit factor greater than 1.00 is good).

In Sample is, of course, high, as it should be, but the Out of Sample for the 5 hour was really high compared to the other . The in sample for the 5 hours is not a misprint, but for those not familiar with in-sample portion of walk-forward analysis, this is what would happen if we knew the best parameters in advance. Anyhow, I cannot imagine a 5 hour optimization would be practical and I'm not sure it would work (but who knows?).

Wow, talk about weird. I was just curious what daily optimization would look like and now I know. Optimization every 5 days and greater does not improve the Profit Factor with any level of statistical significance, when compared to the base values.

One final observation before I wrap up this weird little post; total number of trades at each optimization interval:
  • 4351 - 1 year optimization
  • 4202 - 6 month optimization
  • 4017 - 5 day (weekly) optimization
  • 3762 - Daily optimization
  • 1894 - 5 hour optimization
In this case, the more I optimized, the fewer trades were generated. The fewer the trades, the lower the trading costs. Also (not seen here), is that the more frequent the optimization, the greater the profitability per trade, as measured by overall profitability.

These are just interesting observations and I'm not advocating for more frequent optimizations. I personally optimize my systems about once per year, maybe at 6 months depending upon the system. I look forward to digging deeper into this mystery as I progress on my algo trading journey.

If and when I can trade forex again, I would like to try this daily optimization experiment on a small lot size. Maybe I can run this in sim now.... hmmmm.....

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #443 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,666 since Jul 2012
Thanks Given: 1,892
Thanks Received: 7,360


Nice work @vmodus!

I don't recall mentioning Andrea Unger using 1 day re-optimization - he does not even use walkforward much, if at all.

I know John Ehlers does use it.

I personally don't.

Follow me on Twitter Reply With Quote
Thanked by:
  #444 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853


kevinkdog View Post
Nice work @vmodus!

I don't recall mentioning Andrea Unger using 1 day re-optimization - he does not even use walkforward much, if at all.

I know John Ehlers does use it.

I personally don't.

Thanks for the clarification and kudos, @kevinkdog. Yeah, I don't know where I heard it, but I will have to dig into my archives to see who said it. I'm thinking it was a guest on Better System Trader.

And speaking of BST, I listened to the episode from December 2021 that you, Laurent, and Scott Welsh were on, this past weekend. Three different traders, personalities, and market approaches, with one thing in common: algorithmic trading. Great stuff and thanks for sharing your time. For anyone else reading this, it's an excellent episode... check it out:

207 - Preparing for a new trading year - Better System Trader

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #445 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853

The post of my latest forex system is live, you can read it here:
Trading Idea # 029 - [AUTOLINK]Momentum[/AUTOLINK] 1

It is borrowed from Cesar Alvarez, who has inspired some of my successful systems. The idea is simple:
  • If the close > close of 10 bars ago, go long;
  • If close < close of 10 bars ago, go short
  • Always-in; stop and reverse with each signal
Here is what it looks like on a chart:


Forex might not have been right for a momentum system, but if nothing else, I learned a bit about momentum versus trend-following. That's all for now!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #446 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853

Here is what I'm thinking about today....

I was doing some research for my next system (Momentum Pinball), but then got sidetracked on a Larry Connors system, Vol Panics, which is designed for the VXX, an ETF that trades VIX futures contracts. (Note: the idea below is not the Vol Panics system. I have ADD... oh look, a squirrel.)

The VXX is designed for short-term trading/speculating/gambling/hedging. Anyhow, I started looking at the last two bars of a 60-minute chart (the 15:30 bar and 16:00 bar) and noticed a pattern. Before I dive deeper, understand that I am looking at regular US Stock sessions, starting at 9:30 and ending at 16:00. Since I am looking at 60 minute charts, not 1 hour, my start time is 9:30. This explains the 30 minute bar at the end of the session.

Was I seeing a pattern or did I have some bias? I dumped the data into Excel and ran the numbers, which confirmed my thinking. Here is what it looks like on a chart:


Looking at the last 3+ years, the last two bars in the same direction for at least 54% of the time (there were a handful that were flat). This is, to me, statistically significant, so you know where I'm going with this: does this give me an edge? I started looking at other instruments, both ETF's and equities, and the ratios is almost always the same: 54-57% the same direction/43-46% different direction. This is simple momentum.

Looking back at the chart, I really want to grab those moves where they move in the same direction. I have a few different ideas around this that I will test:
  • Buy on open, close at the last minute of trading day
  • Buy with a limit order, using the Close of the 15:30 for my limit price
  • Set stops at the low (if going long)/high (if going short) of the 15:30 bar
  • Use a stop loss, based on ATR or other volatility measure
This idea checks all the boxes:
  • Volume and liquidity
  • Price action
  • Profitability
  • ... and as the great Perry Kaufman would say, it satisfies my need for immediate gratification.
I have been thinking that I do not have any 'pattern' trading systems, of the type where I am using my algo to identify chart patterns (I could argue that any algo is identifying a pattern). I have played around with some of them, such as cup-and-handle, but nothing serious. I also have a set of pattern algos that were given to me a long time ago, but I have not explored or tested them. Anyhow, this is one that I've added to my idea list and is hopefully one that works.

This idea is not new for me, but this is the first time I have figured out something potentially tradable. Maybe it is my weird chart type.

One final thought: I've traded VIX futures (VX), unsuccessfully, though not for lack of trying or having a good system. At the time, I could not, for the life of me, get my orders filled (they only allowed limit orders at the time). It is nice to be able to work with the VIX, even if VXX is derivative product. Let's see what I can build from this.

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #447 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,207

As you know VXX and other VIX products invest in VIX Futures. Some/all rebalance at the end of the day. So I wonder if what your seeing is the effect of that rebalancing?

Not that it matters but its an ETN not and ETF.

Reply With Quote
Thanked by:
  #448 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853


SMCJB View Post
As you know VXX and other VIX products invest in VIX Futures. Some/all rebalance at the end of the day. So I wonder if what your seeing is the effect of that rebalancing?

Not that it matters but its an ETN not and ETF.

Thanks @SMCJB, I did not know the difference between an ETF and ETN, but now I do. It seems to have a beneficial tax treatment, but I have not figured the taxation on it yet.

I was thinking that it might have been due to rebalancing also, but the volume at the minute level is consistent up to the last minute (then you see a spike). I am using 1-minute charts for building the system, for precision. I'm looking to exit 1-2 minutes before close. I cannot imagine many people hold this overnight. I don't think I would sleep.

There are some interesting things that I noticed on Fridays, which is the day the weekly contract expires. The idea is not as profitable that day; it is profitable, but significantly less. Without limit orders, that advantage could evaporate. I will have to look at end of month next.

Just for fun, etf.com rates the liquidity of VXX by this measure:


I'll remember it next time I have one million dollars I can dedicate to a single instrument.

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #449 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853

Just to round out the discussion here, this is what the P/L for the 1st day of the month, last day of the month, and all other days look, on average (5k account size; leveraged 2:1):



The sample size is not huge (38 days each for 1st of month, last of month), but I think it's safe to say there is some significance to the first trading day of the month (it's soft). I only tested back to Jan 1, 2019, as the VXX instrument changed in 2018. I will need more data and time with this, of course.

This is a lot of work for a little profit, but it's a fairly consistent profit. I'm thinking that if I am sitting on cash or I have the purchasing power available towards the end of the trading day, this might be something I trade, though I would have to commit to it daily. For me, it is an academic exercise, as I cannot trade this short time frame.

Have a great weekend everyone!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #450 (permalink)
 
vmodus's Avatar
 vmodus 
Somewhere, Delaware, USA
 
Experience: Intermediate
Platform: MultiCharts
Broker: Barchart.com
Trading: Everything, it all tastes like chicken
Posts: 1,271 since Feb 2017
Thanks Given: 2,958
Thanks Received: 2,853


A few thoughts about bias (and data)
I did not plan to post anything this weekend, but I was working on something that highlighted how easily bias can creep into our analysis. I had observed something last night while doing analysis for my upcoming Momentum Pinball system. While looking at a signal that occurs infrequently, I kept seeing something on the chart that I thought was a pattern, one that I could exploit. I kept at it and I kept seeing it, more often than not. I felt like it was happening at least 2/3's of the time.

This morning, I decided to test my bias, to see how often this pattern appeared, using the same data set. Here is story the data told me:


The right column shows the number of occurrences of the 'pattern' I thought I was seeing, out of a sample of 100 signals. My mind was telling me that I was seeing it a lot, but the data revealed that it was happening less than half the time. This was pure confirmation bias, where my mind was discarding what it did not want to see and putting more weight on those patterns that matched what I wanted to see.

And this kids, is reason number 3247 why I develop and trade using a systematic approach.

~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~ + ~

If you are wondering why I did this by hand, here is my stock answer: I do some analysis by hand or using Excel because it allows me to get a feel for the data and also allows me time to think about what I'm doing. Think of it as an immersion program for trade analysis. This method also identify problems with a system idea that I may not find by just slapping together some code (e.g. what happens to this idea when the price gaps?). It is an invaluable part of my standard process for any new system.

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:




Last Updated on March 31, 2022


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts