Attack of the Robots - An Algo Journal - futures io
futures io futures trading



Attack of the Robots - An Algo Journal


Discussion in Trading Journals

Updated by vmodus
      Top Posters
    1. looks_one vmodus with 223 posts (453 thanks)
    2. looks_two SMCJB with 24 posts (51 thanks)
    3. looks_3 kevinkdog with 16 posts (39 thanks)
    4. looks_4 snax with 10 posts (14 thanks)
      Best Posters
    1. looks_one bobwest with 4.4 thanks per post
    2. looks_two kevinkdog with 2.4 thanks per post
    3. looks_3 SMCJB with 2.1 thanks per post
    4. looks_4 vmodus with 2.0 thanks per post
    1. trending_up 19,171 views
    2. thumb_up 631 thanks given
    3. group 42 followers
    1. forum 304 replies
    2. attach_file 82 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Attack of the Robots - An Algo Journal

(login for full post details)
  #11 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received

I was watching an old Malcolm in the Middle episode last night, Smunday, where the kids tricked their mother into thinking Monday was actually Sunday so they could stay home from school. Thus today's title.

It was a fun day for me, mostly. I was actually up late Sunday night (after 2 am), as I had a few ideas for trading that I wanted to hammer out. I was trying to see if trading Ehler's Instantaneous Trend indicator (as built into my strategy) would work for the Dow e-mini on the 120 minute chart. I did it manually using the indicator and chart data from Tradestation, in Excel. It was much of a mental exercise as anything.

That didn't come to much. It would be tradable if I avoid the ranges, which are pretty easy to identify (YMM19 1 minute chart):


The challenge that I have is calculating the range mathematically. I'm not sure if this is meaningful to anyone or not, but this is what it looks like in Excel:


It may be self-evident, but the smaller the number (or the distance between the two lines), the closer the iTrend and Trigger lines are. When the numbers go from negative to positive (crossing zero, essentially) it's a cross-over just like a moving average cross-over: indicates a change in trend. When we see the numbers close (0, 1, 2, -1, -2), then that is a tight range. I'll work through that eventually.

I modified one of my strategies to do what I was doing manually last night. Then I decided to take it a little further. I wrote and tested it as a scalping strategy on the YMM19, 1 minute chart. The rules are pretty basic:
  • When iTrend crosses over, enter a limit order a few cents above (short) or below (long) the closing price
  • Exit after 'n' bars once the entry occurs
  • Only trading this in the highest volume times: 925 to 1355 ET
I was able to get it written, tested, back-tested, optimized, and walk-forward optimized. It was promising enough, when testing on unseen data, that I just decided to activate it on my sim account, to see what it would do. I made a $10 profit (two ticks), less commission. It was only active for about an hour and the market was trending, so there were not any additional opportunities. It will be fun to see what it does tomorrow.

In other news....
My partner gently reminded me that I should be running my one strategy in sim (VX futures), so I turned it on, but noticed a problem that I think has been causing some of my headaches. If you look at this chart, you will see where I have 16 trades (these were just the strategy, not actual trades taken by the sim).



I actually only had one trade generated (the other ones would have happened before I turned on the strategy). My indicator only shows 5 cross-overs, not 16. Anyhow, that is a something I have to investigate. I think it is unique to this instrument, because of how tight the indicator can be (e.g. iTrend = 14.55 and Trigger = 14.54). If I can get this figured out within my code, then I will be in good shape.

For tomorrow:
  • Activate the simple YM scalping strategy and see what it does
  • Maybe, just maybe, fix my 'broken' VX strategy
One of these days, once I clear my backlog of other work, I will start showing some process flows for how our strategies work, at least theoretically.

See you all tomorrow!

~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:

Can you help answer these questions
from other members on futures io?
ZigZagHighLow of ThinkSwim to EasyLanguage of TradeStation
EasyLanguage Programming
Tradestation outside the US
TradeStation
Tradovate - Im trading Micro E-Mini Futures - Do I need "Market Internals" data feed?
Emini and Emicro Index
Calendar Spread on Weekly Options
The Elite Circle
Scan by comparing SMAs within 5 mins
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
182 thanks
Micro account vs Funded account (combine)
53 thanks
Are sharks watching on the other side?
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Life sacrifice loneliness trading futures
20 thanks
 
(login for full post details)
  #12 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received

Today's lesson in algo trading, on the Tradestation platform, at least, is brought to you by 'Math'. It's not just for physicists.

Whenever a client or my partner comes to me with a wildly complex problem regarding numbers and outcomes, my go-to answer is: "It's just math". So when is math not math (talking applied math here, not number theory or such abstract things)? Apparently when working with Tradestation indicators and strategies.

One of the problems I have had, as alluded to yesterday, is that I'm getting a ton of entries that I don't think I should be getting. To put this mathematically (pick your favorite):
 
Code
Strategy Value  ≠  Indicator Value
... or ...
Strategy Value  <>  Indicator Value
... or ...
Strategy Value  !=  Indicator Value
The indicator does not return the same value as the strategy, even though the code calculating the math is identical. It is possible that this is a timing issue (indicator or strategy lags by a tick or bar). I haven't worked with EasyLanguage enough to be able answer the question, 'Why'? I'm sure the problem is in how/or when the calculations occur. There are things that happen 'intrabar', but apparently even a slight delay will throw off the calculation. I drew some dashed lines on the print log from Tradestation which show the possible delay (though this is a 5 minute bar...shouldn't be that far off):


In EasyLanguage (at least the Tradestation flavor), we have a tool called ADE (All Data Everywhere), which allows us to store data in memory and retrieve it anywhere else. My solution is to simply use ADE in the indicator to 'put' the data for my two values (iTrend and Trigger) and retrieve it in the strategy. That is how I figured out what you see in the screenshot above.

I've modified my strategy to use the indicator value, as I just described. I will be back-testing and optimizing it over the next couple of days to see if I get better results. If it passes, then the usual cycle of sim testing and then production, if it passes all of our tests.

Today's Results:
  • Re-coded my VX strategy. In back-testing it performed exactly the same as it's predecessor, but I expect different results in sim tomorrow.
  • Today was a weird day for VX, as it had only one long, strong move in the morning, followed by a slow reversal. By my strategy, only two orders would have been triggered on the 5 minute chart. Normally we see 5-10 orders per day.
  • I ran my YM strategy in sim. It did horribly, which is not surprising. It did not test well through walk-forward optimization. It got killed in range. More work to do on that.
  • I played a little with with a free pivot tool from Tradestation, called Person Pivots Daily. Interesting and might have a use.
Tomorrow:
  • Sim testing the new VX strategy.
It is late, I'm sleepy. Later, yo.



~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:
 
(login for full post details)
  #13 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received


I may not be able to post later, but I wanted to report my results trading the VX (5 minute) with my revised strategy ($100 profit target):

Today's sim results (as of 2:05 EDT):
  • Four legitimate trades, $390 profit (long, short, short, short)
  • One phantom trade, $97 profit (short) >> this was part of the second short trade, but it placed an order for two contracts, rather than one....still a mystery
  • No losses
  • Just for fun and practice with the Chart Trading tool, I day traded YM 1 minute in sim, manually using a simple crossover indicator and my intuition. Made $50 in funny money. I stopped right before a $250 move started (I was hungry). There are some weird things with execution in Tradestation that I will have to investigate.
So far, so good with VX. It is just sim, but since moving from 1 minute to 5 minute charts, I'm hoping my limit orders get filled. For those just tuning in, the VX does not allow market orders, only limit orders. The wait can be excruciating.

Here is the duplicate (phantom) order from earlier:


I have no clue why that's happening, but I believe I can code around it. It is likely due to a condition hitting twice, before the first limit order was filled.

I have one more observation about the Trade Manager screenshot (above). One advantage to using limit orders for our exits, is that the exit limit order is getting placed as soon as the entry order is being filled. If you see the first two lines above, you see my buy (exit) was placed when the sell (entry) was filled. I'm guessing that this will give the order a higher priority than if it were placed later. It could explain why when I was trading that my exits were getting filled a lot quicker than my entries.

I will evaluate my profit target later today/tonight, as $100 may be too conservative for a 5 minute chart ($100 = 2 ticks, if you will). I'm guessing $150-200 is probably reasonable. I will say that the VX is definitely not the easiest instrument to trade. If I can master it, then I think it will serve me well.

Tomorrow:
  • Keep running VX sim
  • Will not day trade YM in sim; that is just not where I am right now with my trading

Until next time....

~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:
 
(login for full post details)
  #14 (permalink)
Legendary Market Wizard
Chicago
 
Experience: Beginner
Trading: MYM, MES, YM, ES
 
snax's Avatar
 
Posts: 1,194 since Feb 2019
Thanks: 5,025 given, 4,412 received


vmodus View Post
I may not be able to post later, but I wanted to report my results trading the VX (5 minute) with my revised strategy ($100 profit target):

Today's sim results (as of 2:05 EDT):[LIST][*]Four legitimate trades, $390 profit (long, short, short, short) [*]One phantom trade, $97 profit (short) >> this was part of the second short trade, but it placed an order for two contracts, rather than one....still a mystery[*]No losses

~vmodus

Nice work, @vmodus!

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to snax for this post:
 
(login for full post details)
  #15 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received

Two things and I'm done for the day (Liverpool and Barcelona are playing... priorities you know).

1) One additional trade by my VX strategy, +$98 profit. It was a perfect day for the strategy (100% wins). It's sim, so we shall see how things go. I won't go live until I fix my 'extra order' bug.

2) I was looking at the 1 minute YM chart when the Fed news broke at 2pm today, and this falls under the "Hey kids, don't trade the news!" department:


I just thought it was hilarious to see how people initially reacted to the news. 50 point swing in the first minute ($250), 120 point swing in twenty minutes ($600). There are a couple of trades that I would have taken (@1352 long, and reverse @1429 to short position, out by 1454), if I had continued my day trading exercise from earlier. This makes me think about short term discretionary trading opportunities around other news events. I will explore other significant dates and events for non-algo trading.

Later on!

~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:
 
(login for full post details)
  #16 (permalink)
Denver Colorado/USA
 
Experience: Intermediate
Platform: SierraChart
Broker: AMP
Trading: Bonds
 
LittleFinger's Avatar
 
Posts: 105 since May 2017
Thanks: 112 given, 123 received


vmodus View Post
This makes me think about short term discretionary trading opportunities around other news events. I will explore other significant dates and events for non-algo trading.

I've considered starting a database of previous news and econ events for backtesting. From watching the market react to the Fed over the last couple years I believe there is an exploitable pattern.

I wonder what some good sources for this information are. I usually use Forex Factory, but I'm sure there's some other alternatives.

Reply With Quote
The following user says Thank You to LittleFinger for this post:
 
(login for full post details)
  #17 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received


LittleFinger View Post
I've considered starting a database of previous news and econ events for backtesting. From watching the market react to the Fed over the last couple years I believe there is an exploitable pattern.

I wonder what some good sources for this information are. I usually use Forex Factory, but I'm sure there's some other alternatives.

I was thinking earlier today that I may have my assistant put together something. I know money.cnn.com usually has a weekly list of events (earnings, Fed notes, ADP reports, unemployment, etc.). If I could know the time and day of each of those, then I could easily back-test those. The important ones are the events that people tend to react/over-react to.

I did something similar with holidays and I actually built a function that my strategies could use that would avoid trading around certain holidays. It also helped in back-testing, avoiding holidays.

I'll post it here on FIO if we come up with anything.

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #18 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received

Hello all! Today was just a weird, weird day. As I mentioned and planned yesterday, I ran the revised VX strategy on our sim account today. It was scary good. Rather than get into too much detail, I'll just lead with my chart:


Results:
  • I don't know how many trades the strategy took. I stopped counting at noon. (feel free to count in the chart above)
  • Total P/L after commission: +$3,161
  • No slippage, as these are all limit orders
  • I had a few losses, and the day actually started off with some give and take
  • I do not have the final win/loss ratio, max drawdown, etc. I will calculate when I have more time or delegate it.
  • My automated exit did not go as planned, so I had to manually exit
  • My duplicate order checker did not work (described in prior posts); I will have to manually monitor this strategy until I can get a working solution.
  • As a result, I did hold two contracts for a short time, which I manually exited
Other Observations:
  • This market almost always has the daily high or low around noon (the chart above shows this perfectly). Yesterday was an exception, as the market reacted to the 'non-news' news event from the Fed meeting. This presents a potential trading opportunity. I have to go way back and see how well this theory holds up over the past two years.
  • As a result of yesterday's late action, I expected higher volume day, which we got. This probably had a lot to do with our good results.
  • Tradestation is still a pain in the butt. I had to totally hack the installation on my other computer so that I could free up my regular workstation for other, non-trading tasks. I was late into the market by about 10 minutes. I actually had to dig into the registry and manually purge a bunch of files.....ugh.
Reality Check:
I don't expect these type of results live. If I can pull $200 per day from this market, that would be just fine (for the account I'm trading). My goal is actually very modest for this month: ~ $79 / day. My bigger goal is actually to have a fully automated system, so that I can focus on other things (more algos, coding some indicators and functions, etc.). It was a goal I set for myself last month, but familial responsibilities took precedence the last two weeks of April.

This strategy appears to work well in a volatile market, or more specifically volatility in the S&P 500. Here is how I understand it:

S&P 500 >>>> S&P 500 Options >>>> VX Futures

If S&P 500 is highly active, so too will the VX be active.

Tomorrow:
  • Run the strategy live from 9:25 to 10:30 EDT
  • Assess the results against the strategy report
  • Decide to continue or pause the strategy

I can tell you right now, I could not trade the VX as a discretionary trader, at least in the 5 minute timeframe. It moves so slowly that it is nerve wracking. This is a big advantage of automation: being able to walk away and come back later. I would probably only attempt that as a swing trader, taking the two or three big moves per day that this market offers.

I have a ton of other work, so I gotta roll. Good thing I just had to watch the strategy today.

Have a good night and I'll see you all tomorrow!

~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:
 
(login for full post details)
  #19 (permalink)
Legendary Market Wizard
Chicago
 
Experience: Beginner
Trading: MYM, MES, YM, ES
 
snax's Avatar
 
Posts: 1,194 since Feb 2019
Thanks: 5,025 given, 4,412 received


vmodus View Post

Results:
Total P/L after commission: +$3,161

Reality Check:
I don't expect these type of results live.


I can tell you right now, I could not trade the VX as a discretionary trader, at least in the 5 minute timeframe. It moves so slowly that it is nerve wracking. This is a big advantage of automation: being able to walk away and come back later.

~vmodus

Wow, @vmodus that is terrific. Don't sell yourself short though, sure today was more volatile than recent days but do you have any hard evidence that says you can't make 20-30% of this on less volatile days? I really like the progress you're making! You're making me more interested in automated trading

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #20 (permalink)
Legendary Market Wizard
Somewhere, Delawhere, USA
 
Experience: Intermediate
Platform: TradeStation,Sierra Chart
Broker: Tradestation Securities
Trading: My kids, VX, Eurodollar
 
vmodus's Avatar
 
Posts: 637 since Feb 2017
Thanks: 1,224 given, 1,210 received



snax View Post
Wow, @vmodus that is terrific. Don't sell yourself short though, sure today was more volatile than recent days but do you have any hard evidence that says you can't make 20-30% of this on less volatile days? I really like the progress you're making! You're making me more interested in automated trading

Thanks for the kudos and encouragement. We have had nothing in 12 years that has come close, though my partner trades a very good CL strategy. I have only been active for the past several months in the business, but as I mentioned early in this journal, I'm lazy, so I write code to do the dirty work.

The walk-forward optimizations for this strategy all pass, it works pretty much with a wide set of parameters. I could probably pick a few random numbers within a range for each of the three critical parameters, and still be profitable. It probably explains why the WFO is working so well....even with random data thrown in, it cannot find a bad set of parameters. These are the run results from last night:


I think the one thing that sets this apart from prior iterations of this strategy, is that I optimized a parameter in a way that was not intended (as the late, great Bob Ross would say, a 'happy little accident').
  • The parameter tells us what amount to set for our limit entry price.
  • Normally you want to set it at any value above 1, otherwise you're entering a worse price ( 1 = 100%, 1.1 = 110%, .9 = 90%).
  • This crazy strategy actually performs better when using a number less than 0% (in my case I think I'm using about 90%). It's basically a multiplier for determining the entry price. I don't know why this works, but that is the way it is.
Last week, when I tested the 5 min chart in sim and live, any value greater than 1.0 did not perform as well. I must have been feeling whimsical when I decided to optimize that parameter lower than intended, after all of my code changes. Apparently that was the thing that took this strategy over the edge. Here is the Monte Carlo analysis I just ran on the 'ideal' parameters.


So according to this run, there is a 100% chance that it will produce at least 2852% return on initial capital ($10k account) The general thought is that if a strategy passes a Monte Carlo test, then it is likely to work. I have tested strategies that passed back testing, but failed Monte Carlo and guess what? They failed in sim.

Again, this will come down to whether orders get filled. The more liquidity, the better. Today was at about 30% above average volume. Tomorrow should provide some proof. I'm with you. If I can get to 20-25% live, then I would be good with that. Then I can tackle some other beasts, like ES (that's my holy grail). Incidentally, this strategy probably would not work anywhere else.

I am excited to try this out tomorrow, but my feelings are tempered. We have had so many wonderful 'grail' type strategies that just didn't work out live for different reasons (execution, fear, doubt, etc.). Though, truth be told, we haven't had one quite like this.

cheers,
~vmodus

Visit my futures io Trade Journal Reply With Quote
The following 3 users say Thank You to vmodus for this post:


futures io Trading Community Trading Journals > Attack of the Robots - An Algo Journal


July 10, 2020


Upcoming Webinars and Events
 

Relative Rotation Graphs w/Julius de Kempenaer

Elite only
 

Every journal equals ten meals for the hungry

Now
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts