Dr. Toad's Journey to Bankruptcy or Financial Freedom

The TS forum is very active with educational webinars and documents:

http://www.tradestation.com/education/university/getting-started

and with a very helpful forum with loads of coding examples and advice from both other users or the TS staff who will correct coding for you

https://community.tradestation.com/Discussions/

Charlton

Thanks for the input as well as those links Charlton. I'm working my way through the TS manual and translating my programming intent into the language. Seems to be a pretty straightforward language so far, but I suspect when I compile and test run it in TS I will be doing some system debugging. It is good to know the staff is willing to help debug as from my limited programming experience I know that is one of the most frustrating and time consuming parts.

I was hoping you would weigh in at some point as your name came up a few times when I was combing through this forum looking for topics about automated trading and TradeStation. Are you trading (or have you ever traded) with a fully automated system? If so, is there anything in particular I need to look out for with a completely automated system?
 
Thanks for the input as well as those links Charlton. I'm working my way through the TS manual and translating my programming intent into the language. Seems to be a pretty straightforward language so far, but I suspect when I compile and test run it in TS I will be doing some system debugging. It is good to know the staff is willing to help debug as from my limited programming experience I know that is one of the most frustrating and time consuming parts.

I was hoping you would weigh in at some point as your name came up a few times when I was combing through this forum looking for topics about automated trading and TradeStation. Are you trading (or have you ever traded) with a fully automated system? If so, is there anything in particular I need to look out for with a completely automated system?

Start by looking at some overviews of what is involved:
http://www.investopedia.com/university/systemcoding/

http://www.wpi.edu/Pubs/E-project/A...ed/Interactive_Qualifying_Project_Group_5.pdf

Try to formulate your trading plan into a logic flow diagram:

http://www.ciese.org/pathways/rwlo/...g RWLO/How_to_Create_a_Logic_Flow_Diagram.doc

http://it.toolbox.com/blogs/enterprise-solutions/using-logic-flowcharts-15950

Try to break down the complete strategy/plan into parts (each with their own logic diagram) e.g:

  • Assessment of market sentiment
  • Deciding which instrument(s) to trade
  • Entry criteria for trade
  • Exit criteria for trade
  • Assessment of risk

This is just a starter - break down as you wish. I will return to this another time to explain its relevance to how an automated trading system can be created and how this approach starts to get you into the coding mindset, but I have more pressing matters right now :cheers:
 
@Charlton thanks for the input. I think I may be a little ahead of where you think I am at this point though. I believe I have successfully translated my system intent into EasyLanguage. I am going to walk through my developed code a few times in the next day or so as an initial proof of it to check for errors or possible flaws...hopefully all of which will show up in backtesting and paper trade testing if present at all.

I am unsure of a couple of items I have coded though, and if you (Charlton) or anyone else is familiar with EasyLanguage, I would be grateful if you can answer these questions:


1. In sizing my position I am using the Round() function to try and round my position to the nearest 100. I was unable to find any documentation or examples that answer my specific question which is:

Can a negative precision be specified to round before the decimal (as can be done in excel). For example, the code that I think should round to the nearest 100 is:
Code:
LiquidShares = Round(Volume[1]/4, -2);
In that particular snippet I am trying to round 25% of the previous bars volume to the nearest 100 as a check for the immediate liquidity of the stock. Is that code the appropriate way to do it?

If not, it is easy enough to change by dividing by 100, rounding, then multiplying by 100 a la:
Code:
LiquidShares = 100*Round(Volume[1]/400, 0);
It just isn't as clean so I would rather not do that unless a negative precision is invalid.


2. I am not sure my way of sending my stop limit order to the order book is valid. Currently I am doing this as follows:

Code:
StopLimitOrder(“Once”, GetAccountID, ”Sell”, ”Equity”, GetSymbolName, PositionSize, ”Day”, ””, StopLoss, StopLoss – 2*AvgTrueRange(4));

Basically what I am unsure of is if variables (built in like GetAccountID as well as user specified like PositionSize) can be specified in the StopLimitOrder function as I have done. The only example I found is for a specific order, not one based on variables.


I have just done some googling on it and looked at the EasyLanguage variables book and didn't find my answers. Haven't looked through the forum link yet, but I will do that if this goes unanswered for a while and I am unable to troubleshoot it when I begin my testing.
 
Not that anyone really cares I suspect, but as a small update:

It took me a while to transfer funds and open an account with TradeStation (no dig on them, just had to wait for funds to settle in my other account, apply for the account, etc.), but I got up and running last Saturday. I am in the preliminary stages of automating Mr. Charts system. From reading further into the thread and some initial testing it became very clear to me that the ranging criterion I set earlier is not what is needed for the system. Instead it appears to be more enter long only if it is a high of the day, enter short only if it is a low of the day.

I have reworked the system a bit and will post some resulting trades from the system along with Mr. Charts trades. There are several issues with the system currently, the main one being it way overtrades, so there are more filters that need added. I believe the first step is to pick up the trades Mr. Charts gets, and the system currently seems to be picking up on them somewhat well.

10-29-15 - NXPI - Mr. Charts:


10-29-15 - NXPI - System v0.1:


11-2-15 - MYL - Mr. Charts:


11-2-15 - MYL - System v0.1:


11-4-15 - KORS - Mr. Charts:


11-4-15 - KORS - System v0.1:


11-5-15 - QQQ - Mr. Charts:


11-5-15 - QQQ - System v0.1:


11-5-15 - RIG - Mr. Charts:


11-5-15 - RIG - System v0.1:


11-5-15 - BABA - Mr. Charts:


11-5-15 - BABA - System v0.1:



The MYL KORS and QQQ charts are pretty good examples of the overtrading, but it is really more spectacular than that on occasion. There are some bugs I need to chase down like entering and exiting after exit on an exit candle - see KORS and MYL, occasional invalid entries at the beginning of the day - see MYL. Once I chase those down I will start looking at adding some more filters...I suspect something with the EMA(10) is a good place to start as it is on all of Mr. Charts newer posts.
 
. . . Once I chase those down I will start looking at adding some more filters...I suspect something with the EMA(10) is a good place to start as it is on all of Mr. Charts newer posts.
Hi Dr. Toad,
I expect you've done this already - so I apologize in advance if this is the case - but it might be worth your while adding an ATR filter and, if possible, a spread filter. Very high ATR readings can be accompanied with spreads greater than $0.01. From memory, I think Richard tends to shy away from these. As I mentioned previously, in your shoes I'd ask him directly as he's the best person (obviously!) to advise you on what filters to include / exclude.

Anyway, very well done on your progress and I'll keep my fingers crossed you can iron out the remaining bugs.
Tim.
 
it might be worth your while adding an ATR filter and, if possible, a spread filter

I was thinking about the ATR last night when I posted. I am not so sure it always is a valid filter actually. The reason being that in the first 13 increments of the chart (minutes in the cases above), it won't be completely valid (if using ATR(14)) simply due to the definition of it. This may be why Richard includes pre-market in his charts...you can get 14 periods that way, but the pre-market is so dead usually that I'm still not sure it would really be valid to use it.

You can clearly see what I am talking about with the NXPI charts. Our ATR's are different since mine is essentially reset at the day and his includes pre-market. The ATR on Richard's is above $0.50 in that case (mine well above $1.00 and which one is "right" depends on how you say tomato), which is exceptionally large for a 1 minute chart and in Richard's case includes the dead pre-market in the determination. If the ATR were an absolute filter he used than this one would have most certainly been excluded. I have it on the questions I plan on asking him though since I also thought it was used to filter out like you do.

The spread filter is something that I have, but it is not possible to include in backtesting (no historic values of spread). That likely will filter out some of the overtrading I see in backtesting but probably not the majority of it. When I get to the paper trading stage I will be able to see the effects of this filter/tweak it.
 
In your shoes Dr. Toad, given that you're trying to model Richard's methodology, I'd say tomato whichever way he says it!
;)
 
I'll keep my fingers crossed you can iron out the remaining bugs.

Didn't want to tie up your fingers for too long Tim. Bugs squashed.

11-2-15 - MYL - System v0.2:


11-4-15 - KORS - System v0.2:


Don't be confused by the different times...haven't really bothered to set up my defaults in TradeStation yet so it defaults to my local time instead of market time.

After squashing those bugs (and very limited backtesting) the system seems to be hovering around break even with trade commissions and fixed position size which is a good sign. Trade success rate hovers around 35%. I recall Richard mentioning his trading of this particular system was somewhere around the 65-70% range so I am shooting for above 50% with the indiscriminate backtesting before moving forward to simulated trading of it.

On to studying some of Richard's charts to see if I can spot some additional potential filters for this.
Initial thoughts:
- Time filter (don't trade after xx:xx)
- ATR
- EMA(10)
- Some velocity filter than can approximate Time and Sales (and Volume) information
 
Hi Dr. Toad,
It's many years since I traded U.S. equities - so please take any comments from me with a bucket of salt . . .
After squashing those bugs (and very limited backtesting) the system seems to be hovering around break even with trade commissions and fixed position size which is a good sign.
I don't know Richard's view on fixed position size, but I do know that from my experience this is extremely difficult to apply to U.S. equities. Assuming you have a maximum loss per trade of say, 2% equity then, to a greater or lesser extent, this will determine the placement of your stops. In other words, it severely restricts your ability to use the stock's volatility to determine position size and stop placement that's a 'safe' distance from your entry. Had I not been able to do this, I'd have blown up my account for sure. I imagine you understand these relationships well enough, but if you want a refresher, this article by Paul (Trader333) explains it very well: Position Sizing as an Approach to Risk Management

Trade success rate hovers around 35%. I recall Richard mentioning his trading of this particular system was somewhere around the 65-70% range so I am shooting for above 50% with the indiscriminate backtesting before moving forward to simulated trading of it.
Hmm, 35% is pretty low. If the entries are good then, presumably it's the exits that are letting you down?

On to studying some of Richard's charts to see if I can spot some additional potential filters for this.
Initial thoughts:
- Time filter (don't trade after xx:xx)
- ATR
- EMA(10)
- Some velocity filter than can approximate Time and Sales (and Volume) information
Time
For this method, I'd say most of his trades are between 10.00am and 12.30pm U.S. time with some in the evening session. I think he tends to avoid lunchtime and the first half hour in which he focuses on momentum plays.
ATR
This is pretty central to his methodology and, as I've said above, vital for determining position size and stop placement.
EMA(10)
Longs above and shorts below - but that goes without saying!
T&S
From memory, I think Richard says this isn't a key ingredient for this particular method, but if you can utilize it effectively - good on you.
Tim.
 
I don't know Richard's view on fixed position size, but I do know that from my experience this is extremely difficult to apply to U.S.

Along the way I read something to the extent of unless he has good reasons not to, he generally uses the same size on all trades. That was pretty early in the thread if I remember right but...

I have no intent on fixed position size. Initial plan is to use a three pronged approach:
1. Max risk based on initial stop (placed by atr or last candle extreme + small wiggle room)
2. Immediate liquidity of the stock (no more than 25% of shares traded the previous bar)
3. Available margin (may become a factor on lower priced stocks or very tight stops)

Hmm, 35% is pretty low. If the entries are good then, presumably it's the exits that are letting you down?
I have not looked at this closely yet. My first task was to match Richards entries. Now that I have done that I am looking at ways to limit the trades taken without cutting the valid ones out. I highly suspect that the overtrading is occurring on days where the stock is moving slowly but steadily up or down. Having a short list of stocks going into the day like Richard does combined with a velocity filter of some form and/or a time filter will likely prevent entry and overtrading in these situations.


Right now my main focus is on bringing the win percentage of the system up. I am not so much concerned with the profitability yet as I haven't looked much at position sizing and money management effects on the system. The main reason I mentioned it previously is because when I started this I was not convinced the system had any merit...often what looks good on paper does not produce.

Since the system is producing break even without even a short list of stocks or any real attempt to prevent overtrading with money management on a larger timeframe than per trade, I am now about 75% convinced that Richard is for real and this system is actually not to good to be true.
 
Last edited:
In an effort to help eliminate trades Richard does not enter in according to the rising/falling candle system I have begun going through the trades he posts on his site and seeing if my system generates the trades he does and also avoids the ones he does.

One issue I believe I have with my current system is I need different rules for the opening few minutes as opposed to later on.

From 11/18/2015 - Testing with System v0.3:

This selection likely driven by past success:


I believe I need to add a second entry criteria for very rapid price changes in the opening few minutes.

This selection likely driven by gap up:


Invalid entry in opening few minutes.


The following should not necessarily have produced valid trades:

This selection likely driven by gap up:


Again, issues with the opening few minutes...second trade may very well have been valid under the system.

This selection likely news driven:


I have one filter programmed that can eliminate these. I do not have the tolerances set to do so in this case though since it would likely make it to restrictive. I will know with further testing, but seeing this I have an idea for another filter to eliminate these trades that I do not think will remove any valid trades. This will also eliminate the need for a filter I currently have in the system. Programming that filter is my next task.
 
As an update:

What I have done to this point is look at "good" trades that Richard has posted and try to discern some filtering criteria to exclude a lot of the extraneous trades without taking these out. Doing this, I have coded many filters and exceptions to entry which is useful, but is much like throwing darts at a dartboard with a blindfold on. Sometimes you hit the wall, sometimes you hit the board, and just maybe eventually you hit the bulls-eye. But...it's going to take a lot of darts to hit it doing it this way.

So, in an effort to remove the blindfold, I am taking a step back and instead now looking at good trades within the trade management criteria (follow trade with stop on previous candle extreme) instead of primarily the ones Richard posts. I will then look a few minutes prior to the good trade occurrences and try to discern some commonalities between a statistically significant number of them. I will then try to design filters to exclude the majority of the entries that fail.
 
The elusive good trades can no longer hide from me. I believe I have created the ultimate hindsight trading signal...IT WILL NEVER BE TOPPED!



This small victory is mine, hurrah. Now to find some commonalities.
 
Long time no update, so as an update:

I have put my strategy development for the "rising/falling candles" technique on the shelf for now. I have played with it enough to convince myself of two things with high certainty:

1. This technique is not possible without Time and Sales.
2. Trying to develop my first positive expectancy system using 1 minute candles is foolish.

I have a few ideas on how to approximate Time and Sales but decided to chase down a different strategy for a while before dedicating more time to this one since I feel like my progress at this point with this particular strategy has been sideways for a while now.


I have (finally) developed something that I think has a positive expectancy. It is difficult to make this conclusion with certainty since the system trades very infrequently, but all of the symbols I have backtested it on have produced a net profit with a win % > 50%. Currently it is a long only system although it should work the other way. I will visit that once I get this one up and running though.

I need to chase down a few issues with it as well as take a close look at the losses to see if I can exit those trades sooner. Similarly I need to take a look at the wins to see if I can profit take on a few to increase the profits. I won't be changing anything for the sake increasing profits/minimizing losses unless the change "makes sense"...have to be careful not to overfit the past at this point.

Hopefully I will have this up and running in simulation mode on Monday. I will no doubt encounter some unexpected behavior at that time, but I expect it to be more of the order execution variety than the system can't work in real time variety. If I get any issues that pop up with that resolved quickly then I may have it up and running live with small risk $ early January. If it still is looking good then I will be ramping up the risk and have it running full steam in February sometime. I doubt I will get to that point, but I can dream right?

A pretty pictures of one of the system backtests below as well as the backtest results for that symbol. Each trade used a risk of $100 which is probably reasonable for what I would risk for the first few months using it. Commission on each trade was what it would be for me and slippage was the same as the commission I used for each trade which is probably reasonable:







 
Long time without posting here for me. I figured I might as well give an update since I have stayed semi-active as far as trading goes...that way my journal doesn't fall away into the abyss without a conclusion.

I have been trading on and off since my last post (over a year ago). Mostly doing a lot of backtesting, occasionally some simulated testing, and rarely live testing. Nothing I have tested as of yet has been very successful when bringing it live (no real surprise). I have essentially set myself a yearly limit for loss with live testing...haven't given up yet, but I hit my limit pretty quickly (about 2 months of live testing) last year so I gave it a rest for a while and came back to it fresh a couple months ago.

I have re-evaluated what I was doing and tried to revamp it into something that will work. Backtests and simulated tests came back looking fairly good, so I have just brought it live (about a week ago). I believe I have worked all the coding kinks out of the system now and so far so good. My profit projection is matching up with my actual results, but it is waaaaay to early to tell much of anything with only 14 actual trades into the live system.



Projection is the blue line, actual cumulative profit at the end of day is the red dots. All trades are closed end of day, so there is no overnight risk. The projection is revised based on the actual risk taken that day. I have a target risk each day, but occasionally it is a bit more or a bit less since I am running fully automated (if 2 or 4 trades fire instead of my targeted 3 at the moment). Since working the kinks in my code out I should be hitting my target risk for the most part going forward.

Maybe I have become a bit jaded, but I am really just waiting for the system to blow up...my prediction is sometime next week or the following it will start deviating significantly and show loss. Anyways...wish me luck with this one. I will keep posting if it keeps showing promise, but if it blows up as I suspect it will, I will probably fade into non-existence here again for a while...it's pretty boring writing about failure all the time.
 
There is NOTHING more depressing and frustrating than losing real money. It may be a bit late to suggest you use a demo account.
It sounds like you have all the qualities needed for success but can you stay the course of taking losses while getting to consistant profits. I know I couldn't. I suggest you keep the day job until you are consistently profitable.
Oh and the advice of sticking to your plan without deviating from it is obviously false if the plan is no good.
Which platform are you trying to code for ?
 
Last edited:
What kind of strategy and method are you using?

The system I am using now is conceptually not to far from what I had tried in the past with my "probability trade" systems. For example see post 28. There is no point in going into the minutia as of yet since I can't really conclusively say I am on to anything yet. More than likely I am just having a string of luck right when I brought the system live.

Nor am I likely to go into the minutia of this one. What I will say about it though is it is more about proper stock selection than anything else. Also, it is a fully automated system, and backtesting in addition to some initial simulated testing indicated the system has ~75% win/loss ratio with a net projected profit of ~10% of what I risk. My current stats are ~65% win/loss with a net profit of ~13% of risk. Really though with only 14 trades that is pretty much irrelevant since there is not enough data to conclude anything.

I spent a lot of time in the past trying to determine what I would consider "high probability set-ups" of price action. Although I feel that I may have identified a few, it is incredibly hard to backtest these (even with coding and proper software) and have any sort of definitive results since almost by definition they occur very rarely. Additionally, not having a defined list of stocks at the beginning of the day adds a layer of complexity to coding the system...I tried to focus my attention more recently on lower hanging fruit.
 
There is NOTHING more depressing and frustrating than losing real money. It may be a bit late to suggest you use a demo account.
It sounds like you have all the qualities needed for success but can you stay the course of taking losses while getting to consistant profits. I know I couldn't. I suggest you keep the day job until you are consistently profitable.
Oh and the advice of sticking to your plan without deviating from it is obviously false if the plan is no good.
Which platform are you trying to code for ?

I am and have been using Tradestation for the past year and a half about. I can't imagine trying to develop an automated system without it to be honest, with all the backtesting tools they have available. That being said, it is easier said than done for sure.

Appreciate the suggestion about demo trading. I do that and start myself off with relatively low risk when I bring systems live. The one I am live testing now I backtested over a period of ~3 months (on ~100 stocks resulting in a sample size of ~500 executed trades) and then simulation traded for ~1.5 months before bringing it live.
 
I use MT4. I know nothing about Trade Station.
There are loads of people trying to come up with a winning system there. Mostly they produce varying degrees of losses but sooner or later one will make it. I have devised systems and got them coded up but alas not much good so far.
At the moment I am working with a developer in Russia who seems to be near.
 
Top