10 items for inclusion in automated trading code - (1) Diversification

Charlton

Experienced member
Messages
1,501
Likes
325
1) how to reduce risk using diversification
2) how to evaluate the market direction
3) if market direction in doubt then how to hedge
4) how to scale in /out in real time to reduce risk
5) pos sizing relative to capital
6) different pos sizing during oscillation and trend mode
7) exit /stop loss during osc/ trend modes
8) real time risk manager
9) execution of the trades
10) dynamic profit making based on Money management

As discussed yesterday Grey1 left a list of 10 items that should be included in automated code for trading. I present some thoughts that might lead to further discussion on the first point.

It seems to me that there are 3 ways to diversify:
• Use different types of instruments besides just US stocks
• Deliberately incorporate a diversification element into initial stock selection
• Expand the range of stocks chosen

So let’s look at what these 3 options mean in practical terms.

Leovirgo has shown, in his excellent thread on his automated vwap engine, how he trades a range of instruments such as Indu Cash, ES futures and NQ futures. He has also looked at applying the tecniques to forex. Clearly this kind of diversification requires different ways of using the top-down approach, cycle analysis and market strength analysis that is more appropriate to the instrument in question. I recoomend you read his thread to get good practical tips on how you could diversify beyond US equities

http://www.trade2win.com/boards/693340-post73.html

Also see his personal blog

Returning to US equities the N-min change code aims to allow you to sort stocks by strength or weakness from a population of stocks that you enter into the radarscreen. There are a couple of ways of introducing further diversification into this process. The first is to introduce diversification during the introduction of the population.

For example using Finviz.com to select an initial population

Stock Screener - Overview


can enable selection or further filteration by sector and industry, market capitalisation, fundamentals and so forth. However it is necessary to consider the diversification filters used carefully, because it may adversely skew the population in favour of weaker or stronger candidates that invalidate or reduce the effectiveness of the subsequent filtration by stock strength within the N min change code. For example, if you used the Finviz heat map S&P 500 Map Heatmap and just chose the green i.e. strong sectors you would not have a good population for weak stocks.

Another tool to use (for TS8 users) is the Scanner, that enables symbol lists, including Industry Groups as well as filters based on fundamentals and custom built indicators to be used.

A further method of adding diversification is to increase the number of stocks in your trading basket. The main issue with this is trying to monitor and increased portfolio and this is where really automation of, at least, the exit strategies for your portfolio are best automated. Personally about 5 stocks in a manually controlled daytrading portfolio at any one time is about my limit.

This then becomes a good justification for the introduction of automation into portfolio management.

Charlton
 
Hello Charlton,

I have learnt this strategy from a friend who has attended one of Irajs master classes, I am in the process of starting the long and hopefully rewarding journey to implementing this strategy as a fully automated system for personal use,

I plan on using easy language for the majority of the coding, I believe reading through the previous posts in this forum that a big attempt was made by the elite users of the TT forum to try to automate Irajs US diversification method.

I have just read your detailed post on diversification, would a scan of stock being positively correlated and negatively correlated to the INDU be another idea to maximise diversification in the radar screen?

Would you recommend a correlation step for Irajs US Equity method to include both +tiv and -atively correlated to the INDU? Has any work been done on this at all?

I look forward to your reply,

Best Regards,

James (Mindset)
 
I have just read your detailed post on diversification, would a scan of stock being positively correlated and negatively correlated to the INDU be another idea to maximise diversification in the radar screen?

Would you recommend a correlation step for Irajs US Equity method to include both +tiv and -atively correlated to the INDU? Has any work been done on this at all?

James (Mindset)
James

At the heart of the strategy lies the Iraj N min change and here is the link to the file provided by Iraj

http://www.trade2win.com/boards/361347-post1.html

My discussion on diversification was looking at ways to diversify the candidates that would then be presented to the Iraj N min change Radar screen. Once you have presented the candidate list then the radar screen itself sorts the stocks according to the strength of their positive/negative correlation to the INDU.

It looks at how much price movement there has been in a particular time period of each stock compared to its volatility. The equivalent movement in INDU becomes the baseline. Coupled with the use of the code is the need to change the compression value as the session progresses and a utility given on the board to do this is:

http://www.trade2win.com/boards/403003-post8.html

So the N min change uses the principle of negative and positive correlation in any case, but if you were to pre-filter stocks on that basis then I guess you would have a more appropriate (but less diverse) candidate list running within the N min change.

Charlton
 
As regards the list of 10 items, my general question is how many of them are things that we all understand and use already, and how many are new items which haven't been brokered and explained in detail before ?
e.g. if you take the first item "how to reduce risk using diversification", does this suggest that we need to look beyond the method posted by Iraj, or just that the method posted is what we already understand and just needs to be included in the list ?
We may be drawn into unecessarily looking beyond what we know in some cases.

Regarding diversification, another question is - Are we saying that people have successfully traded using the approach recommended by Iraj and are now seeking to improve on it, or are we saying that people have not been successful and are trying to tweak the approach in an attempt to become consistently profitable ?

I would say "If it ain't broke, don't fix it ".
As demonstrated in Iraj's seminars, a simple list of stocks selected using the recommended parameters/values of ATR, Volume and Price is more than adequate for trading purposes provided the list is reviewed every month or so, so personally I see no need to make things more complicated.
To purposely include negatively correlated stocks suggests that in a Long market, some of your positions would be shorts.
This would make manual or auto-trading more complex to initiate and manage, and the further inclusion of other Indices/Forex would cause problems in calculating position size.

It seems that Belflan is using Spreadbetting or something similar for trading if he has INDU Cash in his list. Could it be that setting up a basket of stocks is just too fiddly on his trading platform and so he has opted to use the popular indices that are readily available ? If this is the case then his diversification might actually be worsened rather than improved.
I'm only guessing here and Belflan will (please) correct me if I'm wrong.

As regards Correlation, I have coded an indicator which sits next to N-Minute change and shows the correlation as a variable coloured box. This works well enough but I wouldn't consider it essential or even necessary. The reason is that the strongest stock might be charging north in a long market (say) far quicker than the INDU and therefore it's correlation will be weak even though it is the strongest in N-Minute Change. This means that if you picked stocks based on correlation and N-Minute Change together, you might omit some of the best to put in the basket.

Regarding the second item, as we all know, the major skill lies in getting the market direction right, and you can almost pick stocks with a pin once you have achieved that.
You may recall that Iraj recommended looking for something better than the Macci, so this quest would seem to be more productive than changing the selected stock list.
On top of this was the recommendation to determine market fundamentals on the day i.e. interpretation of current events and news preceding and during the session. This is the element of discretion which cannot be automated and which has a higher priority than the Macci or other indicator in use.
You all know what happens to cyclic indicators when the market keeps on and on going in the same direction, just as you all know what happens with there is little volume or movement about. The indicators lose their efficacy because they perform best in an actively oscillating market.

Glenn
 
As regards the list of 10 items, my general question is how many of them are things that we all understand and use already, and how many are new items which haven't been brokered and explained in detail before ?
e.g. if you take the first item "how to reduce risk using diversification", does this suggest that we need to look beyond the method posted by Iraj, or just that the method posted is what we already understand and just needs to be included in the list ?
We may be drawn into unecessarily looking beyond what we know in some cases.
Good point - My aim in this is merely to stimulate some discussion, but based around the structure of the 10 point list which Iraj provided. I hope that this will provide some structure and links to the many postings scattered around. If it provokes new ideas then all well and good. If it confirms that the methods already proposed need no new slants then that is also a valuable lesson to take away.

In truth, at this stage, until I open up the discussion on each point I have no idea whether this would be a valuable exercise or not or whether there is any interest in exploring these things
Regarding diversification, another question is - Are we saying that people have successfully traded using the approach recommended by Iraj and are now seeking to improve on it, or are we saying that people have not been successful and are trying to tweak the approach in an attempt to become consistently profitable ?

I would say "If it ain't broke, don't fix it ".
As demonstrated in Iraj's seminars, a simple list of stocks selected using the recommended parameters/values of ATR, Volume and Price is more than adequate for trading purposes provided the list is reviewed every month or so, so personally I see no need to make things more complicated.
Yes - as I said in the last comment, the conclusion might be that there is no more to say about each point. In which case we can truly claim to have addressed each of the 10 points in the list.
To purposely include negatively correlated stocks suggests that in a Long market, some of your positions would be shorts.
cetainly agree with that - the N min change will sort out the strongest and weakest stocks and to include negatively correlated stocks from a pre-filtered list would not be sensible.

This would make manual or auto-trading more complex to initiate and manage, and the further inclusion of other Indices/Forex would cause problems in calculating position size.
Personally I only include US equities, but I think LeoVirgo has shown how parts of the
strategies discussed here might be adapted to other instruments. Clearly this is not pure Iraj strategy.
It seems that Belflan is using Spreadbetting or something similar for trading if he has INDU Cash in his list. Could it be that setting up a basket of stocks is just too fiddly on his trading platform and so he has opted to use the popular indices that are readily available ? If this is the case then his diversification might actually be worsened rather than improved.
I'm only guessing here and Belflan will (please) correct me if I'm wrong.
As you say, that is for others who don't use the strategy with US equities to determine

As regards Correlation, I have coded an indicator which sits next to N-Minute change and shows the correlation as a variable coloured box. This works well enough but I wouldn't consider it essential or even necessary. The reason is that the strongest stock might be charging north in a long market (say) far quicker than the INDU and therefore it's correlation will be weak even though it is the strongest in N-Minute Change. This means that if you picked stocks based on correlation and N-Minute Change together, you might omit some of the best to put in the basket.
So again - a good argument for not including correlatin within a pre-filter
Regarding the second item, as we all know, the major skill lies in getting the market direction right, and you can almost pick stocks with a pin once you have achieved that.
110% agree with that. If you can get this right and have good money management in place then you are on a winner
You may recall that Iraj recommended looking for something better than the Macci, so this quest would seem to be more productive than changing the selected stock list.
On top of this was the recommendation to determine market fundamentals on the day i.e. interpretation of current events and news preceding and during the session. This is the element of discretion which cannot be automated and which has a higher priority than the Macci or other indicator in use.
Yes - Indeed there may be other indicators that are more responsive than the MACCI and I think there may be some discussion topics on this forum in the past that have looked at this. This is something that readers can explore for themselves as it is easy to incorporate new indicators into TS to see how effective each may be.

I fully concur with your last point, based upon what I have seen myself, that there is little to choose between indicators that isn't dwalfed by other elements of the strategy that would bear far more fruit for the labour involved.


I therefore think your second line of questioning i.e. market fundamentals, news, current evens would make a very fruitful and interesting dicussion.

You all know what happens to cyclic indicators when the market keeps on and on going in the same direction, just as you all know what happens with there is little volume or movement about. The indicators lose their efficacy because they perform best in an actively oscillating market.

Glenn
Yes - and this kinda ties in with points 6 and 7, in that we should look at the inherent restrictions in these kinds of indicators. This will involve an analysis of the type of market currently in play and then deciding to either avoid trading or to use alternative methods such as trending indicators or price action, so here are some more potential discussion topics.

Charlton
 
It seems that Belflan is using Spreadbetting or something similar for trading if he has INDU Cash in his list. Could it be that setting up a basket of stocks is just too fiddly on his trading platform and so he has opted to use the popular indices that are readily available ? If this is the case then his diversification might actually be worsened rather than improved.
I'm only guessing here and Belflan will (please) correct me if I'm wrong.


Glenn

Hi Glenn,

no I haven’t used SB for some time now. And I trade index futures only at the moment. The reason for this is probably a mental one, I found it hard to take getting the market direction correct and losing money, this lead me (when I was trading stocks) to look at how the stocks were correlated with the index before entering. Eg for a good while Oil stocks were negatively correlate with the dow and therefore if the dow going into a buy dip the oil stocks would look strong in the N min but only because they were negatively correlated and then you enter, get the market direction correct, but bing bang boo you lose money.

Belflan
 
Hi Glenn,

no I haven’t used SB for some time now. And I trade index futures only at the moment. The reason for this is probably a mental one, I found it hard to take getting the market direction correct and losing money, this lead me (when I was trading stocks) to look at how the stocks were correlated with the index before entering. Eg for a good while Oil stocks were negatively correlate with the dow and therefore if the dow going into a buy dip the oil stocks would look strong in the N min but only because they were negatively correlated and then you enter, get the market direction correct, but bing bang boo you lose money.

Belflan

Hi Belflan,
Just interested have you been overall successful trading the index futures with the macci strategy,i know there is nothing worse than waiting hours for a setup you call it right with the market then the stock dosent move or it goes against you ! (hence the advantage of a basket ,diversification in stocks/sectors) On the flip side how often does a weak/ strong stock help you if the market moves against you .
What stop loss policy do you implement when trading index futures directly.
Hope you dont mind the questions :)

Regards
Graham
 
Hi Belflan,
Just interested have you been overall successful trading the index futures with the macci strategy,i know there is nothing worse than waiting hours for a setup you call it right with the market then the stock dosent move or it goes against you ! (hence the advantage of a basket ,diversification in stocks/sectors) On the flip side how often does a weak/ strong stock help you if the market moves against you .
What stop loss policy do you implement when trading index futures directly.
Hope you dont mind the questions :)

Regards
Graham



Yes, but the macci is only part of the set up for my automated trading, the macci should not be used for entry’s on its own

I have used macci’s to scalp ym on 10min and 1min chart, but scalping is some what of an art and you must take a lot of other things into consideration other than indicators.

I would say that if Iraj says there is an advantage in diversification into stocks rather than index futures on there own then there probably is. I’m just a bit lazy and can not code that well, once I got a set up that worked on the dow I started looking into other areas of this crazy trading business.

When scalping I’ll have wide sl and if the trade goes into profit within one market cycle I’ll put the stop to b\e plus costs. This feels a bit like gambling and you do have a high % of losses to wins, but you can have the odds stacked in your favour never the less.

other index futures systems i trade use a variety of sl types depending on the set up

belflan
 
Last edited:
I would say that if Iraj says there is an advantage in diversification into stocks rather than index futures on there own then there probably is.

His reasoning is that with futs you are either right or wrong, and rewarded or punished accordingly, whereas with diverse stocks you are less likely to get punished so badly if you are wrong.
It's all about risk management, especially for those with less experience and those who struggle to make consistent profits.

Glenn.
 
Top