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

  #331 (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

Not much to report for today. I'm holding out until Sunday night to restart live trading. It is driving me nuts, but I can hold out.

In the meantime, I am running forex simulations and they are working well with the given algo. My pairs are AUD-USD, GBP-AUD, GBP-USD, and USD-CHF. One (minor) problem I have is that if I start a strategy in MultiCharts, it enters a position as soon as I turn on strategy automation. The position is in the correct direction, but the timing of the entry is wrong. I don't want to take a position until the first signal, not enter on an old signal. I just don't know how to fix this problem in MultiCharts, but it is costly if I do not pay attention to it and work around the problem when necessary.

I can prevent or work around this problem easily by:
  1. Starting trading Sunday night, as I usually do (I do not hold positions over the weekend), or....
  2. Start trading at midnight (I have a trade start date parameter), or....
  3. Add a start time to my code, that will only start trading after a given time and date combination
I will probably just stick with #1, as this only is an issue when starting a strategy mid-week.

No pictures or charts today. See you tomorrow!

~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?
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
 
  #332 (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

I am kind of late on any journal entries, but here goes....

Live trading
Rough start to the week with lots of channels. Currently working only metals right now (HG, MGC and SI). I made one major error on Silver, in that I was running my strategy on the wrong month. I couldn't figure out why it failed so miserably, but I let it run until it hit the circuit breaker (max drawdown for that instrument). It took me a full day to figure out my error. This is my punishment for taking vacation and forgetting where I was. I should be starting silver again when the next session opens. I have some lost ground to make up.

I plan to diversify starting September 1st, by adding an index or two.

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

The Future
I'm looking down the long lens of trading until the end of the year and I see a lot of opportunities. Precious metals trading at/near highs and the indexes trading at/near highs does not really jive, to me at least. I think one of the two groupings is a bubble, but I may be wrong. This may be a new paradigm, so I won't assume anything. Whatever happens, I want to be ready if/when the bubble pops.

I expect Sept and Oct to be huge months, with lots of opportunities. June-August have typically been horrible trading months for me, but I did okay this year. This is an election cycle, so the ride should be bumpy, but fun if you're ready for the ride.

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


Forex Shenanigans
I continue working with testing of forex. For the most part, it has been a bust in practice (sim) testing. Profit factors have been less than 1.2, but I have not even been profitable when factoring in the human element (me) . I was able to establish reliable back test results, which confirm my practice trading. In other words, it is dead.

I have one more promising strategy that passes my backtest criteria and matches forward testing in the practice account. I am going to run this for a while.

Oanda has been a dream to work with. Support is very responsive and helpful (imagine!). I expect our account (corp) to be approved today or tomorrow. The application process, when compared with IB, has been a dream. We completed an application with IB, but they were a pain to work with and we had constant data disconnection issues (>6 per day), so we cancelled our application and tested out Oanda. Oanda's personal versus corporate account process is different, with the former being much easier and quicker, and the latter being a bit more involved. For both (I went through both application processes), the process was clear and concise. Approval for personal was within an hour; application through approval for a corporate account has taken about 5 business days.

With Oanda, I love being able to export all simulated trades directly from their website. This has been greatly useful to me in analysis, especially with trying to estimate and manage spread costs. I have found that their commission + spread pricing is probably the most cost effective, when compared to spread only.

Here is a chart I've been looking at today, since I have been stingey on pictures lately:

Forex USD/JPY Kagi


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

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:
  #333 (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


Not much to report. I have been way too busy to journal. Diversification has been a lifesaver this week. We have made and lost money in the indexes, and lost and made money in metals. I was a little slow to get started this week (wearing too many hats), but I probably should have started trading the Tuesday session, rather than starting later. Despite the holiday, I'm excited to start up Sunday night again.

I am quoting myself from last week:

Quoting 
I'm looking down the long lens of trading until the end of the year and I see a lot of opportunities. Precious metals trading at/near highs and the indexes trading at/near highs does not really jive, to me at least. I think one of the two groupings is a bubble, but I may be wrong. This may be a new paradigm, so I won't assume anything. Whatever happens, I want to be ready if/when the bubble pops.

I expect Sept and Oct to be huge months, with lots of opportunities. June-August have typically been horrible trading months for me, but I did okay this year. This is an election cycle, so the ride should be bumpy, but fun if you're ready for the ride.

I hate to tell you I told you so, but....

Just kidding. Judging by the past two days, this is already shaping up to be 'one of those months'. I don't think anyone who has been around long enough is terribly surprised. Hopefully everyone is trading well and safely.

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

My Current Challenge
I actually feel like I am growing up, as a trader. I've been trading for a very, very long time, but never like this. I am at a point where I have some strategies that work when the conditions are just right. The big challenge is identifying which instruments will have the highest probability of being profitable with our current algorithms.

Since we are intraday swing traders (for the most part), we shift with the prevailing winds. I had the opportunity to sail with my brother, wife and kids a few weeks ago, and the sailing analogy really works here. The wind shifts just a little, so you adjust your sail accordingly. Sometimes you have to tack in a different direction. That is where I am right now.

So the plan is to evaluate a set of instruments, most likely after market close, and decide if we need to adjust, then be ready for the open again at 1800 ET. Ideally this will be a weekly exercise, as I prefer to let a strategy cycle a full week. This has proven to be the best approach thus far.

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

That's it for the week. Next week should be super fun. Have a great weekend everyone and stay safe!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #334 (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

I've been mostly silent this week because I have been heads down in learning how to include order macros in my strategies. I have several strategies that require me to put in stop limit orders, but that is not possible using just the normal 'buy' or 'sellshort' commands. This has been a problem for me for at least a year. I have strategies that I want to use stop limit orders with, but have not been able to write.

Which brings me to the order entry macro: .PlaceOrder. I have been trying to figure this out for a long time, but was just frustrated. So I read whatever I could find on the subject, mainly on the TS/EasyLanguage community forums. Initially it just didn't work, but I kept working at it and eventually I got it working for the order types that interest me.

So now I am testing away happily. This is a Swiss Army knife strategy that I have been working on for over a year, but could never implement. I have manually tested this on hundreds of trades with about a dozen different instruments (a labor of love), but I will now be able to incubate (via sim) and eventually deploy. Right now I have to do some work on order management (canceling old order, etc.).

The downside of using macros is that I will not be able to properly backtest this, in the traditional way, so I will need to develop a method for backtesting. Fortunately, that is the easy part of this exercise and I already have a method mapped in my head. I will use EasyLanguage and just write to a file when entry/exit conditions are met.

Two things to do:
  • Fix order handling (extra orders, canceling old orders)
  • Write a backtest 'strategy', which is really just a glorified indicator/study
After that, on to testing!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #335 (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 a little addendum....here is how I call the code from my strategy:

 
Code
Value5 = StopLimitOrder("OncePerBar",SIM123456F,"Sell","Future",
"NQU20",NumberOfContracts,"Day","",MyStopPrice,MyLimitPrice);
In plain English:
Place a stop limit order, short, once per bar, on account SIM123456F, for symbol NQU20, for "NumberOfContracts" (how many contracts I am trading), with MyStopPrice and MyLimitPrice.

The weird thing I ran into is that the 'Action' parameter ('Sell' in my example) for going short is 'Sell' and not 'SellShort'. 'SellShort' failed every time. Once I got around that problem, I was golden.

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #336 (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

Oh geez, what a week. I finally tackled a beast of a strategy that I probably should have written a year ago. It is a simple swing strategy, but fairly complex in that I need to send stop limit orders from EasyLanguage, at least in the normal way. They provide OOEL, or Object Oriented EasyLanguage, which allows for complete control over the process. So I spent a better part of this week learning how to send and cancel orders. I wrote a strategy to manage the whole thing and spent the last 23 hours testing it against multiple instruments in SIM. I found and fixed some bugs, and learned a lot about the process.

In learning, I found that my previously mentioned StopLimitOrder (part of the .placeorder macro), should not really be used anymore, according to the TradeStation engineer who was assisting me. So after learning all of that, now I am onto learning OrderTicket and ReplaceTicket. It is very powerful stuff and I should have learned a long time ago. I already have a little experience using OrderTicket, thanks to @kevinkdog, with canceling unwanted orders, so now I am extending this into order management.

Here is the code snippet for canceling orders (not for use with continuous contracts):
 
Code
OrderTicket.cancelallorders(this_account, rightstr(this_symbol,strlen(this_account)), true);
Apparently there are some distinct advantages in using the OrderTicket functions, as orders are sent to the TradeStation servers, whereas just using the regular buy/sell functions only sent when they occur. I think this takes advantage of FIFO, which works out nicely for us, since our orders may not be filled for several bars, so order fills will be improved. There is also the matter of synchronous versus asynchronous order management, which I won't try to explain here. I've been dealing with this a little in MultiCharts. For my purposes, I am (attempting to) manage all of this via my code.

One of the weird things about coding strategies with OOEL is: you can code it all in an indicator/study (TS actually recommends it), rather than a strategy. It is mind bending, but makes sense in a way. After all, code is code and some of the strategy features are not used.

The main disadvantage is the inability to backtest. For the current strategy I'm developing, I had to code a similar strategy to just record my entries and exits, then dump it into Excel. Fortunately, I already have a workbook in which I do my manual testing of ideas. I like to do things by hand so I gain a very deep understanding of my idea and all the nuances of my idea. I can just drop my entries into the various instrument worksheets and see the results. The other disadvantage is the inability to optimize, but I work a lot with strategies that don't require optimizations so that is not a huge issue.

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

This is one of the charts I was looking at for the past couple days. I like Kase bars for a variety of purposes, not the least of which is that they offer some of the benefits of charts such as Heikin-Ashi or range bars, but with real open and closes. This makes them ideal for strategy development, backtesting and optimization.

Kase Bars on NQZ20, with William's Fractals and Fisher Transform


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

That's all for this week. Dinner and drinks await!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #337 (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

Well, it has been an interesting few days. I have had to mostly work on non-trading work, but I have filled what little free time I have had with learning what I can about OrderTickets and OOEL (Object Oriented EasyLanguage).

I searched and found the most interesting post on the TradeStation forum (you must have a TradeStation forum login to view):

https://community.tradestation.com/Discussions/Topic.aspx?Topic_ID=157846

One of the folks over there has written an example strategy using OrderTickets. I have been experimenting with it and learning how it works so that I can eventually implement the ideas into the strategy I'm developing for this. I have been able to successfully send, replace and cancel orders, as well as keep a record (writing to a text file) of everything that is happening. I am extremely grateful to Tom47 over there for sharing.

Here is a snapshot of the code I was using to replace the prices on a stop limit I had created and was received, but not filled:

Code to Replace


Replacement Confirmed


That's all for now. I won't post again until Friday. Until then, happy trading!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #338 (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

I've been busy on some other things, so journaling has definitely not been a priority. However, here are a couple things I cooked up.

I have been learning the Kaufman Adaptive Moving Average, a/k/a KAMA, a/k/a Adaptive Moving Average. This is a very interesting moving average that speeds up when in a trend and slows down in consolidation. I like to see when the direction of an indicator changes, so I will modify an indicator to change color. I did this with TradeStation and MultiCharts, and posted over in the download section.

Color Changing KAMA


Check out the download section:




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

That is about it. I am still trying to work with OOEL, but I have other priorities right now. For now, happy trading everyone!

~vmodus

Enjoy everything!
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #339 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,172 since Jan 2013
Thanks Given: 57,524
Thanks Received: 26,292


vmodus View Post
I have been learning the Kaufman Adaptive Moving Average, a/k/a KAMA, a/k/a Adaptive Moving Average. This is a very interesting moving average that speeds up when in a trend and slows down in consolidation. I like to see when the direction of an indicator changes, so I will modify an indicator to change color. I did this with TradeStation and MultiCharts, and posted over in the download section.

It's very interesting to read a post on variable moving averages. I'll be interested to see what use you make of it over time, assuming you find it worth pursuing.

The adaptive ma's are all interesting. There are a bunch of them, but I believe that Kaufman was the first to write about the concept (I could be wrong about this.)

They all have to do with adjusting the smoothing constant in an EMA based on some measure of present volatility (so it's a smoothing variable, not a constant.) Doing this makes the ma act like a long-term average when price is not going anywhere much (so it flattens out -- doesn't change much over time), and like a short-term average when price moves quickly.

Others I know of off the top of my head are the VMA (sometime called Vidya Moving Average), adxvma, and John Ehlers has one based on his cycle concepts (I forget which of his books it's in.) There may be more.

Sierra Chart has a Vidya and an adxvma in the User Contributed Studies. I haven't really done comparisons with KAMA, but I have worked a lot with Vidya. The logic is dead simple if you wanted to port it to TS or MC, assuming they don't have it already.

I confess I eventually went back to regular ma's (seeking simple charts for discretionary trading), but I think a variable ma would be very interesting for an automated strategy, because it removes the judgment factor in the "is it trending or not?" question.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
Thanked by:
  #340 (permalink)
 
AllSeeker's Avatar
 AllSeeker 
Mumbai, India
Legendary Pratik_4Clover
 
Experience: Beginner
Platform: TradingView & ZerodhaKite
Trading: NIFTY, BANKNIFTY
Frequency: Daily
Duration: Minutes
Posts: 1,426 since Jan 2019
Thanks Given: 5,249
Thanks Received: 5,014



vmodus View Post
I've been busy on some other things, so journaling has definitely not been a priority. However, here are a couple things I cooked up.

I have been learning the Kaufman Adaptive Moving Average, a/k/a KAMA, a/k/a Adaptive Moving Average. This is a very interesting moving average that speeds up when in a trend and slows down in consolidation. I like to see when the direction of an indicator changes, so I will modify an indicator to change color. I did this with TradeStation and MultiCharts, and posted over in the download section.

Color Changing KAMA


Check out the download section:




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

That is about it. I am still trying to work with OOEL, but I have other priorities right now. For now, happy trading everyone!

PKAMA is pretty good, might want to also check out MAMA and FAMA.

//Side note, reading that again sounds so weird, but I'm just messenger, their inventors named them like that



Will look forward to what you come up with those three

Visit my NexusFi Trade Journal 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