# Developing a mechanical system from scratch



## CanOz

I thought it would be interesting to develop a mechanical trading system from scratch with some of the members on ASF. 

Maybe this has been tried before here, not sure. I know that it has been done a few times on ReefCap, with some obvious results, mostly positive from what i can gather.

I know very little about mechanical systems, but i am very keen to learn more about them and develop and test several of my own for application one day.

So if your interested, then drop by and add your "2 bob" as we proceed through the development stages.

How about a few ground rules:

1.) There are no such things as stupid questions or suggestions, lets brain storm this together.

2.) If you have 'been there, done that' then please let us work through some of the issues so we get a feel of ownership. Maybe a few hints now and then would be good too.

3.) Those more experienced at this are most welcomed to provide thier guidence and constructive criticsm for us, without you we cannot learn.

4.) Keep in mind we all have different software, lets try to be as generic as possible when talking about code. If you post code then at least label it for us code dummies.

Lets try to agree on the plan for the project first.

As Tech suggested to me, we could go like this to start with:


Instrument/Universe
Time Frame

Anyone to start things off?

Cheers,


----------



## tech/a

Timeframe first are we talking intraday or EOD or Weekly.

The longer the timeframe the easier it is to design a profitable system.
Are we looking to hold a few days,weeks,months,years?

Then Long or Short or BOTH?
Portfolio or a single entity?
Single entity systems are easier to design than portfolios.
(This is your universe).

Next capital base.
how much are you going to trade with.
Leveraged or not? This will have a huge bearing when we analyse drawdown.

May I suggest you keep this as simple as possible.Ive been involved with this type of thing before and it can get so messy you get no where.

If people code it up in Metastock format then I'm happy to run it through Tradesim Metastock to feed back the NUMBERS.

That should keep you all busy for a while.


----------



## doctorj

Good idea.  Should be something in this for everyone.

I think it should be a long-only system that is atleast EOD if not longer as its easier to trade.  I also think that it should trade a portfolio because it'll be tough for many people to trade a public system on a single instrument.

I'd also like to see it leveraged, but that's just my preference.


----------



## doctorj

Or alternatively, what about an intraday or short term long/short index system using cfds. That way liquidity shouldn't be a problem.

I think there is a lot of material around about developing techtrader-like systems (med-long term, long only, stocks etc etc), it'd be more productive to cover some ground not already covered here at ASF.


----------



## wayneL

doctorj said:


> Good idea.  Should be something in this for everyone.
> 
> I think it should be a long-only system that is atleast EOD if not longer as its easier to trade.  I also think that it should trade a portfolio because it'll be tough for many people to trade a public system on a single instrument.
> 
> I'd also like to see it leveraged, but that's just my preference.



Agree.

As most people work. It should be tradeable by someone who cannot continuously monitor the market.

For reasons I won't go into, I prefer a medium term system (which in practice means trailing stops not so freakin wide), but that's just me. What are other thoughts on time horizon?


----------



## CanOz

I like EOD, & i'd like to see a swing system, but i'll go with the flow on this.

Can we look at doing this with CFD's, that would take care of the leverage right? If we didn't have to worry about shorts then it would expand the universe somewhat.

Cheers,


----------



## BREND

According to academics, the success rate of system trading is far greater than discretionary trading. 

First find a system, back-test it, if it not accurate, amend again, back-test it again until it becomes a profitable system.

I use system trading model when I look at copper and zinc, and it works most of the time.


----------



## CanOz

BREND said:


> According to academics, the success rate of system trading is far greater than discretionary trading.
> 
> First find a system, back-test it, if it not accurate, amend again, back-test it again until it becomes a profitable system.
> 
> I use system trading model when I look at copper and zinc, and it works most of the time.




I'd love to try and do a futures system with CFD's...but another time maybe.

Cheers,


----------



## wayneL

CanOz said:


> & i'd like to see a swing system,



FWIW

I think swing systems are better when able to monitor intra day... or at least have a broker with buy stops, so you can stop into signals when not monitoring.

In fact, I like to think of swing trading as trend trading on lower time frame bars. ie trend trading 15m 30m or 1hr bars and this is how I approach it. I do however reference to the daily patten first, then drop down the time frame.


----------



## wayneL

BREND said:


> According to academics, the success rate of system trading is far greater than discretionary trading.
> 
> First find a system, back-test it, if it not accurate, amend again, back-test it again until it becomes a profitable system.
> 
> I use system trading model when I look at copper and zinc, and it works most of the time.



Brend,

There has been confusion before as to what "discretionary" trading is.

For instance there may be a trader who has a definite rule based method, but will use discretion on which entry signals to take based on extraneous factors. (While NEVER using discretion on exits). The extraneous factors could range from gut feel, fundamentals, BB sentiment, visual filter etc.

This is opposed to traders who enter and exit on a pure discretion.

What are your academics refering to particularly in this regard?


----------



## CanOz

wayneL said:


> FWIW
> 
> I think swing systems are better when able to monitor intra day... or at least have a broker with buy stops, so you can stop into signals when not monitoring.
> 
> In fact, I like to think of swing trading as trend trading on lower time frame bars. ie trend trading 15m 30m or 1hr bars and this is how I approach it. I do however reference to the daily patten first, then drop down the time frame.




Well i'm easy on this, whatever is easiest to trade EOD really. As stated many including myself  haven't the time, or the reliable connectivity to watch intraday.

Cheers,


----------



## Captain_Chaza

CanOz said:


> Well i'm easy on this, whatever is easiest to trade EOD really. As stated many including myself  haven't the time, or the reliable connectivity to watch intraday.
> 
> Cheers,




From my experience 
The EOD trader will always beat the Intra-day trader each and every Financial year
If the skipper is then also allowed to place a few well-thought-out intra-day contingeccy orders based on burning some midnight oil 
You will see an absolute Massacre /Blood-Bath that can only be enjoyed and witnessed to the fullest when at sea and too far off-shore to hear those screaming landlubbers' excuses and tall stories!

Salute and Gods speed


----------



## wayneL

Captain_Chaza said:


> From my experience
> The EOD trader will always beat the Intra-day trader each and every Financial year



Can you please back that assertion up with verifiable figures?

Because with the range of mitigating factors, I don't think anyone can say that with absolute certainty.


----------



## Captain_Chaza

wayneL said:


> Can you please back that assertion up with verifiable figures?
> 
> Because with the range of mitigating factors, I don't think anyone can say that with absolute certainty.




I feel I can because I have tried both styles of tacking over more than 3 decades

Maybe you should put it to a poll and judge for yourself how futile it is to be an Intra-day adventurer over the only time frame that is important 
ie One financial year

Salute and Gods speed


----------



## Nick Radge

Happy to add my 2c worth here if people take a genuine interest. A system, in my opinion, takes two shapes; systematic and mechanical. A systematic system is one that has a defined set of rules that are followed, but which may not be programmed into a computer. A system trader is not a discretionary trader although an argument could be made on a sub-conscious/conscious level. A mechanical is one that can be programmed into a computer which I think is what is being alluded to here.

I don't agree with intra day being worse than inter day. Afterall, when one finds a positive edge one should explot it to the maximum. A casino opens for 24-hours for a reason - so they can exploit their edge to the maximum. Trade frequency is an important element of profitability, but trade frequency doesn't mean sitting glued to a screen all day. Trade ferqeuncy on an EOD basis also means finding a system that works across numerous instruments in numerous markets, even on an EOD basis. A robust short term system trading Australian stocks should be able to trade the same in UK and US stocks. Just follow around the world.


----------



## BREND

wayneL said:


> Brend,
> 
> There has been confusion before as to what "discretionary" trading is.
> 
> For instance there may be a trader who has a definite rule based method, but will use discretion on which entry signals to take based on extraneous factors. (While NEVER using discretion on exits). The extraneous factors could range from gut feel, fundamentals, BB sentiment, visual filter etc.
> 
> This is opposed to traders who enter and exit on a pure discretion.
> 
> What are your academics refering to particularly in this regard?




For discretionary trader, I'm referring to those who does not have a trading system which they rely on. 

Have you read a book call "Rules of the Turtles"? The academic part is found in this book. They are a group of traders who rely on system trading on their futures trades.


----------



## wayneL

Captain_Chaza said:


> I feel I can because I have tried both styles of tacking over more than 3 decades
> 
> Maybe you should put it to a poll and judge for yourself how futile it is to be an Intra-day adventurer over the only time frame that is important
> ie One financial year
> 
> Salute and Gods speed




Personally, I find an edge intraday, but readily recognize that others may not. There are a few factors which are pertinent whether one does or doesn't. 

I think Nick has answered the question sufficiently to put this argument to rest.


----------



## Captain_Chaza

wayneL said:


> Personally, I find an edge intraday, but readily recognize that others may not. There are a few factors which are pertinent whether one does or doesn't.
> 
> I think Nick has answered the question sufficiently to put this argument to rest.




Sorry I can't see how Nick has put the Intra_day V EOD to rest
If Anything he has thrown it into complete Chaos suggesting that ONE can or should trade 3 -4 markets at any one time 24 hours a day
This is Madness and Lunacy if you ask me?

I find that my EDGE is that I put the hard yards well before the ASX opens
I wake up the birds and prepare for each day
I set my "open " orders and a few continency orders

"The Wind Calls the Tune " and I go off and play some golf and freshen up for another day at sea on the ASX in the morrow

Only this form of sailing gives you the stamina and technique to last out any year and then year on and year out

The downfall of course is you must love waking up the birds
I enjoy it and it is truly wonderful to stidy the Global Exchange when she stands still for only a few moments

That is my edge! 

How anyone could do the necessary preparations for 3 time zones is beyond me and I congratulate anyone who says they can

Salute and Gods speed
PS I do some Intra-day trading when the weather outside is miserable but play the market more like a the pokies /Casino with small funds

I never invest real funds on an Intra-day whim!


----------



## CanOz

wayneL said:


> Personally, I find an edge intraday, but readily recognize that others may not. There are a few factors which are pertinent whether one does or doesn't.
> 
> I think Nick has answered the question sufficiently to put this argument to rest.




So do we all think that EOD would be the best for a mechanical system?

Also, thanks Nick, for your input as well, i'm sure everyone would be very appreciative of your comments here anytime.

So EOD...

What about CFD's, as Wayne has brought up before there is the issue of counter party risk, could this be an issue?

Are we better to just look at margin on stocks?

Cheers,


----------



## nizar

Nick, thanks for your contribution. Highly valued by me and many others, no doubt.

I, too, prefer EOD trading just as a lifestyle choice. ENd of day *stops *especially, will keep you in the trades longer.



> A robust short term system trading Australian stocks should be able to trade the same in UK and US stocks. Just follow around the world.




Tend to agree with these comments. I have a family friend of mine who trades the aussie markets, Japanese, HK, and US markets. He told me: "The money is looking for you 24 hours a day. Dont just stay in this pond [referring to the ASX is a pond compared to the sea which is the rest of the world]".

As for these comments from Captn:


> If Anything he has thrown it into complete Chaos suggesting that ONE can or should trade 3 -4 markets at any one time 24 hours a day
> This is Madness and Lunacy if you ask me?




Maybe madness and lunacy to you???
Maybe because YOU cannot do not assume the same for others.


----------



## CanOz

Captain_Chaza said:


> Sorry I can't see how Nick has put the Intra_day V EOD to rest
> If Anything he has thrown it into complete Chaos suggesting that ONE can or should trade 3 -4 markets at any one time 24 hours a day
> This is Madness and Lunacy if you ask me?
> 
> I find that my EDGE is that I put the hard yards well before the ASX opens
> I wake up the birds and prepare for each day
> I set my "open " orders and a few continency orders
> 
> "The Wind Calls the Tune " and I go off and play some golf and freshen up for another day at sea on the ASX in the morrow
> 
> Only this form of sailing gives you the stamina and technique to last out any year and then year on and year out
> 
> The downfall of course is you must love waking up the birds
> I enjoy it and it is truly wonderful to stidy the Global Exchange when she stands still for only a few moments
> 
> That is my edge!
> 
> How anyone could do the necessary preparations for 3 time zones is beyond me and I congratulate anyone who says they can
> 
> Salute and Gods speed
> PS I do some Intra-day trading when the weather outside is miserable but play the market more like a the pokies /Casino with small funds
> 
> I never invest real funds on an Intra-day whim!




Ok, lets move on, we're not going to trade a mechanised system intraday right?


----------



## nizar

CanOz said:


> So do we all think that EOD would be the best for a mechanical system?




I dont think theres any "best" here.
It depends on your timeframe, your other lifestyle commitments, etc..

Im sure there are traders that clean up in both compartments, both EOD and intraday.

It would make for an interesting study though:
EOD traders versus IntraDay traders. WHo makes more per year annually in terms of R.O.E ?

Results would be very interesting....

Thoughts on who would win???
(i personally reckon the longer term trend traders, they really clean up)


----------



## wayneL

I reckon for the purposes of this exersize, EOD would be best.


----------



## doctorj

CanOz said:


> Ok, lets move on, we're not going to trade a mechanised system intraday right?



I think since you started this thread, you've got the right to make decisions on the goals of the system.  This type of thread won't work as a democracy.

So we've got an EOD mechanical system.  Now, what are we trading? Stocks, indices, currencies?  And how are we going to trade them?  CFDs, shares, warrants, options, futures....?


----------



## Nick Radge

Mathematically a higher frequency system will win the race, but as has been said, at what cost? I certainly have no interest in sitting in front of a screen as I love my golf and fishing as well. EOD will fit the bill as Wayne has suggested. Build a system that is (a) systematic and (b) end of day so a realistic working person can operate it without placing their finances in jeopardy.

The concept of CFD/Margin/Other is not important at this stage. A system that works on EOD stock data will also work on CFD's or Margin. Get the system right and then think about how the best way to trade would be. Perhaps because the vast majority herein trades shares or some type of variable we stock to stocks rather than FX or futures.

Other aspects to now consider:

(1) Holding time (1 - 5 days, 5 - 30 days, longer?)
(2) Breakout, pull back
(3) Swing or trend following
etc etc

These answers will then lend themselves toward more important questions such as number of positions, capital required which in turn will answer the question on what instrument will then be required to trade the system.

The issue we're going to face is that everyone has a different personal makeup so everyone will automatically put forward a difference of opinion of what will constitute a better method.


----------



## Captain_Chaza

CanOz said:


> So do we all think that EOD would be the best for a mechanical system?
> 
> Also, thanks Nick, for your input as well, i'm sure everyone would be very appreciative of your comments here anytime.
> 
> So EOD...
> 
> What about CFD's, as Wayne has brought up before there is the issue of counter party risk, could this be an issue?
> 
> Are we better to just look at margin on stocks?
> 
> Cheers,





CFD's IMHO is a mugs' game
As always I only speak for myself

I have only been in this forum for a relatively short time but have noticed the Great calibre of seaman we have here on this forum and their lack of interest in CFD's

Maybe they also agree with me that CFD's are for mugs and pretenders

Salute and Be Well


----------



## Kauri

> ..I set my open  orders and a few continency orders
> 
> The Wind Calls the Tune ..




   Hey Cap...  If you are having trouble with your continence I fully understand why the wind calls the tune..


----------



## R0n1n

I am currently tracking a system called The Three By Two System: 

This is a simple long only system that buy's stocks after a down streak and sells them after an up streak. Back to back purchases on the same stock are possible. 

BUY: If a stock goes down 3 days in a row, BUY at the open the next day
SELL: If a stock that the system is long closes up 2 days in a row, sell entire long position in that stock at the next day’s open. 

may not be the right one.. but we can test it out.


----------



## Captain_Chaza

R0n1n said:


> I am currently tracking a system called The Three By Two System:
> 
> This is a simple long only system that buy's stocks after a down streak and sells them after an up streak. Back to back purchases on the same stock are possible.
> 
> BUY: If a stock goes down 3 days in a row, BUY at the open the next day
> SELL: If a stock that the system is long closes up 2 days in a row, sell entire long position in that stock at the next day’s open.
> 
> may not be the right one.. but we can test it out.




Well, Lets take your  2 day Tack for an All-Out Ocean trial on the Beautiful LNC tomorroww
There is no sign to me indicating that I would sell tomorrow on the open
Lets see what happens ?

Since I will be on the golf course after the open
I would stay in for at least another day
Any other opinions are welcome before the Dawn on the open?

EG: A conticency Sell order could be placed @ say 0.69c
NB: Those Greedy landlubbers love round figures like 0.70c

Salute and Gods speed


----------



## Joe Blow

Gents, can we keep this thread *on topic* as much as possible.

The discussion is meant to revolve around the development of a mechanical trading system. Lets try to focus on that, shall we?


----------



## CanOz

Nick Radge said:


> Mathematically a higher frequency system will win the race, but as has been said, at what cost? I certainly have no interest in sitting in front of a screen as I love my golf and fishing as well. EOD will fit the bill as Wayne has suggested. Build a system that is (a) systematic and (b) end of day so a realistic working person can operate it without placing their finances in jeopardy.
> 
> The concept of CFD/Margin/Other is not important at this stage. A system that works on EOD stock data will also work on CFD's or Margin. Get the system right and then think about how the best way to trade would be. Perhaps because the vast majority herein trades shares or some type of variable we stock to stocks rather than FX or futures.
> 
> Other aspects to now consider:
> 
> (1) Holding time (1 - 5 days, 5 - 30 days, longer?)
> (2) Breakout, pull back
> (3) Swing or trend following
> etc etc
> 
> These answers will then lend themselves toward more important questions such as number of positions, capital required which in turn will answer the question on what instrument will then be required to trade the system.
> 
> The issue we're going to face is that everyone has a different personal makeup so everyone will automatically put forward a difference of opinion of what will constitute a better method.





Ok, so we're EOD, done then.

What about holding time then, does this warrent consideration for the market conditions? Or is this something that does not apply as we will test it through various market conditions?

To me, on my limited experience and knowledge, it would seem that a shorter time frame would pick up more signals i.e. we're looking for shorter swings....but is that really true? 

Need some opinions here, what affects the decision on holding time?

Cheers,


----------



## nizar

CanOz said:


> Need some opinions here, what affects the decision on holding time?





Hi Can,

In my opinion, the holding time depends on the behaviour of the stock.
If the stock behaves [ie. uptrend], i cant see why you cant hold it for 1yr+ or however long the trades allows.

Most of my big winners are all long-term trades.
Sure, it doesnt give you the rush of daytrading, but you get the results.


----------



## nizar

R0n1n said:


> I am currently tracking a system called The Three By Two System:
> 
> This is a simple long only system that buy's stocks after a down streak and sells them after an up streak. Back to back purchases on the same stock are possible.
> 
> BUY: If a stock goes down 3 days in a row, BUY at the open the next day
> SELL: If a stock that the system is long closes up 2 days in a row, sell entire long position in that stock at the next day’s open.
> 
> may not be the right one.. but we can test it out.




Interesting system, looks good in theory, dunno about in practice though.
Typical bullmarket system though. BUY instructions assume the markets has an upward bias.


----------



## >Apocalypto<

R0n1n said:


> I am currently tracking a system called The Three By Two System:
> 
> This is a simple long only system that buy's stocks after a down streak and sells them after an up streak. Back to back purchases on the same stock are possible.
> 
> BUY: If a stock goes down 3 days in a row, BUY at the open the next day
> SELL: If a stock that the system is long closes up 2 days in a row, sell entire long position in that stock at the next day’s open.
> 
> may not be the right one.. but we can test it out.




You would not want to using the sell rule too much in the last four years!


----------



## CanOz

nizar said:


> Hi Can,
> 
> In my opinion, the holding time depends on the behaviour of the stock.
> If the stock behaves [ie. uptrend], i cant see why you cant hold it for 1yr+ or however long the trades allows.
> 
> Most of my big winners are all long-term trades.
> Sure, it doesnt give you the rush of daytrading, but you get the results.




Well i'm over the rush...i want RESULTS BABY!

So do we want a system where the holding time is changeable....?

Like, an exit thats adjustable? Difficult to test? 

Ok, how about we just use the trailing stop that Nick reviews in his course, every time the stock makes a new high, the stop moves up to the new low.....or are we getting ahead of oursleves here?

First of all, are we long only? Short trades don't normally last as long, correct?

Cheers,


----------



## doctorj

I guess when we talk about hold times, we're really asking do we want a more nimble system that takes a little more time to manage, or a longer term, set & forget.

Of course, we'd love something that will hold forever and make us all rich, but we're *not trying to design the perfect system* here, merely a system that offers a good return per unit of risk (ie. Sharpe ratio) and has characteristics that make it trade-able, such as reasonable max drawdown, win% etc.

Once we decide what we're trying to achieve (in this case, hold time) we can start testing entries/exits that we think will achieve that goal.

Given TT is well documented here and elsewhere already, my vote is to design a system that is shorter term in nature so we don't cover old ground...


----------



## R0n1n

nizar said:


> Interesting system, looks good in theory, dunno about in practice though.
> Typical bullmarket system though. BUY instructions assume the markets has an upward bias.




Nizar, it does look good in theory, but it would be good to test it out.

ofcourse the sell can/should be modified to suit.


----------



## >Apocalypto<

Captain_Chaza said:


> CFD's IMHO is a mugs' game
> As always I only speak for myself
> 
> I have only been in this forum for a relatively short time but have noticed the Great calibre of seaman we have here on this forum and their lack of interest in CFD's
> 
> Maybe they also agree with me that CFD's are for mugs and pretenders
> 
> Salute and Be Well




Any margin product can cause you mayor pain, if you not ready to trade or not using money management correctly to suit your experience and balance.

Entries have to much sharper & spreads can add to your loss when your wrong.

But hey you can damage you bank account just as bad with Share trading!

I have noticed CFD's work fine for EOD systems just more attention is needed to monitor the trade, specifically on pull backs and your margin if your not in much profit after entry.

They never expire so you can hold as long as you want.


----------



## Captain_Chaza

CanOz said:


> Ok, so we're EOD, done then.
> 
> What about holding time then, does this warrent consideration for the market conditions? Or is this something that does not apply as we will test it through various market conditions?
> 
> To me, on my limited experience and knowledge, it would seem that a shorter time frame would pick up more signals i.e. we're looking for shorter swings....but is that really true?
> 
> Need some opinions here, what affects the decision on holding time?
> 
> Cheers,




You are not going to beleive me when I say this
"The Wind Calls the Tune"
But it does
Probably the best holding pattens I have ever seen is the 8 Day Spring Gale
Believe me !These cannot be predefined and are not easy to hold onto in their strength

If I am lucky I might catch one of these glorious Spring gales Once a year 
but unfortunately like most Gutless Captains I usaully drop the ropes much too early fearing she may split the mast

I don't think you can define a cruise strategy to say 
1-5 days
5-20 days 
etc

However I am willing to learn any new tacks and tricks

Like all sea sports I feel we are totaly dependant on the sea and weather conditions at the time
Not only in our own vicinity but also many thousands of miles to the north

The point I am trying to make is I don't think you can put a strict timing arrangement on any tack
Patience is sometimes required (But not too much  for my liking)

Sometimes the anticipacted wind never builds up and at other times she just fizzles out before you have time to jump out of your bunk

Salute for now and as always 
Strap yourselves into your bunks for a good night's sleep


----------



## CanOz

doctorj said:


> Given TT is well documented here and elsewhere already, my vote is to design a system that is shorter term in nature so we don't cover old ground...




Ok sounds good to me, i'd like to see a system that goes short too, so that might suit this approach?

Thats 2 for a shorter time frame.

Cheers,


off to bed...


----------



## wayneL

CanOz said:


> Ok sounds good to me, i'd like to see a system that goes short too, so that might suit this approach?
> 
> Thats 2 for a shorter time frame.
> 
> Cheers,
> 
> 
> off to bed...



ditto

3


----------



## lesm

wayneL said:


> ditto
> 
> 3




+1 = 4


----------



## Captain_Chaza

doctorj said:


> I guess when we talk about hold times, we're really asking do we want a more nimble system that takes a little more time to manage, or a longer term, set & forget.
> 
> Of course, we'd love something that will hold forever and make us all rich, but we're *not trying to design the perfect system* here, merely a system that offers a good return per unit of risk (ie. Sharpe ratio) and has characteristics that make it trade-able, such as reasonable max drawdown, win% etc.
> 
> Once we decide what we're trying to achieve (in this case, hold time) we can start testing entries/exits that we think will achieve that goal.
> 
> Given TT is well documented here and elsewhere already, my vote is to design a system that is shorter term in nature so we don't cover old ground...




Good Idea !!
Getting off to a Good Start is Paramount
Holding technieques can vary according to each ones personal criteria and stamina


----------



## wayneL

For those with amibroker, here is some handy codes for potential exits :

The first is a simple EMA flipper. It plots the _x_ ema of the lows when the price action is above it, and plots the ema of the highs when the price closes below. As such it can be a short or long exit and is completely adjustable



		Code:
	

x = Param("EMA Hi-Lo Flipper",20,1,200,1);
hi = EMA(H,x);
lo = EMA(L,x);
x1 = IIf(C>Ref(hi,-1),1,IIf(C<Ref(lo,-1),-1,0));
x2 = ValueWhen(x1!=0,x1,1);
st = IIf(x2==-1,Hi,Lo);
paintbars = IIf(C < st, IIf(Cross(st,C),colorBlack,colorWhite), IIf(Cross(C,st) ,colorBlack,colorRed));
paintbars1 = IIf(C < st, colorWhite,colorRed);
Plot(st,"",paintbars1,styleDots|styleNoLine);
Plot(st,"",paintbars,styleStaircase|styleNoLabel);


The next one is the standard Chandelier exit (Hat Tip Stevo)



		Code:
	

// ATR Trailing stop - stevo 2006

multiplier = Param("ATR Multiplier", 3, 0, 10, 0.1);
myATR= multiplier*ATR(21); // calculate ATR
initial=H-myATR; // raw stop - not racheted

stop[ 0 ] = Close[ 0 ];
for( i = 1 ; i < BarCount; i++)
{
 if( Close[ i ] > stop[ i - 1])
{
 temp = Close[ i ] - myATR[ i ];
 if( temp > stop[ i - 1 ] ) stop[ i ] = temp;
 else stop[ i ] = stop[ i - 1 ];
}
 else
 stop[ i ] = initial[ i ];
}

Plot( Max(stop,Ref(stop,-1)), "ATR Stop", colorCustom12, styleDashed);


Next one is a Chandelier for shorts (A table lamp? )



		Code:
	

// Converted from ATR Trailing stop - stevo 2006
 
multiplier = Param("ATR Multiplier", 3, 0, 10, 0.1);
myATR= multiplier*ATR(21); // calculate ATR
initial=L+myATR; // raw stop - not racheted

stop[ 0 ] = Close[ 0 ];
for( i = 1 ; i < BarCount; i++)
{
 if( Close[ i ] < stop[ i - 1])
{
 temp = Close[ i ] + myATR[ i ];
 if( temp < stop[ i - 1 ] ) stop[ i ] = temp;
 else stop[ i ] = stop[ i - 1 ];
}
 else
 stop[ i ] = initial[ i ];
}

Plot( Min(stop,Ref(stop,-1)), "ATR Short Stop", colorSkyblue, styleDashed);


Have fun


----------



## It's Snake Pliskin

Captain_Chaza said:


> Sorry I can't see how Nick has put the Intra_day V EOD to rest
> If Anything he has thrown it into complete Chaos suggesting that ONE can or should trade 3 -4 markets at any one time 24 hours a day
> This is Madness and Lunacy if you ask me?
> 
> I find that my EDGE is that I put the hard yards well before the ASX opens
> I wake up the birds and prepare for each day
> I set my "open " orders and a few continency orders
> 
> "The Wind Calls the Tune " and I go off and play some golf and freshen up for another day at sea on the ASX in the morrow
> 
> Only this form of sailing gives you the stamina and technique to last out any year and then year on and year out
> 
> The downfall of course is you must love waking up the birds
> I enjoy it and it is truly wonderful to stidy the Global Exchange when she stands still for only a few moments
> 
> That is my edge!
> 
> How anyone could do the necessary preparations for 3 time zones is beyond me and I congratulate anyone who says they can
> 
> Salute and Gods speed
> PS I do some Intra-day trading when the weather outside is miserable but play the market more like a the pokies /Casino with small funds
> 
> I never invest real funds on an Intra-day whim!




With all due respect Captain Chaza,

You have missed the point.

I would love to learn how to wake up the birds because I am the opposite.


----------



## It's Snake Pliskin

Nick Radge said:


> The issue we're going to face is that everyone has a different personal makeup so everyone will automatically put forward a difference of opinion of what will constitute a better method.




Which I believe will render the exercise useless. 
*I hope I am wrong* but most don't care what I think. I refuse to be bent and prodded with the business sdick; and normality doesn't like that. 

How is everyone going to come to agreement on the parameters? Who is in charge of it?


----------



## CanOz

It's Snake Pliskin said:


> Which I believe will render the exercise useless.
> *I hope I am wrong* but most don't care what I think. I refuse to be bent and prodded with the business sdick; and normality doesn't like that.
> 
> How is everyone going to come to agreement on the parameters? Who is in charge of it?




Lets just work our way through it and see how we go. Those that get too discouraged can just drop out. Those of us that persevere with it will need to try and be patient...very patient obviously.

We could have done this on ReefCap, but i think there are quite a few that are interested here, and the traffic's higher...So while we'll have a harder job keeping things focused, we might get a few more ideas...who knows.

We've got a few high caliber coaches about, thats for sure.

Thanks for codes Wayne!!! 

So we've got 4 that want a short term system, do we want to just focus long or both at the moment? There's no reason why we can't just focus long for now is there?

Cheers,


----------



## tech/a

Come on people get on with it.!!

*Shorter term.*

*Both Long and Short *--- This will help satisfy those who are looking for some Swing Component in the system. Also there is an arguement that this Bull Market wont go on for ever.So Both long and Short will give some insurance to some--perhaps.

*Portfolio of Stocks *traded maximum 10-18 open positions at a time (Known optimum)
Hmm on reflection perhaps 6-10 positions as there are many with only *smaller* capital bases.
Under 20K,I think however it would be better to use a realistic Capital base,starting undrcapitalised isnt
an ideal beginning for any trader!

*Suggest a CFD universe of stocks *as thats the most efficient way to go short.




> BUY: If a stock goes down 3 days in a row, BUY at the open the next day
> SELL: If a stock that the system is long closes up 2 days in a row, sell entire long position in that stock at the next day’s open.




Absolutely *DOOMED*.Must be designed by Homer Simpson.
Unlimited downside potential and limited upside.

On Waynes adjustable exits.
Cant use them in a system as the variables have to be fixed.
Fine for discretionary,but how would you pick which variable to use?


----------



## nizar

What does everyone mean by short-term??

Shouldnt the term be determined by the stocks behaviour??

You dont wanna be holding dogs for too long, and if winners keep going up, then stay in it, ride the trend.

Just my opinion.


----------



## tech/a

> You dont wanna be holding dogs for too long, and if winners keep going up, then stay in it, ride the trend.




Can all be addressed within the system design.

There is also a system under developement over here.Could be of interest to some.
Using Amibroker complete with code.
http://lightning.he.net/cgi-bin/suid/~reefcap/ultimatebb.cgi?ubb=get_topic;f=49;t=000200;p=2#000024


----------



## CanOz

tech/a said:


> Come on people get on with it.!!
> 
> *Shorter term.*
> 
> *Both Long and Short *--- This will help satisfy those who are looking for some Swing Component in the system. Also there is an arguement that this Bull Market wont go on for ever.So Both long and Short will give some insurance to some--perhaps.
> 
> *Portfolio of Stocks *traded maximum 10-18 open positions at a time (Known optimum)
> Hmm on reflection perhaps 6-10 positions as there are many with only *smaller* capital bases.
> Under 20K,I think however it would be better to use a realistic Capital base,starting undrcapitalised isnt
> an ideal beginning for any trader!
> 
> *Suggest a CFD universe of stocks *as thats the most efficient way to go short.
> 
> 
> 
> 
> Absolutely *DOOMED*.Must be designed by Homer Simpson.
> Unlimited downside potential and limited upside.
> 
> On Waynes adjustable exits.
> Cant use them in a system as the variables have to be fixed.
> Fine for discretionary,but how would you pick which variable to use?




We've got some issues with a CFD universe to discuss. Do we want a limited risk account? That is do we need GSL's on every trade or not. If not then i think that gives us more stocks.

We're probably looking at only 600 with GSL facility.

Cheers,


----------



## tech/a

CanOz said:


> We've got some issues with a CFD universe to discuss. Do we want a limited risk account?




Risk need not be more than un leveraged.



> That is do we need GSL's on every trade or not. If not then I think that gives us more stocks.




My veiw is that yes to be able to go Long and Short particularly  in a swing like stratagy you'll need all stocks capable of swinging. Also for testing purposes I dont know of any software that can split universes.Unless of course you have a long stratagy and a seperate short stratagy with their own universes.The can be run in tandem and I can also test them with tradesim in tandem.



> We're probably looking at only 600 with GSL facility.




600 is more than enough in my view *but see above*.


----------



## happytrader

Hello all

How about a little battlers short term trading system (1 hour to 2 weeks) for those with only $2000, limited time, free charting software and trading only 1 leveraged bluechip stock at one time? 

Cheers
Happytrader


----------



## R0n1n

+ 1 for short term.


----------



## CanOz

happytrader said:


> Hello all
> 
> How about a little battlers short term trading system (1 hour to 2 weeks) for those with only $2000, limited time, free charting software and trading only 1 leveraged bluechip stock at one time?
> 
> Cheers
> Happytrader




Lets see how that would test out once we get to a testing stage ok?

Generally i think that will limit your parcel sizes if you use the 2% risk rule.

Cheers,


----------



## nizar

I used to use 2% risk but its way too much (Snake told me this a long time ago but i didnt listen 

Now i use 0.5-1%.


----------



## CanOz

Heres where we're at:

A short term system

Trades CFD's 

Long and Short

Can we agree on this and move along to entries?

Cheers,


----------



## R0n1n

looks good...


----------



## doctorj

You're the boss.  I think it's only fair that you make these types of decisions based on the input of others given you started this thread.


----------



## happytrader

CanOz said:


> Heres where we're at:
> 
> A short term system
> 
> Trades CFD's
> 
> Long and Short
> 
> Can we agree on this and move along to entries?
> 
> Cheers,




Hi Canaussieuck

Will each trader take responsibility for the entries, exits and stops on a particular stock or stocks or does it have to be a joint agreement thing?

Cheers
Happytrader


----------



## CFD

CanOz said:


> Can we agree on this and move along to entries?




Yes, with a GSL.


----------



## CanOz

happytrader said:


> Hi Canaussieuck
> 
> Will each trader take responsibility for the entries, exits and stops on a particular stock or stocks or does it have to be a joint agreement thing?
> 
> Cheers
> Happytrader




Once a system is being traded, you take the signals it generates HT. The entries, initial stops, trailing stops etc. are all perdetermined and tested. 

Is that what you meant or did i miss the meaning in your question?

NOW

For the entries, what the best way to get us thinking here?

How about we start with something simple, like a key reversal?

Cheers,


----------



## tech/a

Incidently you'll also find (And its a common misconception that a system takes every signalled trade) that you wont have to take every trade and nor will you have the capital to take every trade.
Further you will also be fully positioned and unable to take new trades until trades are closed by either being stopped or exited.

Entries.

Breakouts?
Patterns?
Pullbacks?
Oscillators?
Pure Bar price action like that suggested?
Other?
Combination?

Buy Low sell high?
Buy high sell Higher?
Short Vica Versa.



> I'm really only interested in charts, charts and more charts.




Id change focus to profit!


----------



## CanOz

tech/a said:


> Incidently you'll also find (And its a common misconception that a system takes every signalled trade) that you wont have to take every trade and nor will you have the capital to take every trade.
> Further you will also be fully positioned and unable to take new trades until trades are closed by either being stopped or exited.
> 
> Entries.
> 
> Breakouts?
> Patterns?
> Pullbacks?
> Oscillators?
> Pure Bar price action like that suggested?
> Other?
> Combination?
> 
> Buy Low sell high?
> Buy high sell Higher?
> Short Vica Versa.
> 
> 
> 
> Id change focus to profit!




Thanks for the constructive criticism Daffy, if it weren't for your help we'd have to make all these mistakes ourselves!

Ok, lets forget about entries for now, and work on how much capital we're going to allocate to our system?

If this is CFD's, and the average margin is say, 50% (we'll need to check that on our universe at some stage) would it be safe to say that we'll need about 30,000 to be safe?

Cheers,


----------



## tech/a

*No no 
Entries are OK*.

Capital Id say 30k for testing purposes but can test other capital bases.
You'll find it does make a difference but really as Nick says not that important provided you have enough to run atleast 8 positions without Brokerage being a major issue. I allow $30 in and out and while it can be cheaper its just a base.
Trading smaller parcels and brokerage becomes a real issue as does very short trades and massive frequency.


----------



## CanOz

Ok, great then...lets talk entries!!!!! Ron1n...you must have a few idea now?

I personally like the key reversal...i'll see if i can find a pic file of the bar pattern. Its easy for me to code too

Cheers,


----------



## happytrader

CanOz said:


> Once a system is being traded, you take the signals it generates HT. The entries, initial stops, trailing stops etc. are all perdetermined and tested.
> 
> Is that what you meant or did i miss the meaning in your question?
> 
> NOW
> 
> For the entries, what the best way to get us thinking here?
> 
> How about we start with something simple, like a key reversal?
> 
> Cheers,




Hi Canaussieuck

I've noticed afew of these threads start and then stop because of difference of opinion, knowledge bases and risk tolerance. I was thinking more along the lines of allowing each trader to express their particular talent whether it be for a certain stock, sector, penchant for shorts or longs, pattern recognition, fundamentals whatever, but all would be within a short term time frame, stop loss and parcel sizing. As I mentioned in an earlier post I was thinking of making it a possibility for battlers.

Cheers 
Happytrader


----------



## CanOz

happytrader said:


> Hi Canaussieuck
> 
> I've noticed afew of these threads start and then stop because of difference of opinion, knowledge bases and risk tolerance. I was thinking more along the lines of allowing each trader to express their particular talent whether it be for a certain stock, sector, penchant for shorts or longs, pattern recognition, fundamentals whatever, but all would be within a short term time frame, stop loss and parcel sizing. As I mentioned in an earlier post I was thinking of making it a possibility for battlers.
> 
> Cheers
> Happytrader




So what are you suggesting then? The system will work totally differently with a difference of capital in that range. 

Tech or someone can jump in here, but i think a system to handle $2000 of initial capital will be totally different than a CFD system with $30k capital.

Maybe not, maybe you could do one for penny stocks, i think i saw a thead like that on ReefCap maybe.....

Cheers,


----------



## happytrader

CanOz said:


> So what are you suggesting then? The system will work totally differently with a difference of capital in that range.
> 
> Tech or someone can jump in here, but i think a system to handle $2000 of initial capital will be totally different than a CFD system with $30k capital.
> 
> Maybe not, maybe you could do one for penny stocks, i think i saw a thead like that on ReefCap maybe.....
> 
> Cheers,




Thanks for your reply Canausseuk, I was thinking more along the lines of using expertise in trading over larger capital bases. Within the system you could allocate each person $2000 with which they would be responsible for managing a particular sector, stock or whatever. Just an idea. 

Cheers
Happytrader


----------



## tech/a

happytrader said:


> Hi Canaussieuck
> 
> I've noticed afew of these threads start and then stop because of difference of opinion, knowledge bases and risk tolerance. I was thinking more along the lines of allowing each trader to express their particular talent whether it be for a certain stock, sector, penchant for shorts or longs, pattern recognition, fundamentals whatever, but all would be within a short term time frame, stop loss and parcel sizing. As I mentioned in an earlier post I was thinking of making it a possibility for battlers.
> 
> Cheers
> Happytrader




Happy there is no problem with that in my not so humble opinion.
But as a basis why not get on with this as a *model/Structure* from which people if they wish can design a system to suit their specific needs.?
Otherwise it will get totally lost.


----------



## nizar

tech/a said:


> Incidently you'll also find (And its a common misconception that a system takes every signalled trade) that you wont have to take every trade and nor will you have the capital to take every trade.
> Further you will also be fully positioned and unable to take new trades until trades are closed by either being stopped or exited.
> 
> Entries.
> 
> Breakouts?
> Patterns?
> Pullbacks?
> Oscillators?
> Pure Bar price action like that suggested?
> Other?
> Combination?
> 
> Buy Low sell high?
> Buy high sell Higher?
> Short Vica Versa.
> 
> 
> 
> Id change focus to profit!




Tech.
Buy on breakout and add to on pullback is good for discretionary trading, but maybe a bit difficult to make this (the buying on the pullback part) mechanical??

I know that we havent got here yet but i think in terms of money management the best way is 10% of remaining capital per trade.

JUst my opinion. Should be tested for each system.


----------



## tech/a

You can have multiple entry types by using the OR condition.

Coding you'll need a hand I'm no genius when it comes to complex coding.


----------



## happytrader

tech/a said:


> Happy there is no problem with that in my not so humble opinion.
> But as a basis why not get on with this as a *model/Structure* from which people if they wish can design a system to suit their specific needs.?
> Otherwise it will get totally lost.




Hi Tech

I believe there is an abundance of information in this forum but I do believe that most beginners lack the ability to put it all together in a useful way. The only way they can do that is to see it in action. A multitude of traders with the same budgets but different styles but all on the same page, I think would be useful.

Sounds like a trading room doesn't it?

Cheers
Happytrader


----------



## R0n1n

I asked my friend whose a  full time stock trader for a simple system. Here is what he sent. I can ask him for metastock/Amibroker code if it look ok...

Setup: EMA(13) of close > Signal Line
Entry: Close crossing the previous peak
Exit : EMA(13) crossing below the Signal Line
Signal Line : EMA(9) of EMA(13)

Your opinion guys...
Ofcourse we can drop it, modify it chop it etc.. I just threw it in so that it can generate a few ideas..


----------



## tech/a

Seriously Using a short term EMA like the above is going to get whipsawed to death.
Ive tested enough of these to know you'll go broke in super quick time.
Your mate worries me!!
Nicholas Radge should be along soon to help out.
I dont wish to Hijack this thread (Special cheerio to Snake).


----------



## R0n1n

tech/a said:


> Seriously Using a short term EMA like the above is going to get whipsawed to death.
> Ive tested enough of these to know you'll go broke in super quick time.
> Your mate worries me!!
> Nicholas Radge should be along soon to help out.
> I dont wish to Hijack this thread (Special cheerio to Snake).




Tech I am just throwing ideas in, feel free to modify it etc.

I will see if I can get the code for it and back test it.


----------



## CanOz

tech/a said:


> Seriously Using a short term EMA like the above is going to get whipsawed to death.
> Ive tested enough of these to know you'll go broke in super quick time.
> Your mate worries me!!
> Nicholas Radge should be along soon to help out.
> I dont wish to Hijack this thread (Special cheerio to Snake).




You tested one for me, rememeber!

EMA may be ok for exits...or in combo with something else, i think we need something a bit more original....some bizarre combination of bars...what about today for example...how do we use these off sentiment days as entrys? 

OR

We could just use a system to search for triangles, in an uptrend we enter on the break of the upper line, downtime opposite..appex for initial stop.

Cheers,


----------



## doctorj

What about a short term system that primarily looks for super-high volume.  I've had some luck with back testing entries that rely almost entirely on volume (in combination with only the most rudamentary price based descrimination, such as up or down days) in mid caps and would be interested in exploring it further.


----------



## CFD

tech/a said:


> ~~
> Trading smaller parcels and brokerage becomes a real issue as does very short trades and massive frequency.




Does the capital need to be an issue, given that cfd's brokerage is a percentage! ie 0.1%x2


----------



## happytrader

Well Canaussieuck

Looks like you've got afew takers already; ROnin with his crossing of ema 9 and 13; Tech trading Radge style, your very own penchant for key reversals, triangles and bizarre combinations of pricebars; and Doctorj's taste for high volume. 

Cheers
Happytrader


----------



## CanOz

doctorj said:


> What about a short term system that primarily looks for super-high volume.  I've had some luck with back testing entries that rely almost entirely on volume (in combination with only the most rudamentary price based descrimination, such as up or down days) in mid caps and would be interested in exploring it further.




Excellent idea Doc! So look for volume and then if trend up = long, if trend down = short....what a great simple approach...Anyone ever tested anything like this?

So we need to qualify 'super' with a MA on volume. hmmm....


----------



## R0n1n

I spoke to my mate about that EMA system, he wrote it off the top of his head during lunch hour. asked him to back test it and he says its return is about 17% .

I also think volume should play a role in the system. At the end of day most of the indicators are a derivative of Price, Volume and Time.


----------



## happytrader

R0n1n said:


> I spoke to my mate about that EMA system, he wrote it off the top of his head during lunch hour. asked him to back test it and he says its return is about 17% .
> 
> I also think volume should play a role in the system. At the end of day most of the indicators are a derivative of Price, Volume and Time.




Hi ROn1n

This is so funny! You say this guy trades for a living? Hmm!

Cheers
Happytrader


----------



## R0n1n

he must be making fun of me.... 

what kind of return are we looking for in the system we are working on.

For volume based BUY we could look at a rule like : if a stock has 50% higher than normal volume AND its up 1% on the day.


----------



## CanOz

R0n1n said:


> he must be making fun of me....
> 
> what kind of return are we looking for in the system we are working on.
> 
> For volume based BUY we could look at a rule like : if a stock has 50% higher than normal volume AND its up 1% on the day.




I need to get home and experiment on AmiBroker, but we can use a moving average to define normal, and then decide what is super high volume. 

We can use another ma to ensure we are in a trend when it occurs...this can be an EMA 20 or whatever. You could even buy after a large decline, like a selling climax...take the third consecutive up bar after a high volume trend change....many many options here...lets just keep brainstorming them out....

We're going to need a better MS or AB coder then me though...or else you'll be waiting a few months

Thanks for your input Ron1n.

Cheers,


----------



## wayneL

tech/a said:


> On Waynes adjustable exits.
> Cant use them in a system as the variables have to be fixed.
> Fine for discretionary,but how would you pick which variable to use?



Just a quick clarification.

"Adjustable" was meant for development purposes, to give an eyeball idea what might be interesting to backtest. not that the stops should be adjusted after the system is set.


----------



## CanOz

wayneL said:


> Just a quick clarification.
> 
> "Adjustable" was meant for development purposes, to give an eyeball idea what might be interesting to backtest. not that the stops should be adjusted after the system is set.




Good morning Wayne....whats your thoughts on entries?


----------



## wayneL

CanOz said:


> Good morning Wayne....whats your thoughts on entries?



I reckon for a shorter term system, some sort of pullback, flag or triangle entry is good (but hard to code) as these are lower risk (in terms of stop placement).

Volatility breakouts could be interesting too, but again difficult to code to get the precise setups I'm thinking of.

Not much help I'm afraid


----------



## R0n1n

R0n1n said:


> I spoke to my mate about that EMA system, he wrote it off the top of his head during lunch hour. asked him to back test it and he says its return is about 17% .
> .




as per above I had asked him to back test it and he had said 17%, but got a mail from him with the report from backtest. It says 125% profit... Can someone check the nos please..

he may be playing with my mind....


----------



## tech/a

This looks like a *test on a singular stock *not a portfolio.

Over what period tested?

159 trades with a 2 period average hold smells like a singular test.

Printout looks like tradestation.

Singular tests in isolated periods (He could have selected a single stock in a 12 mth period where it flew),have no statistical significance.
Try 300 stocks over 8 yrs and then 20000 portfolios and you are getting much better.
I also suspect (Most recient peak) he is using ZIG ZAG indicator which cannot be used in systems testing as its Dynamic,in hindsite it appears fixed in practice it isnt fixed until the next Peak or trough is formed at whatever % ZIG ZAG you set. An absolute no no for testing.
Zig Zag is also used for peak and trough indicators.So same applies.

I need the code to run through Tradesim. But suspect its invalid.


----------



## motorway

Is something like this possible ?

I have little experience in what the limitation
of possible code is




1. A low is made. 
2. A rally takes place.
3. Market moves down to a  higher low but at least a certain % higher than the prior low. ( maybe no more than 60% retrace )
4. within 4 or 5 days of that recent low ( would not want this too long );
When,
 Close is > than the previous close.
 Close is > than the close of low in step 1.
 The range is > than previous bar’s range.
 Today's close is > than the mid range of the bar

Go long next bar

for short  reverse the triggers

You would also Need to define the trend these triggers will operate on
maybe from the next time frame up .
eg triggers daily
on a trend defined by weekly 

It would define a pull back entry with the trend long or short
hopefully avoid whipsaws and false breakouts



motorway


----------



## theasxgorilla

nizar said:


> It would make for an interesting study though:
> EOD traders versus IntraDay traders. WHo makes more per year annually in terms of R.O.E ?




The responses to this arguement suggest to me that a lot of people don't understand the science of trading (Not your response Nizar, not at all, I just chose it to post off as you posed the question well).

There is an opportunity factor to any trading system, mechanical or systematic (discretionary).  Call it trade frequency if you like.  The microcosmic nature of markets tends to mean that you can do as some do and zoom in to the 15m, 30m or 1h timeframe and you will see the same trend behaviour and patterns as you do on a daily or weekly timeframe, only with greater frequency.  This can increases the opportunity factor or the trade frequency.  Couple this with leverage (lots of leverage...think CFD 1% margin on indexes type leverage) and with one good trade a month on a single instrument you can achieve better than what others use an end of week system across a universe of stocks.

Of course if you don't know what you're doing the adage, 'speed kills' will apply.


----------



## happytrader

R0n1n said:


> as per above I had asked him to back test it and he had said 17%, but got a mail from him with the report from backtest. It says 125% profit... Can someone check the nos please..
> 
> he may be playing with my mind....




Thats very interesting ROn1n

May I ask whether or not your friend was actually 'invested' in this system.

Cheers
Happytrader


----------



## R0n1n

tech/a said:


> This looks like a *test on a singular stock *not a portfolio.
> 
> Over what period tested?
> 
> 159 trades with a 2 period average hold smells like a singular test.
> 
> Printout looks like tradestation.
> 
> Singular tests in isolated periods (He could have selected a single stock in a 12 mth period where it flew),have no statistical significance.
> Try 300 stocks over 8 yrs and then 20000 portfolios and you are getting much better.
> I also suspect (Most recient peak) he is using ZIG ZAG indicator which cannot be used in systems testing as its Dynamic,in hindsite it appears fixed in practice it isnt fixed until the next Peak or trough is formed at whatever % ZIG ZAG you set. An absolute no no for testing.
> Zig Zag is also used for peak and trough indicators.So same applies.
> 
> I need the code to run through Tradesim. But suspect its invalid.




the code is amibroker, and the report was from it as well.

System used = my Exp1 5
Initial Equity = 100000
Max Open Positions = 6 
Trailing StopLoss = 2%
Round Lot Size = 5
Min Position Value = 5000
All other default settings 

period = 1 year
stocks= my portfolio

*Happytrader* HE is not using this for his usual trade.


----------



## tech/a

R0n1n said:


> the code is amibroker, and the report was from it as well.
> 
> System used = my Exp1 5
> Initial Equity = 100000
> Max Open Positions = 6
> Trailing StopLoss = 2%
> Round Lot Size = 5
> Min Position Value = 5000
> All other default settings
> 
> period = 1 year
> stocks= my portfolio
> 
> *Happytrader* HE is not using this for his usual trade.




Thanks very helpful.

Enjoy your systems developement people.


----------



## CanOz

R0n1n said:


> as per above I had asked him to back test it and he had said 17%, but got a mail from him with the report from backtest. It says 125% profit... Can someone check the nos please..
> 
> he may be playing with my mind....




You should get Amibroker and you could test systems yourself...its definetly Amibroker.

Motorway thanks for the input, so your looking for a trend reversal? Like a failed attempt to put in a double bottom?

Again, i'm not the one to comment on code, Lesm, Mr.Woodo, GP or Kaveman ...to name a few, for Amibroker.

Anyone want to volunteer to test some entries?

I'll go back and run Ron1n's code and see if i get the same report.


Got to find Wayne's posted code too.

Cheers,


----------



## motorway

> Motorway thanks for the input, so your looking for a trend reversal? Like a failed attempt to put in a double bottom?




No buying a pullback in a trend

buying the dips that confirm the trend
By price making  higher lows and moving up

motorway


----------



## CanOz

R0n1n said:


> as per above I had asked him to back test it and he had said 17%, but got a mail from him with the report from backtest. It says 125% profit... Can someone check the nos please..
> 
> he may be playing with my mind....




If you can get the actual code i'll run it too, the report looks like AB....i think it would be good to run it to show you exactly how difficult this is going to be.

Cheers,


----------



## CanOz

R0n1n said:


> the code is amibroker, and the report was from it as well.
> 
> System used = my Exp1 5
> Initial Equity = 100000
> Max Open Positions = 6
> Trailing StopLoss = 2%
> Round Lot Size = 5
> Min Position Value = 5000
> All other default settings
> 
> period = 1 year
> stocks= my portfolio
> 
> *Happytrader* HE is not using this for his usual trade.




The code should look more like this:

Buy = 	Ref(  Close  , -1 ) < Ref(  Open  , -1 )
	AND Ref(  Close  , -1 ) == Ref(  Low  , -1 )
	AND Ref(  Close  , -1 )   >  EMA( Close , 20 ) 
	AND Close   > Ref(  High  , -1 );

Sell = 	Close   < Ref(  Low  , -1 );

What you had there was the back test settings of the code, not entry/exit signals.

How about we try to do a narrative on Motorways idea?

you need to specifiy any conditions etc..then describe what you want...

Lets go with something simple...i'll code up OOPs or something and tack on that Chandelier exit...maybe i'll get that done tonite...who knows...

Cheers,


----------



## happytrader

R0n1n said:


> the code is amibroker, and the report was from it as well.
> 
> System used = my Exp1 5
> Initial Equity = 100000
> Max Open Positions = 6
> Trailing StopLoss = 2%
> Round Lot Size = 5
> Min Position Value = 5000
> All other default settings
> 
> period = 1 year
> stocks= my portfolio
> 
> *Happytrader* HE is not using this for his usual trade.




ROn1n I've got to wonder why this guy would throw you a system off the top of his head that he doesn't actually trade?

Canaussieuck May I ask whether this thread this is a serious attempt to develop a profitable short term leveraged system?

I don't mind if it is not, as it is all entertainment value, however, I would adjust my input accordingly.

Cheers
Happytrader


----------



## lesm

Can,

Happy to help out.

It sounds like you may be using IG Markets for CFDs, with the previous reference to 600 stocks

For anyone that doesn't have them available, I have attached the IG Markets shares lists. One list contains all 600 symbols, the other contains the list of the shortable symbols. These can be imported into AB watchlists or Tradesim.

Cheers.


----------



## R0n1n

happytrader said:


> ROn1n I've got to wonder why this guy would throw you a system off the top of his head that he doesn't actually trade?
> 
> Canaussieuck May I ask whether this thread this is a serious attempt to develop a profitable short term leveraged system?
> 
> I don't mind if it is not, as it is all entertainment value, however, I would adjust my input accordingly.
> 
> Cheers
> Happytrader




I had asked him for a simple system that we could look at and study. I'll get more details off him tomorrow. 

Another point is that if someone has a very successful system, they may be hesitant to share it, specially if they know it gonna go public.

Like you said I am serious about this thread, and the only reason I posted that system is to get some ideas and brainstorm them.


----------



## CanOz

lesm said:


> Can,
> 
> Happy to help out.
> 
> It sounds like you may be using IG Markets for CFDs, with the previous reference to 600 stocks
> 
> For anyone that doesn't have them available, I have attached the IG Markets shares lists. One list contains all 600 symbols, the other contains the list of the shortable symbols. These can be imported into AB watchlists or Tradesim.
> 
> Cheers.




Great thanks Lesm! hmmm, how did you get that?

HT - yeah we're serious, i think there are those that are filled with doubt, but i'm going to do this, one way or another and i thought it would be as beneficial to others as it would be for me if we did this on ASF as opposed to ReefCap....i think those guys could spit one of these out every couple of days if they realy tried.

I think its just facinating that this can actually be done....but we need to work together on this, i need some help here...scour the internet for AmiBroker code when you have time...

The good thing is we can all learn at this as we go.

I'll stick with this as much as i can as long as we all work toward this and not just interject to cause chaos.

Cheers,


----------



## CanOz

The more i look at the Tech Trader code the more i see so many brilliant nuances in it...

I really think it would be good to post the code again, so all can have a look and see why there is so much more to a good system than just entries....

Tech, what do you think?

Cheers,


----------



## wayneL

CanOz said:


> Great thanks Lesm! hmmm, how did you get that?
> 
> HT - yeah we're serious, i think there are those that are filled with doubt, but i'm going to do this, one way or another and i thought it would be as beneficial to others as it would be for me if we did this on ASF as opposed to ReefCap....i think those guys could spit one of these out every couple of days if they realy tried.
> 
> I think its just facinating that this can actually be done....but we need to work together on this, i need some help here...scour the internet for AmiBroker code when you have time...
> 
> The good thing is we can all learn at this as we go.
> 
> I'll stick with this as much as i can as long as we all work toward this and not just interject to cause chaos.
> 
> Cheers,



Worth being fair dinkum. Look what came out with techtrader. I'm sure even if folks don't use the exact sytem, they will have come away with great ideas of there own based on it.

Chuck LeBeau of system traders club (whatever happened to that?) suggested and atr*3 chandelier trailing stop. My own testing has 3.5 ATR as a good value.

This would obviously be for a more medium term system (Several weeks - months)

NB Submitted as idea for consideration only


----------



## CanOz

wayneL said:


> Worth being fair dinkum. Look what came out with techtrader. I'm sure even if folks don't use the exact sytem, they will have come away with great ideas of there own based on it.
> 
> Chuck LeBeau of system traders club (whatever happened to that?) suggested and atr*3 chandelier trailing stop. My own testing has 3.5 ATR as a good value.
> 
> This would obviously be for a more medium term system (Several weeks - months)
> 
> NB Submitted as idea for consideration only




Thanks Wayne, and thanks for the code too, saved them!

Cheers,


----------



## wayneL

Some thoughts:

The time horizon of the trade is largely a function of the trailing exit (presuming for a moment we don't use targets. The wider the trailing exit, the longer we stay in the trade... and also the more we give back at the end of the trend when it bends.

But we also need to consider the "normal" wave structure of price movement. With short term systems we need to do one of two things.

1/ ride out reasonable retracements in the medium trend by having our exit wider than these normal retracements
2/ avoid the retracements and try to exit before they happen - swing trading.

If 1/ then exits need to be wide enough to not infuriatingly take us out of trades just as they turn and resume their trend. This really takes us resolutely into medium term trend trades.

If 2/ then I'm a bit suspect that it can be done mechanically... or end of day mechanically at least. (could be very wrong however)

In any case this is going to make quite a contrast in time horizon between these two objectives. Perhaps we need to define this first.

Cheers


----------



## It's Snake Pliskin

tech/a said:


> Seriously Using a short term EMA like the above is going to get whipsawed to death.
> Ive tested enough of these to know you'll go broke in super quick time.
> Your mate worries me!!
> Nicholas Radge should be along soon to help out.
> I dont wish to Hijack this thread (Special cheerio to Snake).




Actually I would say your input is good t/a. It has stayed on track.

Can,
You need to tabulate the chosen parameters etc so we are all aware of them without having to read the whole thread. In your own time and there is no pressure from me.

Cheers


----------



## Nick Radge

It seems everyone is creeping back toward a trend following system. That's fine, but its been done with Tech Trader. Maybe Tech can post his code somewhere as a seperate reference and we continue on the short-term CFD thing here?

I'll put forward an idea and one that can be "eyeballed" and then "calculated". This will enable those without software to follow along.

A major belief of mine is that one needs to understand *WHY* a system will make money. With short term trading we need to get as much "bang for buck" as we can in a small amount of time. We don't want to hand around waiting for a sustained trend to get going. We want a result and we want it quickly. A quick result comes from an increase in volatility and an increase in volatility comes from a contraction in volatility. One follows the other - just look at any bollinger band and you see the action.

Therefore, if one is wants a quick move that comes from an increase in volatility then one should look for a the contraction of volatility that will be a precursor to the required move.

Now, this was done elsewhere in May 2001. I will not paste the link to those 6-pages out of respect to Joe, but anyone interested can PM me for that link.

So, we need to define a period of low volatility, but we also need to be able to "eyeball" it. How about this:







Here we have a simple pattern that has 3-days contracting. It's easy to see on a chart, it happens with enough frequency to be useful for trading and it fits with our theory of volatility.

Should we build on this?


----------



## tech/a

Nick.

Like all good "teams" there needs to be a leader.

*I'm suggesting to the participants of this thread to allow you to "Head up" the discussion.*

With everyone discussing whats offered up by Nick and others in discussion.

*Rather than bumbling along with no cohesion.*

The thread will just become disjointed with no format.



Needless discussion on a system which cant be dissected (I have one which returns 100% success rate but when the experienced see the code they know why---novices get all stary eyed and cheque crazy). just take up space.

*I'm sure you'll all find that in the end its the Journey through building a system that will be far more rewarding and educational than the actual resultant system.*


I say lead on Nick.


----------



## nizar

wayneL said:


> Worth being fair dinkum. Look what came out with techtrader. I'm sure even if folks don't use the exact sytem, they will have come away with great ideas of there own based on it.
> 
> Chuck LeBeau of system traders club (whatever happened to that?) suggested and atr*3 chandelier trailing stop. My own testing has 3.5 ATR as a good value.
> 
> This would obviously be for a more medium term system (Several weeks - months)
> 
> NB Submitted as idea for consideration only




Chuck LeBeau is a legend. Lots of mention of him in trading books.
I heard from an experienced trader that 3.5*ATR was a good stop as well.


----------



## nizar

wayneL said:


> Some thoughts:
> 
> The time horizon of the trade is largely a function of the trailing exit (presuming for a moment we don't use targets. The wider the trailing exit, the longer we stay in the trade... and also the more we give back at the end of the trend when it bends.
> 
> But we also need to consider the "normal" wave structure of price movement. With short term systems we need to do one of two things.
> 
> 1/ ride out reasonable retracements in the medium trend by having our exit wider than these normal retracements
> 2/ avoid the retracements and try to exit before they happen - swing trading.
> 
> If 1/ then exits need to be wide enough to not infuriatingly take us out of trades just as they turn and resume their trend. This really takes us resolutely into medium term trend trades.
> 
> If 2/ then I'm a bit suspect that it can be done mechanically... or end of day mechanically at least. (could be very wrong however)
> 
> In any case this is going to make quite a contrast in time horizon between these two objectives. Perhaps we need to define this first.
> 
> Cheers





Tend to agree wholly with these.

Longterm trading is where the money is. Maybe thats why we are focussing on that.


----------



## nizar

Nick Radge said:


> A major belief of mine is that one needs to understand *WHY* a system will make money. With short term trading we need to get as much "bang for buck" as we can




But do we really?
(No disrespect, obviously you really know your stuff).

I remember reading in a book about how Ed Seykota started out, looking at Richard Donchians work about mechanical systems. Ed was saying he couldnt understand why mechanical systems outperform human discretion, but then he said, he doesnt think he needs to. The point is, it does.


----------



## CanOz

nizar said:


> But do we really?
> (No disrespect, obviously you really know your stuff).
> 
> I remember reading in a book about how Ed Seykota started out, looking at Richard Donchians work about mechanical systems. Ed was saying he couldnt understand why mechanical systems outperform human discretion, but then he said, he doesnt think he needs to. The point is, it does.




I see what your trying to say Nizar but i think they're different points.

Cheers,


----------



## nizar

CanOz said:


> I see what your trying to say Nizar but i think they're different points.
> 
> Cheers,




Can,

Why do you want to focus on short-term?
And others as well, why?

I seriously want to know, because i thought the way to clean up the markets was from riding long term trends...

Any evidence out there that short-term methods may/can perform better?


----------



## CanOz

nizar said:


> Can,
> 
> Why do you want to focus on short-term?
> And others as well, why?
> 
> I seriously want to know, because i thought the way to clean up the markets was from riding long term trends...
> 
> Any evidence out there that short-term methods may/can perform better?




I think your missing the point again, we wanted to design a system, a system that was different to Tech Trader in the fundemental way, ie. short term instead of long term...

The testing will prove whether it has an equal performance factor or not.

Cheers,

Also, I'm all for Nick leading the team here...no ego problem here, thats for sure! lol!


----------



## tech/a

nizar said:


> Can,
> 
> Why do you want to focus on short-term?
> And others as well, why?
> 
> I seriously want to know, because i thought the way to clean up the markets was from riding long term trends...
> 
> Any evidence out there that short-term methods may/can perform better?





Because its *OLD GROUND*.
If you want to study a proven longterm fully disclosed method then go here.

http://lightning.he.net/cgi-bin/suid/~reefcap/ultimatebb.cgi?ubb=forum;f=74

And you can have a higher annual return on capital trading shorter term---much much higher. Takes more time and effort to trade,stronger psychology,and better UNDERSTANDING of APPLICATION,but I've proven it myself.(to myself)


----------



## happytrader

Good morning Canaussieuck/Nick

Moving along, can we have some feedback on specifics like which stocks and the optimal number of them we will be focusing on as well as starting capital and stop losses?

Submitted for consideration: Personally I prefer bluechips as there is enough movement within a weekly range to make excellent money. 

Cheers
Happytrader


----------



## nizar

tech/a said:


> Because its *OLD GROUND*.
> If you want to study a proven longterm fully disclosed method then go here.
> 
> http://lightning.he.net/cgi-bin/suid/~reefcap/ultimatebb.cgi?ubb=forum;f=74
> 
> And you can have a higher annual return on capital trading shorter term---much much higher. Takes more time and effort to trade,stronger psychology,and better UNDERSTANDING of APPLICATION,but I've proven it myself.(to myself)




OLd ground for you, my friend 

But fair enough, point taken, we can move on now.

Tech, just one point, have you proven it to yourself by trading short-term mechanically? I suspect you are talking about discretionary trading, well thats a different ball game


----------



## CanOz

happytrader said:


> Good morning Canaussieuck/Nick
> 
> Moving along, can we have some feedback on specifics like which stocks and the optimal number of them we will be focusing on as well as starting capital and stop losses?
> 
> Submitted for consideration: Personally I prefer bluechips as there is enough movement within a weekly range to make excellent money.
> 
> Cheers
> Happytrader




Ok, just give me a bit of time here to get settled into my day job....how about i recap where we are....it might be a while...looking like a busy day here....Happy, you got some time to recap for us?

Cheers,


----------



## tech/a

nizar said:


> OLd ground for you, my friend
> 
> But fair enough, point taken, we can move on now.
> 
> Tech, just one point, have you proven it to yourself by trading short-term mechanically? *I suspect you are talking about discretionary trading,* well thats a different ball game




No not entirely.
More a Systematic approach.
Not fully tested other than walk forward testing and results.
Different YES but the structure still comes from the principals learned from Systems developement.

You'll find as you learn the principals over the years presented by those who use them that it becomes crystal clear what is required in a profitable trading system/plans makeup.

The real key is having those NUMBERS from extensive testing.
I personally wont place decient Capital into trading methodologies/ideas unless I have them!


----------



## happytrader

CanOz said:


> Ok, just give me a bit of time here to get settled into my day job....how about i recap where we are....it might be a while...looking like a busy day here....Happy, you got some time to recap for us?
> 
> Cheers,



Hi Canuassieuck here is a recap in summary. I'm not good at this stuff so if I have distorted anyones message please feel free to correct me and expand your idea. All areas are up for discussion.

*Objective*

*A cohesive team effort to develop a short term leveraged with CFDs, mechanical, trend following, trading system which incorporates longs, shorts and guaranteed stop losses*. 

Lesm provided attachments from IG markets with _share lists and codes for CFDs _

*Timeframe*

Short term

*Entries *

Motorway made reference to _confirmation of the trend and entry on a dip or pullback._

Canaussieuck: _Key reversal_

Doctorj: _super-high volume_

ROn1n: _crossing EMA_

Nick explained quick, profitable moves come from an increase in volatility, therefore _we need to define periods of low volatility_ - chart pattern submitted by Nick for discussion

*Exits*

Wayne explained that with regard to swing trading we have 2 choices _1. ride out reasonable retracements within the trend or 2. avoid them all together._

*Stock selection*

Happytrader suggested _bluechips_

*Stoplosses*

Cfd: _stop losses should be guaranteed_

Nizar uses _0.5 - 1%_

Cheers
Happytrader


----------



## It's Snake Pliskin

nizar said:


> But do we really?
> (No disrespect, obviously you really know your stuff).
> 
> I remember reading in a book about how Ed Seykota started out, looking at Richard Donchians work about mechanical systems. Ed was saying he couldnt understand why mechanical systems outperform human discretion, but then he said, he doesnt think he needs to. The point is, it does.




I totally agree with Nick on understanding the WHY does it work mindset.

Without understanding one becomes dangerous. A bit like reading religious books and believing without critical thoughts to the contrary. Trading books have the same power over beginners.


----------



## tech/a

I'm a little bemused at the responses here.

You've got a very experienced Systems designer in Radge who has stepped forward and offered up his input---along with a suggested kick off.
Ive subtly hinted that your all getting tied up with the end result and not the journey of the learning experience which will stead you fast for ANY system you wish to design in the future.---all basically ignored.

Thats why I've taken the view of --Goodluck with your systems design.

I'm *not* speaking for Nick.


----------



## Nick Radge

> But do we really?




Yes we do and you even answered the question yourself: Trend Following.

Why does it work? Markets will always trend. Than can't _*NOT*_ trend. A trend allows gains to be larger than losses, assuming one takes action to cut a loss. A trend appears on every time frame - from 1-minute to yearly, take your pick. The principle remains the same throughout and is _*WHY*_ profits are easily generated by following trends. Toby Crabel follows short term trends. Seykota follows longer term trends. Both are profitable..

I don't wish to takeover this thread so I will simply offer to point you in directions but also alert you to area's for consideration.

The first thing was that we'd find this a difficult task because everyone has a different personality, but also because everyone has a different experience in certain area's. 

Secondly, forget this stuff about CFD margins, GSL's and risk at this stage. You'll get bogged down in semantics which will be dealt with later. 

Start from a perspective that you have been offered a new job at a prop shop. You walk in to your new job, sit at your desk. Your instructions are simple:


You can trade the ASX-200
You can lose a maximum of $25,000 (we can amend this)
You will be paid a percentage of your monthly profits
Everything else is inconsequential; margins, GSL, blah blah

What are you going to do?


----------



## nizar

Thanks for your responses tech, Snake, Nick.

Im just a beginner like you said Snake, im not going to argue with that.
Thanks all for teaching me


----------



## It's Snake Pliskin

Nick Radge said:


> Yes we do and you even answered the question yourself: Trend Following.
> 
> Why does it work? Markets will always trend. Than can't _*NOT*_ trend. A trend allows gains to be larger than losses, assuming one takes action to cut a loss. A trend appears on every time frame - from 1-minute to yearly, take your pick. The principle remains the same throughout and is _*WHY*_ profits are easily generated by following trends. Toby Crabel follows short term trends. Seykota follows longer term trends. Both are profitable..
> 
> I don't wish to takeover this thread so I will simply offer to point you in directions but also alert you to area's for consideration.
> 
> The first thing was that we'd find this a difficult task because everyone has a different personality, but also because everyone has a different experience in certain area's.
> 
> Secondly, forget this stuff about CFD margins, GSL's and risk at this stage. You'll get bogged down in semantics which will be dealt with later.
> 
> Start from a perspective that you have been offered a new job at a prop shop. You walk in to your new job, sit at your desk. Your instructions are simple:
> 
> 
> You can trade the ASX-200
> You can lose a maximum of $25,000 (we can amend this)
> You will be paid a percentage of your monthly profits
> Everything else is inconsequential; margins, GSL, blah blah
> 
> What are you going to do?



tech,
I think you could learn from Nick's style instead of spitting the dummy.
Anything further is much appreciated.
Snake


----------



## CanOz

Nick Radge said:


> Yes we do and you even answered the question yourself: Trend Following.
> 
> Why does it work? Markets will always trend. Than can't _*NOT*_ trend. A trend allows gains to be larger than losses, assuming one takes action to cut a loss. A trend appears on every time frame - from 1-minute to yearly, take your pick. The principle remains the same throughout and is _*WHY*_ profits are easily generated by following trends. Toby Crabel follows short term trends. Seykota follows longer term trends. Both are profitable..
> 
> I don't wish to takeover this thread so I will simply offer to point you in directions but also alert you to area's for consideration.
> 
> The first thing was that we'd find this a difficult task because everyone has a different personality, but also because everyone has a different experience in certain area's.
> 
> Secondly, forget this stuff about CFD margins, GSL's and risk at this stage. You'll get bogged down in semantics which will be dealt with later.
> 
> Start from a perspective that you have been offered a new job at a prop shop. You walk in to your new job, sit at your desk. Your instructions are simple:
> 
> 
> You can trade the ASX-200
> You can lose a maximum of $25,000 (we can amend this)
> You will be paid a percentage of your monthly profits
> Everything else is inconsequential; margins, GSL, blah blah
> 
> What are you going to do?




Well i know what i'm going to do.....

Make some rules for my system before i code it!

Rule No.1 - I can only risk 2% of my capital on any trade

No.2 - I must move my stop to breakeven ASAP. 

C'mon, lets throw out some more rules!

(Nick please interject if i'm on the wrong track here.)

Cheers,


----------



## wayneL

Let's start with some building blocks then. For a public system, it has to work EOD, so medium term trends?

Building block 1: I personally like to start with the trailing exit as this will tend to define everything else.

As a starting point, shall we go for 3.5 ATR? or perhaps 20-30ema of the lows? What do we think?


----------



## tech/a

Snake.
Ive been learning off of Radge for years.
When this guy gets involved for no fee---everyone learns including me.

That was/is the whole point of my dummy spit.
Encourage his input--- most here ignored it!

He's got a lot more patience than I have.
Anyway up and at em.


----------



## happytrader

wayneL said:


> Let's start with some building blocks then. For a public system, it has to work EOD, so medium term trends?
> 
> Building block 1: I personally like to start with the trailing exit as this will tend to define everything else.
> 
> As a starting point, shall we go for 3.5 ATR? or perhaps 20-30ema of the lows? What do we think?




Hi Wayne

Does EOD data mean entering within the last hour of trading when a trend is identified or does it mean looking at EOD to decide what to do the next day?

Cheers
Happytrader


----------



## nizar

happytrader said:


> Hi Wayne
> 
> Does EOD data mean entering within the last hour of trading when a trend is identified or does it mean looking at EOD to decide what to do the next day?
> 
> Cheers
> Happytrader




The latter.
EOD traders do their analysis after the markets close.


----------



## happytrader

nizar said:


> The latter.
> EOD traders do their analysis after the markets close.




Hi Nizar

If we are seeking to enter the market in a period defined as low volatility and since we know the first hour of the market is one of high volatilaty, when do we enter? The point I am getting at is, if you are using EOD data your values would be the equivalent of hindsight trading.

Cheers
Happytrader


----------



## Kauri

I may be way off track here but a whiles ago I set off to develop a mechanical system... from my diary I note the first stages i listed to be dealt with....

  Trade what.... shares
  Universe.........ASX300
  TimeFrame......EOD
  Direction.........Long/short
  Time in...........Short-Medium term

  Capital available....XXXXX
  Max amount per trade...xxxx
  Pyramid.........yes

  Trend filter.....
  Buy signals.....
  Sell signals.....  

  et al......

  From there I moved on to CFD/margin/risk management etc once I had the above as a profitable propisition..

  Cheers
           Kauri


----------



## tech/a

End of day means you'll be using EOD data and selling on NEXT open from any trigger to buy or sell.
This is a system so it wont care about Morning volatility blah.

In the end you'll have a set of parameters that if traded as designed and tested will return the expectancy found through testing.
What you get with a system is a repetitive entry and exit which over time will give the sested return within the upper and lower boundaries of the returns found through testing.


----------



## nizar

tech/a said:


> End of day means you'll be using EOD data and selling on NEXT open from any trigger to buy or sell.
> This is a system so it wont care about Morning volatility blah.
> 
> In the end you'll have a set of parameters that if traded as designed and tested will return the expectancy found through testing.
> What you get with a system is a repetitive entry and exit which over time will give the sested return within the upper and lower boundaries of the returns found through testing.




What you just said is so textbook Tech.
You should be a sales rep for TradeSim.
You wouldve sold me a package! 
LOL joke


----------



## CanOz

Kauri said:


> I may be way off track here but a whiles ago I set off to develop a mechanical system... from my diary I note the first stages i listed to be dealt with....
> 
> Trade what.... shares
> Universe.........ASX300
> TimeFrame......EOD
> Direction.........Long/short
> Time in...........Short-Medium term
> 
> Capital available....XXXXX
> Max amount per trade...xxxx
> Pyramid.........yes
> 
> Trend filter.....
> Buy signals.....
> Sell signals.....
> 
> et al......
> 
> From there I moved on to CFD/margin/risk management etc once I had the above as a profitable propisition..
> 
> Cheers
> Kauri




Thanks for that Kauri, Wayne, Tech, Nizar Happy.And thanks again to Nick for the continued directions. I'm flying blind here so i really appreciate your help on this. Nick, is it a similar matter to going through the systematic trading plan as you present on your course, then coding and testing it all?

Lets get that down so we can move on:

Trade what.... CFD's
Universe.........600 IG MArkets long/short CFD list
TimeFrame......EOD
Direction.........Long/short
Time in...........Short-Medium term

Capital available....25,000
Max amount per trade...2% FFP???
Pyramid.........yes with Fluid fixed fractional pos.

Entry- a reduced volitility pattern - yet to be clearly defined
Initial stop at technical support
Breakeven  Stop ASAP (breakeven 2xinitial stop distance)
Trailing stop - ATR 
Exposure Stop - ????

Cheers,


----------



## happytrader

CanOz said:


> Thanks for that Kauri, Wayne, Tech, Nizar Happy.And thanks again to Nick for the continued directions. I'm flying blind here so i really appreciate your help on this. Nick, is it a similar matter to going through the systematic trading plan as you present on your course, then coding and testing it all?
> 
> Lets get that down so we can move on:
> 
> Trade what.... CFD's
> Universe.........600 IG MArkets long/short CFD list
> TimeFrame......EOD
> Direction.........Long/short
> Time in...........Short-Medium term
> 
> Capital available....25,000
> Max amount per trade...2% FFP???
> Pyramid.........yes with Fluid fixed fractional pos.
> 
> Entry- a reduced volitility pattern - yet to be clearly defined
> Initial stop at technical support
> Breakeven  Stop ASAP (breakeven 2xinitial stop distance)
> Trailing stop - ATR
> Exposure Stop - ????
> 
> Cheers,




Canaussieuck, Would you consider increasing trade position amounts to 10% or up to $2,500 per trade? I believe this would reduce the tendency to overtrade and ensure that traders are particularly careful when it comes to fulfilling entry, profit, loss and risk criteria regarding trade selection.

Cheers
Happytrader


----------



## CanOz

happytrader said:


> Canaussieuck, Would you consider increasing trade position amounts to 10% or up to $2,500 per trade? I believe this would reduce the tendency to overtrade and ensure that traders are particularly careful when it comes to fulfilling entry, profit, loss and risk criteria regarding trade selection.
> 
> Cheers
> Happytrader




Well the reason i said FFR of 2% was to address all of those, however i'm not sure if a system can allocate capital in this manner, i'm just too inexperienced in this to tell....thats why i had the ??? marks.

Are you familiar with Fixed Fractional Positioning Happy?

Its an awesome concept. I'll find a link.

Cheers,


----------



## CanOz

Nick Radge said:


> It seems everyone is creeping back toward a trend following system. That's fine, but its been done with Tech Trader. Maybe Tech can post his code somewhere as a seperate reference and we continue on the short-term CFD thing here?
> 
> I'll put forward an idea and one that can be "eyeballed" and then "calculated". This will enable those without software to follow along.
> 
> A major belief of mine is that one needs to understand *WHY* a system will make money. With short term trading we need to get as much "bang for buck" as we can in a small amount of time. We don't want to hand around waiting for a sustained trend to get going. We want a result and we want it quickly. A quick result comes from an increase in volatility and an increase in volatility comes from a contraction in volatility. One follows the other - just look at any bollinger band and you see the action.
> 
> Therefore, if one is wants a quick move that comes from an increase in volatility then one should look for a the contraction of volatility that will be a precursor to the required move.
> 
> Now, this was done elsewhere in May 2001. I will not paste the link to those 6-pages out of respect to Joe, but anyone interested can PM me for that link.
> 
> So, we need to define a period of low volatility, but we also need to be able to "eyeball" it. How about this:
> 
> 
> 
> 
> 
> 
> 
> Here we have a simple pattern that has 3-days contracting. It's easy to see on a chart, it happens with enough frequency to be useful for trading and it fits with our theory of volatility.
> 
> Should we build on this?




Just to get back to this, i might try a narrative for it, anyone jump in here.

The ATR of the current bar is less than 1 bar before
The ATR of 1 bar ago is less than that of 2 bar before

Now, should we put a condition in for the trend? Like an MA? See chart.


----------



## professor_frink

ATR mightn't be the way to go with that canuck. Might be better off using the daily range(H-L) to measure each day.

Have a read of this link on ATR-

http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr

ATR won't always be the high - low figure.

Someone else correct me if I'm wrong here, as I've never really used ATR at all.

I think code-wise, you would want it to look something like this-



> range = H - L;
> buy = range < ref(range,-1) AND ref(range,-1) < ref(range,-2);




Or something like that(far from a coding guru)


----------



## tech/a

I'm going to attempt to help out here.

Firstly when your looking at trading a System you really do have to alter your thinking.
System doesnt equate to best entries and exits.

It does equate to a consistent entry and exit plan.
Each trade will have very varied results. 
Some being stopped.
Some with Huge wins relative to risk
Many with moderate wins

Some of this Ive learnt from Radge.
But to increase profit you need either 
To trade more winners than losers Over 50% is good but not absolutely necessary
To Have much larger winners than losers,IE a high reward to risk ratio.
Ideally a combination of both.

This will form the basis of Nicks *WHY.*

With a short term system Nick is referring to trade frequency.
As trades will be shorter then the Reward to Risk will be lower than a longer term system.Mine (Longerterm) run at between 7-12:1 reward to risk.
Most short term methods achieve 1.5-3.5 reward to Risk.
So if you can trade more times with this return in the shortest possible time then you'll soon a mass huge profit over time.

Nicks *bang for buck filter *which has been coded for both Metastock and Amibroker once run against any entry will identify the highest volatility.
Most systems spit out many potential trades---what Nick is saying is be selective---particularly short term---those with highest volitility have highest chance of quick moves and hence quick return---then off to the next!

So to Nicks suggestion.
He points out that Volatility follows contraction in volatility.
This pattern which is simply 3 inside days demonstrates this.
There are many similar patterns both larger and some more complex.




Here pricebegins with a wide range bar and contracts over 2 bars.
This would fit very well with Motorways VSA analysis I'm sure as normally volume also contracts as supply dries up.
Even better on the smallest contraction indise day bar volume REAPPEARS!

Anyway that was more or less I think what Nick was hoping you'd cotten on to.

For those really interested in knowing your ATR
Here is a great explaination.
http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:average_true_range_atr


----------



## theasxgorilla

CanOz said:


> I think your missing the point again, we wanted to design a system, a system that was different to Tech Trader in the fundemental way, ie. short term instead of long term...
> 
> The testing will prove whether it has an equal performance factor or not.
> 
> Cheers,
> 
> Also, I'm all for Nick leading the team here...no ego problem here, thats for sure! lol!




I tend to echo Nizar's perspective, as I think they're genuine questions and within context of the discussion.

Drawbacks to TechTrader as I see them are 1. Only trades to the long side, 2. Potentially large drawdown when the trend (finally) bends.

Due to point 1, when the trend does bend you won't make-up for the drawdown in a bear market as the system doesn't reverse posture.  Otherwise, I think that a leveraged Tech-Trader style mechanical system must be one of the most effective ways to consistantly profit in this market.  I'm interested to see if a short term CFD-based system can provide an advantage in the form of 1. trades to the short side, 2. lower and/or fewer drawdowns over time and/or 3. greater overall expectancy.

The pseudo-code for a technical setup like Nick's 'double-inside' pattern might be:

IF { High islessthan High(of yesterdays bar) AND 
    Low > Low(of yesterdays bar) AND 
    High(of yesterdays bar) < High(of the bar two days ago) AND
    Low(of yesterdays bar) > Low(of the bar two days ago) THEN
    SETUP=true }
ELSE {
    SETUP=false }

This does not include any code to qualify whether "the bar two days ago" was of higher relative volatility.


----------



## nizar

CanOz said:


> *Initial stop at technical support*
> Breakeven  Stop ASAP (breakeven 2xinitial stop distance)
> Trailing stop - ATR
> Exposure Stop - ????
> 
> Cheers,




This wouldnt be mechanical and cannot be made mechanical.
Or do you want to use discretion for (initial) stop placement?

WHy dont we try a %. Like 10% initial stop maybe?? Tech i think your T/T uses something similar.


----------



## theasxgorilla

professor_frink said:


> I think code-wise, you would want it to look something like this-
> 
> range = H - L;
> buy = range < ref(range,-1) AND ref(range,-1) < ref(range,-2);




This will work if you don't care that the H or L of each bar may lie outside the range of the preceding bar.  By doing this you tend to miss the pattern, which is a micro-triangle, a la often found in the position of an Elliott Wave 4, hence followed by a Wave-5 and subsequently the target area for an ensuing A-B-C correction ie. nice place to have a stop just outside of.


----------



## theasxgorilla

nizar said:


> This wouldnt be mechanical and cannot be made mechanical.
> Or do you want to use discretion for (initial) stop placement?
> 
> WHy dont we try a %. Like 10% initial stop maybe?? Tech i think your T/T uses something similar.




It's entirely possible to place a stop at a programmable technical support level.  Ed Seykota's support/resistance system does exactly this.  It's not the type of discretionary support/resistance zoning that most people think of ie. look at the chart on a large time frame and see where price activity has become range bound or been turned around...but for an initial and/or trailing stop in a mechanical system it could suffice.


----------



## nizar

theasxgorilla said:


> It's entirely possible to place a stop at a programmable technical support level.  Ed Seykota's support/resistance system does exactly this.  It's not the type of discretionary support/resistance zoning that most people think of ie. look at the chart on a large time frame and see where price activity has become range bound or been turned around...but for an initial and/or trailing stop in a mechanical system it could suffice.




Thanks for that ASXG.
I had no idea.

Do you know exactly how to do this with amibroker/metastock or would it require some other software?


----------



## happytrader

Hi all

I would like to make the point that a "near enough is good enough" attitude is only acceptable for long term systems.

However, with a short term system like the one we are developing, every aspect of it must be planned and specific because when using leverage you do not have the cushion of time to fall back on. 

That is why I'm suggesting that once you have identified a possible trade that meets with all other criteria you confine entry times to the 5th hour of trade. 

Cheers
Happytrader


----------



## tech/a

happytrader said:


> Hi all
> 
> I would like to make the point that a "near enough is good enough" attitude is only acceptable for long term systems.
> 
> However, with a short term system like the one we are developing, every aspect of it must be planned and specific because when using leverage you do not have the cushion of time to fall back on.
> 
> That is why I'm suggesting that once you have identified a possible trade that meets with all other criteria you confine entry times to the 5th hour of trade.
> 
> Cheers
> Happytrader




Happy we are talking Short term *not* day trading or a few days trading.
I agree if your down to these timeframes but you'll need realtime data to test.
I dont think thats whats in mind.

The system will spit out the numbers and missing the first hour of trading for an entry can and often is costly.Swings and roundabouts.

Attempting to perfectly time entry and exits will send you round the twist and its NOT necessary---as you understand system structure and what you achieve by trading one you'll understand.

I think you also presume that longterm system traders like myself dont trade or design shorter term systems.I'm playing with a concept now have been for a few months..


----------



## lesm

Just to keep things moving I have thrown some initial sample code together that people can have a look at, modify, add to, improve and focus discussion.

Run it as an exploration in AB.

Cheers.



		Code:
	

/* 

ASF Sample System Development

*/

NumColumns = 3;

VolRatio =  StDev(log(C/Ref(C,-1)),5) / StDev(log(C/Ref(C,-1)),99);
Column0 =  VolRatio;
Column0Name = "VolRatio";

InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
Column1 =  InsideDay1;
Column1Name = "Inside Day 1";

InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
Column2 =  InsideDay2;
Column2Name = "Inside Day 2";

Filter = InsideDay1 == 1 AND InsideDay2 == 1;

Buy = Filter;


----------



## Edwood

sorry to butt in - here's a possible short term strategy to test.  1min, 10day, 233period MA looking for price crossing the MA.  appears to be a few points up for grabs.  prob have to change the MA period for all-seshuns data


----------



## CanOz

happytrader said:


> Hi all
> 
> I would like to make the point that a "near enough is good enough" attitude is only acceptable for long term systems.
> 
> However, with a short term system like the one we are developing, every aspect of it must be planned and specific because when using leverage you do not have the cushion of time to fall back on.
> 
> That is why I'm suggesting that once you have identified a possible trade that meets with all other criteria you confine entry times to the 5th hour of trade.
> 
> Cheers
> Happytrader




End of Day is best for me, i can't watch the screen all day.

ATR - thanks guys...i feel a bit embarrassed...especially after i just completed Nick's course and he mentions it in the Chandelier stop...

Good discussion going on!

Cheers,


----------



## Synergy

This all seems like fun...

Interesting idea to do it as a group. I've been trying to develop a very similar type of system for the past few months but started out knowing nothing at all. Hence not very far advanced.

The hardest thing i have found is that the smallest changes can have huge impacts, and the results of changes are sometimes very hard to understand. 

Learnt a lot reading this already so will be watching closely.

Cheers


----------



## happytrader

tech/a said:


> Happy we are talking Short term *not* day trading or a few days trading.
> I agree if your down to these timeframes but you'll need realtime data to test.
> I dont think thats whats in mind.
> 
> The system will spit out the numbers and missing the first hour of trading for an entry can and often is costly.Swings and roundabouts.
> 
> Attempting to perfectly time entry and exits will send you round the twist and its NOT necessary---as you understand system structure and what you achieve by trading one you'll understand.
> 
> I think you also presume that longterm system traders like myself dont trade or design shorter term systems.I'm playing with a concept now have been for a few months..




Hi Tech

All time frames including hourly charts are easily and freely available www.bigcharts.com. Tech, what happened to implementing Nicks guidance about defining a period of low volatility to take advantage of the high volatility which occurs in the first hour of trading? Aren't you in fact suggesting doing the opposite? Trying to position yourself in a trade in the first hour is far more risky, stressful and will send you round the twist faster than entering in the last hour. In fact on R0n1n's Entry thread, you suggested not trading the first hour. Missing out is only an emotion not a reason.

I presume nothing about long term system traders such as yourself, but I can spot the difference a mile off. Nothing wrong with either, just different mindsets. Anyways, hows your short term concept coming along?

Canaussieuck there is no need to look at charts all day just afew minutes at key times during the day.

Cheers
Happytrader


----------



## theasxgorilla

nizar said:


> Thanks for that ASXG.
> I had no idea.
> 
> Do you know exactly how to do this with amibroker/metastock or would it require some other software?




Amibroker...the entire system, including a hook-in to the back-tester.

http://www.amibroker.com/library/detail.php?id=735

It may not be what those developing this system are looking for.  It simply takes the highest low for X periods (or lowest high if short) and calls that the stop/exit.  As applied the above code to GOLD future data; winners: average bars held was 60 (12 weeks*) losers: average bars held was 25 (5 weeks*).

* Assuming 5 trading days to a week.

His entire system is based around using support/resistance to define the trend and position entries, exits and stops.  Interesting all the same, but as I said, perhaps not useful for what seems to be taking form here.


----------



## tech/a

happytrader said:


> Hi Tech
> 
> All time frames including hourly charts are easily and freely available www.bigcharts.com. Tech, what happened to implementing Nicks guidance about defining a period of low volatility to take advantage of the high volatility which occurs in the first hour of trading? Aren't you in fact suggesting doing the opposite? Trying to position yourself in a trade in the first hour is far more risky, stressful and will send you round the twist faster than entering in the last hour. In fact on R0n1n's Entry thread, you suggested not trading the first hour. Missing out is only an emotion not a reason.
> 
> 
> Canaussieuck there is no need to look at charts all day just afew minutes at key times during the day.
> 
> Cheers
> Happytrader




Not for Systems testing I'm afraid.(Downloadable historical Tick or Minute  data.)

Have 2 in place currently.One is currently running at 80% on capital over 9 mths and I only trade it periodically---(Running Businesses is time consuming---Particularly in the Construction Industry).
New concept coming along nicely.
Its setting up the softare and computers which is taking the time. Its out of the square.

Does anyone here have intraday data and tesing capability.
If so i'm sure you'll find that (For stocks) time of day entry is not a biggie.
Futures---different.



> I presume nothing about long term system traders such as yourself, but I can spot the difference a mile off.




I know what you mean.
I have the same ability in spotting novices.


----------



## happytrader

tech/a said:


> Not for Systems testing I'm afraid.(Downloadable historical Tick or Minute  data.)
> 
> Have 2 in place currently.One is currently running at 80% on capital over 9 mths and I only trade it periodically---(Running Businesses is time consuming---Particularly in the Construction Industry).
> New concept coming along nicely.
> Its setting up the softare and computers which is taking the time. Its out of the square.
> 
> Does anyone here have intraday data and tesing capability.
> If so i'm sure you'll find that (For stocks) time of day entry is not a biggie.
> Futures---different.
> 
> 
> 
> I know what you mean.
> I have the same ability in spotting novices.




Hi Tech

As Nick has said If we are to get more 'bang for bucks' we need to define low volatility to take advantage of high volatility, then of course time of day is most definitely a 'biggie' This is especially so when using leverage and honouring stop losses.

The idea of being specific and implementing the guidance of those that are walking the walk, is to save time, effort and energy. By the looks of past threads on system development, if the process is too drawn out then people lose interest.

Yes I must admit working is time consuming, however, I'm sure if this system is done right we can manage to average a trade a week and be profitable, with minimal observation time and stress.

Canaussieuck, I don't mind helping out with a couple of bluechip stocks to test, however, I would be taking entry prices from the 5th hour of trade to make it more realistic. Maybe you could allocate a couple of stocks to each interested participant? Submitted for your consideration.

Cheers
Happytrader


----------



## CanOz

happytrader said:


> Hi Tech
> 
> As Nick has said If we are to get more 'bang for bucks' we need to define low volatility to take advantage of high volatility, then of course time of day is most definitely a 'biggie' This is especially so when using leverage and honouring stop losses.
> 
> The idea of being specific and implementing the guidance of those that are walking the walk, is to save time, effort and energy. By the looks of past threads on system development, if the process is too drawn out then people lose interest.
> 
> Yes I must admit working is time consuming, however, I'm sure if this system is done right we can manage to average a trade a week and be profitable, with minimal observation time and stress.
> 
> Canaussieuck, I don't mind helping out with a couple of bluechip stocks to test, however, I would be taking entry prices from the 5th hour of trade to make it more realistic. Maybe you could allocate a couple of stocks to each interested participant? Submitted for your consideration.
> 
> Cheers
> Happytrader




Happy, lets just work our way through the system and not get bogged down with when to take a trade etc, what stocks etc., ok? I think once we get to a stage were we can test some thing then you'll have a better idea of where you can fit this into your personal agenda.

Cheers,


----------



## tech/a

Happy.

I'd like to test your "Fact".
Do you have any hsirorical tick data that I could use to run tests on.
Ive seen tests done on this before and the results I saw didnt show any benifit in buying later in the day.
But obviously you have evidence and the ability to test the "Fact".

*I thought the whole idea here was to design a system EOD so that those who dont have live data can follow/test and possibly use.*

If you introduce shorter again time frames then you may as well work off 10,15,30 or 60 min Charts.

Premium Data have what we all need.
I might contact Richard and buy some historical shorter term data for testing.
I'm interested inyour Factual claim.


----------



## CanOz

lesm said:


> Just to keep things moving I have thrown some initial sample code together that people can have a look at, modify, add to, improve and focus discussion.
> 
> Run it as an exploration in AB.
> 
> Cheers.
> 
> 
> 
> Code:
> 
> 
> /*
> 
> ASF Sample System Development
> 
> */
> 
> NumColumns = 3;
> 
> VolRatio =  StDev(log(C/Ref(C,-1)),5) / StDev(log(C/Ref(C,-1)),99);
> Column0 =  VolRatio;
> Column0Name = "VolRatio";
> 
> InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
> Column1 =  InsideDay1;
> Column1Name = "Inside Day 1";
> 
> InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
> Column2 =  InsideDay2;
> Column2Name = "Inside Day 2";
> 
> Filter = InsideDay1 == 1 AND InsideDay2 == 1;
> 
> Buy = Filter;




Heres a chart that the exploration picked up, i only ran it for the 31st.


----------



## CanOz

Heres the bars.


----------



## lesm

tech/a said:


> Does anyone here have intraday data and tesing capability.
> If so i'm sure you'll find that (For stocks) time of day entry is not a biggie.
> Futures---different.




Yes, but on another platform, not AB.

Only have ASX EOD and Forex intraday in AB.

Happy,

As a separate discussion, I would be interested to see if your are finding are finding any real "edge" in trading the 5th hour on the ASX. Wouldn't take long to test it out.

Using particular trading window (time frames) in futures or Forex can make a difference and not an unusual approach.


----------



## happytrader

Hi Tech, Lesm

No need for anyone to waste time or use anything but free data to test this observation. www.bigcharts.com covers the last 10 days trading in short time frames. Just print or copy them to file at the end of each week. You need to invest your own time and to prove it to yourself if you are intending to trade with real cash. I did this for 2 years on selected blue chips as well as watched the ticker tape until I was satisfied that I could use this to gain an edge in my trading. 

If you want to actually observe traders trading the last volatile half hour of the market then you can go to www.paltalk.com

Cheers
Happytrader


----------



## doctorj

CanOz, good work at ignoring the childish bickering and continuing with the thread.

I will convert to Metastock over the weekend and have a play myself. 

In the mean time, for my own curiousity, are you able to run it on some charts to get Amibroker to identify the situation historically, so we can begin to identify characteristics of the common moves resulting from this set up and post them here with a view to begin analysing how best to manage the exits or alternatively looking if we need to expand the entry conditions.

Thanks for your great work.


----------



## CanOz

doctorj said:


> CanOz, good work at ignoring the childish bickering and continuing with the thread.
> 
> I will convert to Metastock over the weekend and have a play myself.
> 
> In the mean time, for my own curiousity, are you able to run it on some charts to get Amibroker to identify the situation historically, so we can begin to identify characteristics of the common moves resulting from this set up and post them here with a view to begin analysing how best to manage the exits or alternatively looking if we need to expand the entry conditions.
> 
> Thanks for your great work.




Hi Doc. Yes i can run LESM's code on historical ASX, all data, but not until i get back home or get time to finish my laptop setup here at work. I'll try to get my laptop setup properly today with P.Data and Amibroker.

Thanks LesM for the code!

I only did the exploration on the EOD from the 31st as i was getting ready for work this morning, should have more time at home tomorrow morning too. It pulled up 1/2 dozen or so and i just picked the pattern that was the most defined. Obviously i didn't filter out the smaller stocks either.

So am i right to say that we're looking for little micro triangles, showing this decrease in volitility?

Cheers,


----------



## doctorj

CanOz said:


> So am i right to say that we're looking for little micro triangles, showing this decrease in volitility?



Lets start with this and see how we go.  Once we study historical entries, we should get a feeling for if its got the potential to be valid.

With these small triangles, how do we define whether they're a long or short entry?  Should we look to use an MA or 2 to determine if they're in an up or down trend and take that side of the trade accordingly?  What other tools do we have to define a trend?


----------



## tech/a

doc.
add a condition to trigger a buy or sell.


----------



## CanOz

doctorj said:


> Lets start with this and see how we go.  Once we study historical entries, we should get a feeling for if its got the potential to be valid.
> 
> With these small triangles, how do we define whether they're a long or short entry?  Should we look to use an MA or 2 to determine if they're in an up or down trend and take that side of the trade accordingly?  What other tools do we have to define a trend?




Yeah maybe an EMA to start with.....or highest highs, lowest lows etc.

Lets get some input on this?

I don't think we need the buy or sell signal yet do we? As long as we can run it in exploration in Amibroker....do you need the signal in MS?

Cheers,


----------



## lesm

doctorj said:


> CanOz, good work at ignoring the childish bickering and continuing with the thread.
> 
> I will convert to Metastock over the weekend and have a play myself.
> 
> In the mean time, for my own curiousity, are you able to run it on some charts to get Amibroker to identify the situation historically, so we can begin to identify characteristics of the common moves resulting from this set up and post them here with a view to begin analysing how best to manage the exits or alternatively looking if we need to expand the entry conditions.
> 
> Thanks for your great work.



Can,

As doc mentioned, this gives a starting to point to investigate and identify the characteristics in more detail. We can then work out an approach and  way forward from there and see what eventuates.

Cheers.


----------



## R0n1n

While googling for system development I found this. Looks good. May be we can use it as a framework/guidelines to work with.


----------



## Nick Radge

The decrease in volatility is an entry _*condition*_. The market will dictate whether the entry will be long or short so we just need to be ready to travel with it.

The initial question is whether one wishes to trade in the direction of the current trend or whether it doesn't matter either way. If the system is short term, i.e. out to the 3-days I'd suggest it will not matter. However, if you are looking for some longer moves then perhaps in the direction of the prevailing trend. If so, one needs to define the current trend. 

Next, we need an entry _*trigger*_. Wayne has mentioned an ATR as an exit. Well, and ATR can also be used as an entry as well. 

So, once the entry condition is met we then need to use a reference point to measure off the entry level. We can use the highest high or the lowest low of the contraction period or we can use the high or low of the most recent bar.

As an example:

If entry condition met then look for entry trigger;
If high is exceeded by _n_ ATR then enter long;
If low is exceeded by _n_ ATR then enter short;

In other words we want to enter in the direction the market moves after the volatility contraction. We simply want to "hop on the train as it leaves the station"


----------



## tcoates

Just to add something to the mix for consideration (following from what Nick was saying)...

http://www.traderslog.com/Volatility-Breakout-Systems.htm

Tim


----------



## Captain_Chaza

.."Sailing by the Book " 

There are many sailing techniques men have used in their quest for the Holy Grail. The most difficult task is deciding which ships to sail and then know when to rest. Knowing when to rest is the hardest. 

Here is simple approach you might try if you are sailing the ASX 

1. Determine the overall global condition by surveying a folio of charts in the Global Exchange 
(Wall St) 

2. Determine the classes of ships best suited to these conditions by surveying a folio of charts in Sailing against the All Ords 

3. Design a craft or a small fleet best suited to your own needs and comfort. 

4. Then set sail using logical seamanship disciplines that minimizes risks and maximizes opportunities. 

Or 

1. You pick the sails using either a company or industry you are familiar with, or the recommendation of a trusted analyst (either fundamental or technical). 
Remembering ALWAYS  "It is the Sailor and not the Sail" 

2. Determine the seaworthiness of the craft by comparing her chart with others. 

3. Then set sail using logical seamanship disciplines that minimizes risks and maximizes opportunities. 

Whichever approach you take, most importantly the fine balance between safety and adventure can only be learnt with experience and lots of practice drills and ocean trials. 

Much of your success with these charts will come from the attention given to ocean trials. 
Hopefully “Ocean Trials” and Practice Drills will be as much fun as it will be constructive in achieving the high degree of seamanship necessary nowadays when setting sail on any member of the Global Exchange 

With today’s sophisticated, computer models and extensive tunnel testing approach to ship building and design there is still no better test of a ship’s performance and seaworthiness unless it is compared to a few others. 

All in the same seas, all under the same weather conditions, all at the same time 

That is, A RACE ! 

By plotting past voyages on these maps, experienced skippers will now be able to survey their own sailing techniques and very quickly recognize if there is any scope for improvement. 

Surprisingly, you don’t need to know how to sail to know if it is a good day to go sailing. 

If you sit by the window in a high rise office building in view of Sydney Harbour or Port Phillip Bay on some days you will see a few yachtsman setting their sails and then followed by many more. 

On other days there will be no one in sight. 

Most days however some will be heading North bound skippered by the bullish conditions and others favour the Southerly course. Some will be set by a calm. 

Whichever direction you prefer to set sail it must be remembered that each craft will behave in her own way under the same circumstances and it may be quite different than any other vessel. 

What must be forgotten are the old sailors tales "She'll be right in the long term" 

As you zoom in with binoculars on some days you will find an only few classes of yacht are out there amongst the elements. 

When you see them with a full spread of sail presented to the wind you can easily appreciate my addiction to this great sport. 

Bon Voyage 
Captain Chaza


----------



## CanOz

Nick Radge said:


> The decrease in volatility is an entry _*condition*_. The market will dictate whether the entry will be long or short so we just need to be ready to travel with it.
> 
> The initial question is whether one wishes to trade in the direction of the current trend or whether it doesn't matter either way. If the system is short term, i.e. out to the 3-days I'd suggest it will not matter. However, if you are looking for some longer moves then perhaps in the direction of the prevailing trend. If so, one needs to define the current trend.
> 
> Next, we need an entry _*trigger*_. Wayne has mentioned an ATR as an exit. Well, and ATR can also be used as an entry as well.
> 
> So, once the entry condition is met we then need to use a reference point to measure off the entry level. We can use the highest high or the lowest low of the contraction period or we can use the high or low of the most recent bar.
> 
> As an example:
> 
> If entry condition met then look for entry trigger;
> If high is exceeded by _n_ ATR then enter long;
> If low is exceeded by _n_ ATR then enter short;
> 
> In other words we want to enter in the direction the market moves after the volatility contraction. We simply want to "hop on the train as it leaves the station"




Thank Nick, we've got some things to work on for a day or so anyway...i'll try to get an example coded up tomorrow....Tech you wanted the signals so we can start testing?

LESM and Doc you'll probably beat me to it in the coding.....

Should we code up an exit now as well just to test?

Cheers,


----------



## Captain_Chaza

Nick Radge said:


> The decrease in volatility is an entry _*condition*_. The market will dictate whether the entry will be long or short so we just need to be ready to travel with it.
> 
> The initial question is whether one wishes to trade in the direction of the current trend or whether it doesn't matter either way. If the system is short term, i.e. out to the 3-days I'd suggest it will not matter. However, if you are looking for some longer moves then perhaps in the direction of the prevailing trend. If so, one needs to define the current trend.
> 
> Next, we need an entry _*trigger*_. Wayne has mentioned an ATR as an exit. Well, and ATR can also be used as an entry as well.
> 
> So, once the entry condition is met we then need to use a reference point to measure off the entry level. We can use the highest high or the lowest low of the contraction period or we can use the high or low of the most recent bar.
> 
> As an example:
> 
> If entry condition met then look for entry trigger;
> If high is exceeded by _n_ ATR then enter long;
> If low is exceeded by _n_ ATR then enter short;
> 
> In other words we want to enter in the direction the market moves after the volatility contraction. We simply want to "hop on the train as it leaves the station"




I think you are on the right tack here, Capt Radge

It is always diificult to judge  the difference between  a ship Beset by  a Calm and ONE waiting patiently to break out of the Doldrums in any direction

Salute and Gods' Speed


----------



## tech/a

Ill knock up some code if I get a chance.


----------



## Captain_Chaza

Ahoy Officer Radge
I ask you 
Technically speaking?

Once you get to the stage of a Calm
The Volitility/Lack of volitilty you crave for is LOST ?
Where then ???

Once you get tothe Doldrums
The Volitility/Lack of volitilty you crave for is LOST AGAIN?

Where then???? Do we set our next course????

Salute and Gods Speed


----------



## CanOz

Captain_Chaza said:


> Ahoy Officer Radge
> I ask you
> Technically speaking?
> 
> Once you get to the stage of a Calm
> The Volitility/Lack of volitilty you crave for is LOST ?
> Where then ???
> 
> Once you get tothe Doldrums
> The Volitility/Lack of volitilty you crave for is LOST AGAIN?
> 
> Where then???? Do we set our next course????
> 
> Salute and Gods Speed




For sure we're going to this happen, we just need to decide what to do if its an issue, it should show up in the testing.

Cheers,


----------



## theasxgorilla

An update on IDO...

Somethings to ponder (only as an example):

* The price exceeded the high of the first bar of the pattern, $1.25, by 1 cent.  This is one possible entry trigger (TRIGGER 1), as per Nick's mail above.

* The price also (of course) exceeded the high of the last bar in the pattern, $1.23, another possible entry trigger (TRIGGER 2).

* If you assume the profit target for such a triangle to be 1x the range of the 1st bar as extended from the apex, then the profit target here is $1.30 (assuming an apex of $1.22).

* If you have a tight stop 1c below the last bar of the pattern ie. technically outside the pattern, at $1.20, then a win (reaching the profit target) using TRIGGER 1 would be 0.5R, and using TRIGGER 2 would be 1.2R.

Of course this is one instance, not the universe.  In anycase, for mine, the more aggressive entry (TRIGGER 2) is probably better.  Swing for the fences!


----------



## theasxgorilla

Captain_Chaza said:


> I think you are on the right tack here, Capt Radge
> 
> It is always diificult to judge  the difference between  a ship Beset by  a Calm and ONE waiting patiently to break out of the Doldrums in any direction
> 
> Salute and Gods' Speed




This is true, and in back testing the outcome of statistics such as win/loss ratios in combination with an average winning trade to average losing trade will show (historically) if you're system 'judges' well enough to be profitable.


----------



## CanOz

heres a few more from the scans tonite.....


----------



## CanOz

So why can't we tack on a simple code such as this onto Lesm's code....

Buy = 	Open   > Ref(  Close  , -1 );

Sell = 0;

Short = 	Open   < Ref(  Close  , -1 );

Cover = 0;

I needs some help with your code Lesm, how to i make your the cond, and then add the simple triggers?

Cheers,


----------



## doctorj

Attached is a bit of a montage of some of the historical entries I identified so others can get a feel for it.

I added one thing to the code  -  the fourth day in the sequence closes higher than the high of the first day (ie. you'd enter on day 5 of the sequence).  

After looking at this on many historical charts, my empirical observation is that it probably makes it untradeable.  If we are to keep an EOD system, perhaps we should look to trade it by setting buy triggers a tick or two above the high of the first bar o/n after day 3 of the sequence rather than waiting for the confirmation of the break on day 4 then enter on day 5.

Short term trading is well out side my comfort zone, so I'd be very interested to hear feedback on the above points. 

PS. Wooooo! Post 1000.  I was really hoping it would be something more profound - it certainly took me long enough to reach the milestone.  Cheers Joe for a great forum!


----------



## lesm

Hi Can,

I am still playing around with it at the moment.

Have included a bit of a framework to define some of the system options and what is displayed in the AA results table.

The ATR approach wasn't too successful, so I have gone back to a very simplistic approach using a single EMA as starter.

Digesting ASXG's and Doc's comments at the moment and going back through Nick's as well.

Will post where I am at for the moment, as a work in progress. Tech was also going to work on some coding. The combined effort will be interesting in reaching the final system.

Haven't put in the Sell and Cover conditions as yet, but this should give you something to work with. You can replace the EMA with your buy conditions.

Need to go back through the charts and look at the behaviour in more detail.

As Doc mentioned you need to get a feel for it, as this will assist in better defining a more effective trigger point.



		Code:
	

/* 

ASF Sample System Development 2 Inside days

*/

// Define system options - can modify these as required

SetChartOptions( 2, chartShowDates|chartShowArrows ); 
SetBarsRequired(10000,10000); 
SetTradeDelays( 1, 1, 1, 1);
SetOption( "initialequity", 100000 );
SetOption( "MaxOpenPositions", 10 ); 
SetOption( "PriceBoundChecking", 1 ); 
SetOption( "CommissionMode", 1 ); 
SetOption( "CommissionAmount", 0.1 ); 

BuyPrice = SellPrice = Open;
ShortPrice = CoverPrice = Open;
PositionSize = -10; // always invest 10% of the current Equity 

// Define and initialise variables

ATRMult = 3.5;
ATRPeriod = 14;

// Check if 2 Inside days occur

InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;

/*
Notes:

To Do:

Add in a liquidity filter
Consider prerequisite conditions for trade entry

From Nick's post:

Consider an appropriate reference point.

Possibility of using n ATR:
if entry condition met then look for entry trigger;
if High is exceeded by n ATR then enter long;
if Low is exceeded by n ATR then enter Short;
*/

// Long side - buy and sell conditions

// Buy Condition

BuySig = InsideDayCond AND High > EMA(C,35);
 
// Sell Condition 
 
// SellSig = condition.......

Buy = BuySig;

//Buy = ExRem(BuySig, SellSig); 
//Sell = ExRem(SellSig, BuySig);

// Short side - short and cover conditions

// Short Condition

ShortSig = InsideDayCond AND Low < EMA(L,35);
 
// Cover Condition

// CoverSig = condition .......

Short = ShortSig;

//Short = ExRem(ShortSig, CoverSig);
//Cover = ExRem(CoverSig, ShortSig);


// Lists exploration results conforming to our buy/sell OR short/cover criteria
 
//Filter = Buy OR Sell OR Short OR Cover;

Filter = Buy OR Short;

AddColumn(Buy, "Buy", 1, colorDefault,IIf(Buy,colorGreen,colorDefault));
//AddColumn(Sell, "Sell", 1, colorDefault,IIf(Sell,colorRed,colorDefault));
AddColumn(Short, "Short", 1, colorDefault,IIf(Short,colorGreen,colorDefault));
//AddColumn(Cover, "Cover", 1, colorDefault,IIf(Cover,colorRed,colorDefault));
AddColumn(Open, "Open", 4.3); 
AddColumn(Low, "Low", 4.3);
AddColumn(High, "High", 4.3);
AddColumn(Close, "Close", 4.3);


----------



## tech/a

> Tech was also going to work on some coding.




Mine will be metastock format.


----------



## CanOz

This is doing my head in!!!!

I can't get it to buy on the next bar after the insidedaycond.

It keeps buying on inside bar 1.....

Enough for tonite...my GF and i have been trying to figure it out....she's catching onto AFL faster than me.

Cheers,


----------



## lesm

tech/a said:


> Mine will be metastock format.




We can convert to AB. Can will appreciate any input

Nick,

I have been looking at the charts of the stocks selected, using an exploration over the last 20 days, and they have quite interesting characteristics.

Have a couple of questions for you.

Would it be worthwhile considering an approach similar to the ID/NR4Day system as described by Connors and Raschke?

(Have already set up a variant based on this approach to see out it works out)

There are some similarities here. One difference is that we are looking for two inside days as opposed to one.

This is an interesting exercise.


----------



## doctorj

lesm said:


> Would it be worthwhile considering an approach similar to the ID/NR4Day system as described by Connors and Raschke?



I believe this has been discussed over at reefcap.  Nick may be able to provide more info.


----------



## lesm

CanOz said:


> This is doing my head in!!!!
> 
> I can't get it to buy on the next bar after the insidedaycond.
> 
> It keeps buying on inside bar 1.....
> 
> Enough for tonite...my GF and i have been trying to figure it out....she getting it (AFL) faster than me.
> 
> Cheers,




Will have a closer look.

At least there are multiple eyes looking at this and we can check it out.

Do you have SetTradeDelays (1, 1, 1, 1) in your code?

Or if not, in Automatic Analyser (AA) under the Trades Tab in the Buy and Sell delay settings do you have them set to "1"?

Otherwise, AB will buy/sell on the current bar/day if the delay settings are set to "0".

Have a good night.


----------



## lesm

doctorj said:


> I believe this has been discussed over at reefcap.  Nick may be able to provide more info.




Thanks Doc, will go over and do a search.


----------



## lesm

Have done some more work on this.

Still need to work on the Sell and Cover conditions, as well as stops and reviewing the existing conditions.

Using a 'buy stop' and 'sell stop' may be worthwhile considering, as well as running an initial tight stop.

Any input or suggestions appreciated.

Have a full on morning tomorrow, so will not be able to look at this again until some time in the afternoon.



		Code:
	

/* 

ASF Sample System Development

 2 Inside days AND 6/100 Historical Volatility Ratio

*/

// Define system options can modify these as required

SetChartOptions( 2, chartShowDates|chartShowArrows ); 
SetBarsRequired(10000,10000); 
SetTradeDelays( 1, 1, 1, 1);
SetOption( "initialequity", 100000 );
SetOption( "MaxOpenPositions", 10 ); 
SetOption( "PriceBoundChecking", 1 ); 
SetOption( "CommissionMode", 1 ); 
SetOption( "CommissionAmount", 0.1 ); 

BuyPrice = SellPrice = Open;
ShortPrice = CoverPrice = Open;
PositionSize = -10; // always invest 10% of the current Equity 

// Setup Conditions

VolumeCond = EMA(V * C, 21) > 500000; // Ensure at least $500k of money flow for 21 periods
EMABuyCond = EMA(C, 35);
EMAShortCond = EMA(L, 35);

// BuyTrigCond = O > Ref(L,-1); not used in this version

// NR4DAY
// NR4Day = (H - L) < Ref(LLV(H-L,3),-1); // not used in this version

// 6/100 Historical Volatility
HVSixOneHundred = (StDev(log(C/Ref(C,-1)),6)*100*sqrt(256)) / (StDev(log(C/Ref(C,-1)),100)*100*sqrt(256));
HVRatioCond = HVSixOneHundred < 0.5;

// Check if 2 Inside days occur

InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;

// Long side - buy and sell conditions

// Buy Condition

BuySig = InsideDayCond AND HVRatioCond AND VolumeCond AND C > EMABuyCond ;
 
// Sell Condition 
 
// SellSig = condition.......

Buy = BuySig;

//Buy = ExRem(BuySig, SellSig); 
//Sell = ExRem(SellSig, BuySig);

// Short side - short and cover conditions

// Short Condition

ShortSig = InsideDayCond AND HVRatioCond AND VolumeCond AND Low < EMAShortCond;
 
// Cover Condition

// CoverSig = condition .......

Short = ShortSig;

//Short = ExRem(ShortSig, CoverSig);
//Cover = ExRem(CoverSig, ShortSig);

// Define Stoploss Conditions

ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );

// Lists exploration results conforming to our buy/sell OR short/cover criteria
 
//Filter = Buy OR Sell OR Short OR Cover;

Filter = Buy OR Short;

AddColumn(Buy, "Buy", 1, colorDefault,IIf(Buy,colorGreen,colorDefault));
//AddColumn(Sell, "Sell", 1, colorDefault,IIf(Sell,colorRed,colorDefault));
AddColumn(Short, "Short", 1, colorDefault,IIf(Short,colorGreen,colorDefault));
//AddColumn(Cover, "Cover", 1, colorDefault,IIf(Cover,colorRed,colorDefault));
AddColumn(Open, "Open", 4.3); 
AddColumn(Low, "Low", 4.3); // 
AddColumn(High, "High", 4.3); // 
AddColumn(Close, "Close", 4.3); //


----------



## weird

well done guys, I was losing hope on this thread for a while 

.. as Kenny would say, "good on you" ... to those pushing this thread forward.


----------



## tech/a

weird said:


> well done guys, I was losing hope on this thread for a while
> 
> .. as Kenny would say, "good on you" ... to those pushing this thread forward.





*AH.

A metastock coding expert!
Want to lend a hand?*


----------



## Nick Radge

lesm,
Another variant of that theme could be something as simple as:

If range today < range[yesterday] and range[yesterday] > range[day before]

It's still the contracting range theory, but means the individual highs and lows can be outside each other. The NR7 or NR4 is exactly the same theory. By extending the range contraction you will see a decline in trade frequency. If trading a broader range of instruments this may be beneficial.

We're using range expansion to enter, so it may be beneficial to use a reverse range expansion as an exit. We can discuss this later.

In the interim, here is your benchmark. A short term system that works on all stocks. This has a 1-day hold time, uses EOD data, $10k per trade and includes comm's.


----------



## CanOz

Morning all, welcome aboard Weird.

Thanks again Lesm and Nick!

I pulled this out of the scan with the recent changes above....i'm still signaling on the wrong day, after I changed the settings...thanks for tip the Lesm...not sure where i'm still wrong here.

I think i've learned more about Amibrokers testing features over the last couple of days than i could have on my own thats for sure!

I still can't backtest this though...something to do with the buy/sell signals?

 - sorry folks, still very green.

cheers,


----------



## Sir Burr

CanOz said:


> I still can't backtest this though...something to do with the buy/sell signals?




There is no sell condition.

Add:

Sell = 0;

Edit: Even though Applystop is in the code, you still have to have a Sell. Adding Sell = 0; just makes the backtester happy, it doesn't do anything!


----------



## theasxgorilla

CanOz said:


> This is doing my head in!!!!
> 
> I can't get it to buy on the next bar after the insidedaycond.
> 
> It keeps buying on inside bar 1.....




Instead of working like Metastock and trying to delay the actual buying to the next day you could instead run checks on [bar-1] and issue your buy signal on [bar].

For example:

for (bar = 1; bar < BarCount; bar++) // start a loop that begins at bar #1 and increments a bar at a time until last bar 
{
	InsideDay1 = High[bar-1] < High[bar-2] AND Low[bar-1] > Low[bar-2];
	InsideDay2 = High[bar-2] < High[bar-3] AND Low[bar-2] > Low[bar-3];
	YesterdaysInsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;	

	// If double inside day condition met yesterday...
	if (YesterdaysInsideDayCond == 1)
	{
			// ...buy at today's open
			Buy[bar] = 1;
			BuyPrice[bar] = Open;
	}
}

This could be tidied up a bit eg. the YesterdaysInsideDayCond turned into a function and called instead of the code sitting inside the loop, but it ought to work okay as it is.

ASX.G


----------



## theasxgorilla

Sir Burr said:


> There is no sell condition.
> 
> Add:
> 
> Sell = 0;
> 
> Edit: Even though Applystop is in the code, you still have to have a Sell. Adding Sell = 0; just makes the backtester happy, it doesn't do anything!




As a good habit put this at the top of your AB code, just before the beginning of your buy/sell/short/cover loop:

Buy = Sell = Short = Cover = 0;


----------



## tech/a

Nick that was to be the basis of my code.

Youve got me fossicking in the Library for Joe Ross's books!
More little snippets of experience.
Thanks.


----------



## CanOz

Not sure if this is all ok but heres a report....


----------



## nizar

PDZ looks the goods.
A good example of what may happen to a stock after 3 inside days.


----------



## nizar

CanOz said:


> Not sure if this is all ok but heres a report....




Can, we cant scroll down.


----------



## CanOz

Not sure how to attach the file Niz, any suggestions?


----------



## CanOz

Just mucking about with this on my futures data, the buy signals on index's seem to work pretty good....is this a bit strange?

Here's one for Prof.
Cheers,


----------



## R0n1n

What AB backtester setings everyone using ? this way everyone with Amibroker will be on the same page.


----------



## weird

Hi Tech/A 

Not sure if this is what you had in mind ... this is an indicator I put together today which plots an equity curve of a system in Metastock.

I make no claim to the accuracy of the coding, and this should be reviewed and checked for errors.  

I recommend ploting the indicator, saving it has a default template, and moving it across the ASX20.

{SHORT TERM SYSTEM - EQUITY CURVE v1}
{NOTE - BUY/SHORT ON OPEN AND SELL/COVER ON CLOSE} 

ps:=Input("$Position Size: ",1,1000000,10000);
con:=ps/OPEN;
pv:=Input("Leverage: 0-100%",1,100,10);
pv:=100/pv;
sp:=Input("Start Periods: ",1,2500,1250);
stop:=Input("Place Stop (0 = no stop): ",0,100,0);
coms:=Input("round trip Commission: ",0,1000,40);
signals:=Input("Signals: Buy (1) Short (2) All (3)",1,3,3);

{LONG}
LE:=OPEN > Ref(HIGH,-1) AND (Ref(HIGH,-1)-Ref(LOW,-1)) < (Ref(HIGH,-2)-Ref(LOW,-2)) AND (Ref(HIGH,-2)-Ref(LOW,-2)) < (Ref(HIGH,-3)-Ref(LOW,-3)) AND
(Ref(HIGH,-3)-Ref(LOW,-3)) < (Ref(HIGH,-4)-Ref(LOW,-4));
LPnostp:=CLOSE - OPEN;
LPstp:=If(OPEN-LOW > stop,-1*stop,CLOSE-OPEN);
LP:=If(stop=0,LPnostp,LPstp);
LP:=If(LE,con*pv*LP-coms,0);
LcP:=Cum(LP); {Long Cumulative Profit}
Zero:=ValueWhen(1,Cum(1)=LastValue(Cum(1))-sp,LcP);
LcP:=LcP-Zero;

{Short}
ShE:=OPEN < Ref(LOW,-1) AND (Ref(HIGH,-1)-Ref(LOW,-1)) < (Ref(HIGH,-2)-Ref(LOW,-2)) AND (Ref(HIGH,-2)-Ref(LOW,-2)) < (Ref(HIGH,-3)-Ref(LOW,-3)) AND
(Ref(HIGH,-3)-Ref(LOW,-3)) < (Ref(HIGH,-4)-Ref(LOW,-4));
ShPnostp:=OPEN-CLOSE;
ShPstp:=If(HIGH - OPEN > stop,-1*stop,OPEN-CLOSE);
ShP:=If(stop=0,ShPnostp,ShPstp);
ShP:=If(ShE,con*pv*ShP-coms,0);
ShcP:=Cum(ShP); {Short Cumulative Profit}
ShZero:=ValueWhen(1,Cum(1)=LastValue(Cum(1))-sp,ShcP);
ShcP:=ShcP-ShZero;

{Signals}
If(signals=1,Lcp,If(signals=2,ShcP,Lcp+ShcP));
0;


----------



## tech/a

Weird.

Excellent.
I can cut what I need from there to then place in Tradesim.
Thanks for the Equity Curve and others may find it useful,but Tradesim does all that.
Think I can follow what I need.
Wish I had that talent!

Next some exit suggestions then I can test some.


----------



## weird

I would think with these types of systems, that stock selection is very imporant, and the system may not perform well on a general index based watchlist, without additional filtering.

As an example of a stock that it performs well on is BHP.

Also I went abit overboard with defining the narrowing range, the following is more in line with the discussion,

LE:=OPEN > Ref(HIGH,-1) AND (Ref(HIGH,-1)-Ref(LOW,-1)) < (Ref(HIGH,-2)-Ref(LOW,-2)) AND (Ref(HIGH,-2)-Ref(LOW,-2)) < (Ref(HIGH,-3)-Ref(LOW,-3));

ShE:=OPEN < Ref(LOW,-1) AND (Ref(HIGH,-1)-Ref(LOW,-1)) < (Ref(HIGH,-2)-Ref(LOW,-2)) AND (Ref(HIGH,-2)-Ref(LOW,-2)) < (Ref(HIGH,-3)-Ref(LOW,-3));


----------



## lesm

Nick,

Thanks for your input and guidance much appreciated, as well as the benchmark.

Keeping it simple as per your example is always a good approach.

NR4 and HV were the first things that came to mind when looking at the pattern and charts. 

Weird,

Good to see your input and sure it will be appreciated.

Can,

This exercise will be useful to different people in different ways and everyone should get something out of it at the end of the day. You may like to thing about trying out ASXG's looping example as an alternative approach. A good way to learn more about AB, especially AFL.

Anyone,

Any suggestions with respect to exits, as this is a community exercise.

As per Nick's reference/benchmark, can buy on Open, hold it overnight and exit next day on Open, as one option.

Trying different exits can provide an idea of how it may perform/behave over different holding periods.


----------



## doctorj

Having thought about some of the things said during this morning's presentation, I just put this following together and put it on a few charts.



		Code:
	

Ref(C,-1)<O AND Ref(V,-1)> (2*Ref(Mov(V,13,E),-1)) AND C>Ref(C,-1) AND ( Ref(H,-1)-Ref(L,-1))< Ref(Mov(H-L,13,E),-1);


I've plotted it against a few charts (chuck it in expert advisor in MS) and it looks promising for about 30s of work. 

First observation is that it doesn't appear to generate many signals.


----------



## doctorj

Now I've had a little more of a play with it, by changing the volume condition it generates more signals without too much extra noise.

But I would keep the multiplier higher than 1.5 or it begins to become worthless...


----------



## doctorj

Here's it plotted against IAG for those still converting it to Ami.


----------



## doctorj

And another...


----------



## bingk6

CanOz said:


> This is doing my head in!!!!
> 
> I can't get it to buy on the next bar after the insidedaycond.
> 
> It keeps buying on inside bar 1.....
> 
> Enough for tonite...my GF and i have been trying to figure it out....she's catching onto AFL faster than me.
> 
> Cheers,




Can,

You may have got this solved by now, but as far as I can see, the reason that you think that you are buying on the wrong bar is because of the position of the arrow in your chart (which I presume is generated with a plotshape command). If that is the case, the arrow in the chart would indicate when the buy criteria is triggered, which is a different kettle of fish to when the trade will actually take place.

This is where lesm's comment regarding the settradedelay command comes in.
SetTradeDelays( 1, 1, 1, 1) implies that you physically enter the trade (long) one day after the buy criteria is triggered and similarly exit the trade one day after the sell criteria is triggered.

In order for you to actually see when the trades physically take place, you need to back test the strategy, whereupon you will receive a trade list. Select any of those trades in the tradelist, right-click any trade and select "show current trade arrow" and you'll see exactly when the trade was entered into and exited from -- which should be exactly as per your expectation.

Just to take this discussion a little further, if you were to implement Nicks strategy with a one day hold, there are several ways to implement that in Amibroker, but I have found that the easiest is simply to set the sell signal to be the same as the buy signal, but set the sell trade delay to 2 days, ie.

SetTradeDelays( 1, 2, 1, 1);
buyprice=open;
sellprice=open;

buy = .....
sell = buy;

That way, your system is set to enter the trade one day after the buy criteria (on the open) and exit the trade the next day (also on the open)  

PS, You're doing a great job - keep it up. Others will try to chip in whenever they can.


----------



## Disqplay

I have been following along more out of curiosty than anything else but it would seem that if you are going for a swing trade system wouldn't you rather want to base your exits on something other than a one day hold? I believe that Nick knows more about trading the stock market than I do and would venture to say that most of the poster here also are better equipped to comment, but I thought that swing trading was used to catch the move up or down of a stock over several days and at the first hint of failure of the stock to perform to it's potential is when your exit stratagey would kick in and take you out of the play be it 1 day or 1 month. Just an observation over the last couple of days of posting good luck in your journey, I will continue to follow along.

Disq


----------



## CanOz

bingk6 said:


> Can,
> 
> You may have got this solved by now, but as far as I can see, the reason that you think that you are buying on the wrong bar is because of the position of the arrow in your chart (which I presume is generated with a plotshape command). If that is the case, the arrow in the chart would indicate when the buy criteria is triggered, which is a different kettle of fish to when the trade will actually take place.
> 
> This is where lesm's comment regarding the settradedelay command comes in.
> SetTradeDelays( 1, 1, 1, 1) implies that you physically enter the trade (long) one day after the buy criteria is triggered and similarly exit the trade one day after the sell criteria is triggered.
> 
> In order for you to actually see when the trades physically take place, you need to back test the strategy, whereupon you will receive a trade list. Select any of those trades in the tradelist, right-click any trade and select "show current trade arrow" and you'll see exactly when the trade was entered into and exited from -- which should be exactly as per your expectation.
> 
> Just to take this discussion a little further, if you were to implement Nicks strategy with a one day hold, there are several ways to implement that in Amibroker, but I have found that the easiest is simply to set the sell signal to be the same as the buy signal, but set the sell trade delay to 2 days, ie.
> 
> SetTradeDelays( 1, 2, 1, 1);
> buyprice=open;
> sellprice=open;
> 
> buy = .....
> sell = buy;
> 
> That way, your system is set to enter the trade one day after the buy criteria (on the open) and exit the trade the next day (also on the open)
> 
> PS, You're doing a great job - keep it up. Others will try to chip in whenever they can.




Thanks allot Bingk6....i'm so new with Amiborker, but all this really helps me learn...i hope a few others are learning along with me...and that was the whole purpose of this thread. 

I've tried a few things on the weekend, but the inet has been so slow i haven't tried to post much, i hope it improves at least enough to get my orders through in the morning...or i'll be on the phone again!

I'll try all these things tomorrow hopefully...keep the good stuff coming folks!

Thanks again everyone for all your help!

Cheers,


----------



## lesm

Can,

Have you been able to understand and convert the metastock code?

Weird uses a good style and his code is easy to follow.

"LE" = Long Entry

Substitute "Buy =" in AB

"ShE" = Short Entry

Substitute "Short =" in AB

From Doc's code:

"(2*Ref(Mov(V,13,E),-1))" converts to "(2*Ref(EMA(V,13),-1))"

"Ref(Mov(H-L,13,E),-1)" converts to "Ref(EMA(H-L,13),-1)"

It usually straightforward to convert most Metastock to AB or vice versa.

Ran some tests using weird and doc's code last night. Picked up a couple of illiquid stocks using the volume test of doc's. Doc made a comment related to the multiplier when he posted the code.

Let us know when you are ready Can and we can do some more work on this exercise. Hope your Internet conenction gets sorted out. Raise any questions that you may have along the way, as you can see there is always someone around who can help out.

Cheers.


----------



## doctorj

My code's rough, but I see it as a starting point - we can filter for volume and the like easily.


----------



## Nick Radge

> wouldn't you rather want to base your exits on something other than a one day hold?




disqplay,
Valid question and conclusion. When testing, especially on Australian stocks since 1980, you will find very quickly that the longer you hold, the better the result, the less the work, the less comm's and less the stress. However, Longer term exposure, even out to a few months in length, also increases exposure to the market and increased exposure also increases risk. 

Which situation is better:

(a) Net profit 20% pa. Exposure 100%
or
(b) Net profit 18% pa. Exposure 50%

The answer is different for everyone. Some are less risk adverse. Others just want the highest profits.

The other issue to consider is why just use a longer term system only? Why not have a shorter term system plugging away in the background as more of an income generator? A longer term system attemts to swing for the fences. A shorter term system requires less capital and just chips away. 

Here is an equity curve of a simple pattern system that would take less than 5-mins a day to run. It trades 4 Australian stocks and using CFD's you could trade it with ease on 1 $10,000 account. This is 8-years worth incl comm's and no pyramiding. The "Open" or "Close" represent exiting on the next days open or the next days close. Having one of these ticking over in the background and it could pay your salary whilst the longer term system looks after the rest.


----------



## theasxgorilla

Disqplay said:


> I thought that swing trading was used to catch the move up or down of a stock over several days and at the first hint of failure of the stock to perform to it's potential is when your exit stratagey would kick in and take you out of the play be it 1 day or 1 month.




I think the answer to that is, it depends.  If you have a profit target and a tight initial stop, you may decide not to use a trailing stop.


----------



## CanOz

lesm said:


> Can,
> 
> Have you been able to understand and convert the metastock code?
> 
> Weird uses a good style and his code is easy to follow.
> 
> "LE" = Long Entry
> 
> Substitute "Buy =" in AB
> 
> "ShE" = Short Entry
> 
> Substitute "Short =" in AB
> 
> From Doc's code:
> 
> "(2*Ref(Mov(V,13,E),-1))" converts to "(2*Ref(EMA(V,13),-1))"
> 
> "Ref(Mov(H-L,13,E),-1)" converts to "Ref(EMA(H-L,13),-1)"
> 
> It usually straightforward to convert most Metastock to AB or vice versa.
> 
> Ran some tests using weird and doc's code last night. Picked up a couple of illiquid stocks using the volume test of doc's. Doc made a comment related to the multiplier when he posted the code.
> 
> Let us know when you are ready Can and we can do some more work on this exercise. Hope your Internet conenction gets sorted out. Raise any questions that you may have along the way, as you can see there is always someone around who can help out.
> 
> Cheers.




I actually thought that the MS code was easier to understand than AB, just on first glance. 

Anyway i haven't had a chance to do a thing on this. I've got my AB setup on my lappy at work thru a flask disk (not perimitted to install programs on work PCs), but Premium Data won't install on the flash disk...so no i've got a whole new range of issues to deal with, AB and no data...nothings ever simple is it?

If someone can post some recent code efforts, i'll try and get some time to run some more tests tonite when i get home. I've got vacation days starting mid June that i'm dedicating to system development and learning, so if all else fails i may have to wait until then. 

Cheers all, and thanks for the continued help and interest.


----------



## theasxgorilla

CanOz said:


> I've got my AB setup on my lappy at work thru a flask disk (not perimitted to install programs on work PCs), but Premium Data won't install on the flash disk...so no i've got a whole new range of issues to deal with, AB and no data...nothings ever simple is it?




AB has an excellent data import wizard.  If you can get some data into a CSV or Metastock format you can point the import wizard at those files and suck them into AB.  Should get it onto your flash disk, no worries.


----------



## R0n1n

ok here is one with Moving Averages. Its note entirely mine, but I modified it quite a bit. U can play with the paramaters to change various nos. 



		Code:
	

p1=Param("EMA Period",15,1,200,1);
p2=Param("Smoothening Period",15,1,200,1);
p3=Param("Bollinger Period",5,3,25,1);
p4=Param("Bollinger Band Width",1,0.5,3,0.1);
p5=Param("Period for Buy",9,3,50,1);
p6=Param("Period for Sell",3,3,50,1);

X=EMA(C,p1);Y=EMA(X,p2);
D=X-Y;
BBB=BBandBot(D,p3,p4);
BBT=BBandTop(D,p3,p4);

Buy=Cross(D,BBT) AND (C>=MA(C,p5));
Sell=Cross(BBB,D) AND (C<=MA(C,p6));
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

shape=Buy*shapeUpArrow+Sell*shapeDownArrow;
PlotShapes(shape,IIf(Buy,colorBrightGreen,colorRed),0,IIf(Buy,L,H));


----------



## Disqplay

theasxgorilla and Nick Radge

 I was not trying to throw a monkey wrench into the works but was just explaining what I thought the definitions of a swing trade was in my mind at least. I see the advantages of holding a stock no longer than one day at a time but I also see that you can potentially miss some very nice moves in a stock over a several day period before it expirences another pull back. 

To tell the truth I trade on the US makets and really have no idea what CFD's are or how they work. The point I was trying to make is that you are attempting to build a short term (swing) trading system. In the beginning of the thread I thought this was to  allow someone with a day job who is unable to watch the market continually during the open hours of the market a viable way to trade stocks over the short term.

Disq


----------



## theasxgorilla

Disqplay,

Your comment seemed to be about how one might swing trade and in particular made reference to ,"at the first hint of failure of the stock to perform to it's potential is when your exit stratagey would kick in".  

Most people would probably presume that you need a trailing stop as part of an exit strategy.  One the other hand though, it's entirely viable with a short term system (not just any short term system, but one designed for the purpose) to buy on your entry trigger and sell; at a profit target, when a time based stop is hit, or when the initial stop is reached.  If the system is super-short term and still trading on end-of-day signals it could be quite difficult and ultimately counter productive to have a trailing stop.  Testing should tell this one way or another.

ASX.G


----------



## CanOz

Apologies to all following this thread.

Stay tuned for some new developments from myself once i get some minor software issues resolved. 

Thanks again to all contributors.

Cheers,


----------



## doctorj

Look forward to having you fully functioning CanOz.

Need some help with coding in MS.  My data contains warrants and options etc etc.  Is there any way to limit the results of explorer in ms to stocks without having to add each to manually?

In Amibroker, I used to use something like (going from distant memory here, so the syntax might be wrong): strlen(name())==3.  Does Metastock have an equivalent expression?


----------



## tech/a

Tradesim does.

Place in english or Metastock the code and I'll give it a go.
If I cant get it Weird will.
Can then run it on Tradesim with monte carlo analysis, and all the bells and whistles.


----------



## CanOz

G'day all.

This morning i started reading Howard Bandy's "Quantitative Trading Systems".

This was just released this year i believe. So far its very indepth and covering systems development in logical and more importantly, undetstandable steps. All, with AmiBroker

As far as the testing goes, i've tested Lesms code several times on my ASX data. Ron1n has tested it on ASX200. I tried to filter to this but the BT won't pick up anything, so i suspect its the way i have it setup....my data has warrants and options as well.

One thing i noticed about the system so far is that the MAXDD seemed high, to me anyway.

I can't post the report as i don't have MS word at home.

I might recap where we are at today or tomorrow, following along the lines of Bandy's suggested path for those of you that are interested.

After that i will most likely pick this up a bit as i make my way through his book and while i'm on my holidays starting the 18th of June.

If someone else could post a few back tests of Lesms code? Has anyone tried an different exit yet?

Another question, do the code settings always override the backtest settings?

Cheers,


----------



## nizar

CanOz said:


> G'day all.
> 
> This morning i started reading Howard Bandy's "Quantitative Trading Systems".
> 
> This was just released this year i believe. So far its very indepth and covering systems development in logical and more importantly, undetstandable steps. All, with AmiBroker
> 
> As far as the testing goes, i've tested Lesms code several times on my ASX data. Ron1n has tested it on ASX200. I tried to filter to this but the BT won't pick up anything, so i suspect its the way i have it setup....my data has warrants and options as well.
> 
> One thing i noticed about the system so far is that the MAXDD seemed high, to me anyway.
> 
> I can't post the report as i don't have MS word at home.
> 
> I might recap where we are at today or tomorrow, following along the lines of Bandy's suggested path for those of you that are interested.
> 
> After that i will most likely pick this up a bit as i make my way through his book and while i'm on my holidays starting the 18th of June.
> 
> If someone else could post a few back tests of Lesms code? Has anyone tried an different exit yet?
> 
> Another question, do the code settings always override the backtest settings?
> 
> Cheers,




Can,

Wats a high maxDD to you?
>30% ??

Depends on the profits and trading timeframe i guess.

Also, you dont have MS word at home?
Are you serious??
Thats just weird....


----------



## Sir Burr

CanOz said:


> Another question, do the code settings always override the backtest settings?




Yes


----------



## CanOz

nizar said:


> Can,
> 
> Wats a high maxDD to you?
> >30% ??
> 
> Depends on the profits and trading timeframe i guess.
> 
> Also, you dont have MS word at home?
> Are you serious??
> Thats just weird....




I don't have MS Office at home at the moment, its a new PC and it was suggested to me not use a lic. copy. In the meantime no copy has been presented to me for use as promised...alas i will be buying a licensed copy very soon if i can find a dual language or english version...Nothing is simple here Nizar.

Anyway...i've been reading all day...now i need to practice writing some filters and creating some watchlists.....This book is great!

Cheers,


----------



## CFD

You could try OpenOffice, it's available as a free download in english.


----------



## nizar

CanOz said:


> This book is great!




Thanks for the title.
Its on the list.


----------



## weird

Hi DoctorJ,

There are a few methods I know of to create a watchlist/favourites with only the required symbols for Metastock.

As Tech/A mentioned, it is very easy to do this with Tradesim, and symbols (example > 3 characters) can be filtered out with a line of code, and even produce a watchlist/favourites based on this (that is only symbols <= 3 characters).

Most data providers provide methods as well, such as Premium Data, and I also remember mucking around with a method to do so using Almax as well to create a watchlist from a text file.  So if you can ween out the symbols you don't wish to include from a text file, you could import this text file to create a watchlist with only the symbols you require.

Also most data providers provide set watchlists based on ASX constituent index groups, which "may" exclude the symbols, such as warrants and options, you don't wish to include. May be worth sending them a quick email.

Also there are some other utilities available which may help, such as Jose's URSC kit, and also with a new utility from Jim Berg,

http://www.sharetradingeducation.co...TradingTools/BergListCreatorforMetastock.aspx


----------



## weird

Also, as I'm not sure what there is available concerning free dll's or coding that can provide additional symbol filtering for MS, a good place to ask would be,

http://forum.equis.com/forums/default.aspx

The MS programming heavies frequent that site, so can provide additional tips and information.


----------



## CanOz

Wouldn't the liquidity filter take care of that anyway wierd? I mean it would be unlikely wouldn't it to have such high liquidity in an option or warrant when the conditions of the system are met?

Doc maybe your query was in general and not related to this particular system?

In any case im going to try and figure out how to limit the symbols length in AB as an exercise.

Cheers,


----------



## CanOz

nizar said:


> Thanks for the title.
> Its on the list.




www.quantitativetradingsystems.com 

For those interested...it took about 10 days for me to get it the book after i ordered it, quicker for most in Oz i reckon.

Cheers,


----------



## ijw

/* Clean up database*/

/*there are the string functions to help with these
run the explore, save all to a watchlist then in Assignment Organizer
delete them

example*/

Filter= StrRight(Name(),3)==".AX" OR StrLen(Name())>4;
AddTextColumn(Name(),"name");

I use the above code to clean out  any symbols that are longer than than 4 letters. 

I use two ASX databases. 

Adjusted EOD data I get from Premium Data which  assigns the data to the various watchlists automatically at the end of day when updating.

The second database is unadjusted data that includes warrants and options and is intra day. I use the above code to clean it up. The data originally was sourced from Yahoo, and the code was designed to get rid of the .AX extension.

I have just ordered the  Quantitive Trading Systems book myself and am interested in your comments. I've had AB for some years now, however, my programming skills are still pretty rough.

Anyway, came across this thread by accident and am finding it an interesting read. Keep up the good work guys.

Cheers 
IJW


----------



## wayneL

Been chugging along with this medium term mechanical system idea and shorter term trend exits keep coming up as suboptimal compared to wider exits.

Longer term ema's (circa 120 days on my selected universe of stocks) seem to be the most profitable.

This applies to straight mechanical systems. Nothing is coming even close to my swing trades and more discretionary medium term trend trades in expectancy X opportunity. (discretionary in this case means useing well defined t/a, but differing techniques as the situation demands and not whims, or gut feels.... trendlines, supp, res, etc)

Note:
My backtesting skills are rudimentary
Tested on US share data
Trading ideas kept purposefully simple for reasons of robustness

So far I'm thinking if you want to go mechanical, go longer term. (Bearing out the techtrader experiment)

Shorter term systems work, but I think they have to be a bit less mechanical lest they underperform longer systems.

Anyone else coming up anything different?


----------



## CanOz

ijw said:


> /* Clean up database*/
> 
> /*there are the string functions to help with these
> run the explore, save all to a watchlist then in Assignment Organizer
> delete them
> 
> example*/
> 
> Filter= StrRight(Name(),3)==".AX" OR StrLen(Name())>4;
> AddTextColumn(Name(),"name");
> 
> I use the above code to clean out  any symbols that are longer than than 4 letters.
> 
> I use two ASX databases.
> 
> Adjusted EOD data I get from Premium Data which  assigns the data to the various watchlists automatically at the end of day when updating.
> 
> The second database is unadjusted data that includes warrants and options and is intra day. I use the above code to clean it up. The data originally was sourced from Yahoo, and the code was designed to get rid of the .AX extension.
> 
> I have just ordered the  Quantitive Trading Systems book myself and am interested in your comments. I've had AB for some years now, however, my programming skills are still pretty rough.
> 
> Anyway, came across this thread by accident and am finding it an interesting read. Keep up the good work guys.
> 
> Cheers
> IJW




Thanks heaps for that IJ!

Say...i've started using the latest beta verson and it won't save my watchlists....any ideas?

Also, when i try and filter to backtest only ASX200, i get no results??

As far as the book goes, its a bargain!

Love to know if anyone else has read it...

Thanks Wayne for the update, i'll try to get something together worth testing again this week, and you can run it on the US data....

Sheesh Bandy is real fussy about data!

Cheers,


----------



## wayneL

CanOz said:


> Sheesh Bandy is real fussy about data!



TBH, I think he's spot on. A few unadjusted splits/dirty data could easily blow up an otherwise good backtest.


----------



## theasxgorilla

wayneL said:


> Shorter term systems work, but I think they have to be a bit less mechanical lest they underperform longer systems.
> 
> Anyone else coming up anything different?




Nope, I concur this.  My testing suggests that when talking about really short term ie. out to about 5 days, but could be as short as buy today, sell tomorrow, based on EOD signals, you can get up to a few percent annualised.  Hardly staggering, although as Nick pointed out, the exposure factor is also very low...sometimes you're in the market just 1-2% of the time.  The opportunity factor of the system can be increased by exposing it to more markets.

Although it seems you can only crank up the 'heat' factor so much as it appears that it is inherent in these systems that every so often you get a big multi-R loss.  Makes sense when you think about it.  A gap down through your stop loss and your ability to control and limit loss to 1xR is smashed.  If you had 1R set at 2% of your account and you had concurrent exposure to 10 markets and you were suddenly hit with 10 x 2R losses, you'd experience a drawdown of 40%.  The recovery factor of these systems is relatively low, so you'd be taking a while to bounce back from that one.


----------



## nizar

theasxgorilla said:


> Nope, I concur this.  My testing suggests that when talking about really short term ie. out to about 5 days, but could be as short as buy today, sell tomorrow, based on EOD signals, you can get up to a few percent annualised.  Hardly staggering, although as Nick pointed out, the exposure factor is also very low...sometimes you're in the market just 1-2% of the time.  The opportunity factor of the system can be increased by exposing it to more markets.
> 
> Although it seems you can only crank up the 'heat' factor so much as it appears that it is inherent in these systems that every so often you get a big multi-R loss.  Makes sense when you think about it.  A gap down through your stop loss and your ability to control and limit loss to 1xR is smashed.  If you had 1R set at 2% of your account and you had concurrent exposure to 10 markets and you were suddenly hit with 10 x 2R losses, you'd experience a drawdown of 40%.  The recovery factor of these systems is relatively low, so you'd be taking a while to bounce back from that one.




ASX.G.

You'd be very unlucky for that to happen.
When a stock opens below your stop thats what you call a black swan event, its supposed to be rare.

And 40% Max.DD is acceptable to some people. William Eckhardt's $250million fund has 40%ish max.DD and he makes around 28% annualised. A fair effort.

Even though its rare, it happened to me on a few stocks coz i was on holiday at the beginning of the year, and went back into the market on guess what day.... yep.... February 26th.... one day before the correction.... 
Hows that for timing 

But nice discussion about exposure factor...
Thanks for that....


----------



## wayneL

nizar said:


> ASX.G.
> 
> You'd be very unlucky for that to happen.
> When a stock opens below your stop thats what you call a black swan event, its supposed to be rare.



Not really. Stock distributions of returns are leptokurtic i.e. they have fat tails. This means Black Swans happen more often than you would think.

It is this that makes trend following systems work, and it is this that means you get crunched in a gap down more often than normal distribution suggests.

In this market traders are just used to the upside fat tail and have been relatively unexposed to the downside fat tail.

This will also eventually regress to the "mean" and traders will get more frequent unexpected and unwelcome price shocks at some point in the future.

Be prepared for that.


----------



## theasxgorilla

nizar said:


> You'd be very unlucky for that to happen.
> When a stock opens below your stop thats what you call a black swan event, its supposed to be rare.




You mean like LTCM rare?? :



nizar said:


> And 40% Max.DD is acceptable to some people. William Eckhardt's $250million fund has 40%ish max.DD and he makes around 28% annualised. A fair effort.




From memory Eckhardts style is more trend following.  This is not that technique.  Its not likely for you to bounce back from a 40% drawdown using this technique...the expectancy tends not to be high enough.


----------



## wayneL

Black Swans:

As luck would have it, TradeKing Blog just posted an article on Black Swans, Taleb etc



> *Understanding Highly Improbable Events*
> from The TradeKing Blog
> Over on the EconTalk blog, Russ Roberts interviews Nassim Nicholas Taleb, author of the recently published The Black Swan as well as the best-selling Fooled By Randomness. As Taleb points out over the course of a one-hour conversation, traders need to be able to cope with uncertainty and understand the underlying probability of events actually happening. Using a metaphor involving Mediocristan (a place where nothing much out of the ordinary occurs) and Extremistan (a place where highly improbable events are a fact of life), Taleb outlines the impact that outlier events (i.e. Black Swans) often have on final outcomes:
> 
> “Nassim Taleb talks about the challenges of coping with uncertainty, predicting events, and understanding history. This wide-ranging conversation looks at investment, health, history and other areas where data play a key role. Taleb, the author of Fooled By Randomness and The Black Swan, imagines two countries, Mediocristan and Extremistan where the ability to understand the past and predict the future is radically different.
> 
> In Mediocristan, events are generated by a underlying random process that is normally distributed. These events are often physical and observable and they tend to cluster around the middle. Most people are near the average height and no adult is more than nine feet tall.
> 
> But in Extremistan, the right-hand tail of events is thick and long and the outlier, the seemingly wildly unlikely event is more common than our experience with Mediocristan would indicate. Bill Gates is more than a little wealthier than the average. The civil war in Lebabon or the events of 9/11 were more worse than just a typical bad day in the Beirut or New York City.
> 
> Taleb's contention is that we often bring our intuition from Mediocristan for the events of Extremistan, leading us to error. The result is a tendency to be blind-sided by the unexpected.”


----------



## ijw

Canaussieuck,

I take it we're talking about v 4.96 beta?

I don't know why you would be having a problem saving the watchlists. The whole new approach to managing them is a lot easier. But I guess that  isn't much good if you can't save the damn things.

I'm sure Thomasz will have the answer.

Cheers
IJW


----------



## bingk6

Hi Nick,

I would tend to concur with both Wayne and Asxg. I have found it a big challenge to build a sufficiently profitable short term (1 day hold) mechanical system based on EOD data. By that, I mean using only recent price bar information to identify a setup and then to initiate either a non discretionary buy or short at the open of the next day and to terminate the trade one day later (once again at the open). When one includes the round-trip commission, I have found it difficult to make any form of meaningful return. 

Your earlier suggestion regarding the 3 consecutive contracting bars is very useful in identifying a situation whereby subsequent price is likely to be more volatile. My testing has shown this to be the case and to that end, it has served its purpose well. However, my problem (well one of my problems) is that I have not been able to identify consistently well the direction to take when the prices really start to move, especially when the trade is to last only one day. I cannot find a good enough edge for a one day buy/hold mechanical system. I have noticed that if I let the trades run a little longer (say 3 - 5 days hold), I can build more of an edge but still nothing to write home about. 

The more I think about it, the results that I have obtained would seem logical. We all know that casinos have a statistical edge over players. This statistical edge becomes more pronounced as the number of games played is increased. Therefore the casino accepts that there will be periods whereby they lose money, but in the end, if they are able to keep the players at the table long enough, they will clean up.

There is a lot of similarity between the casino analogy and our attempts to build a very short term mechanical EOD system, with the exception that we are now trying to be the casino in implementing a system with a statistical edge. Like the casino, this statistical edge should be more pronounced with more time in the trade, giving time for this statistical edge to play itself out. By trying to develop a one day buy/hold system is akin to the casino receiving a number of players hitting the tables with  single large bets (as opposed to a series of small bets) – something which casinos are not really keen on as it reduces the effectiveness of their statistical edge.  

It therefore makes sense to me that the shorter the time frame for our mechanical system, the bigger the edge you need to make it work. Like I said before, I have not been able to define a big enough edge to make it work. Perhaps I have not been able to adequately read the latent message in the price and volume bars leading up to the setup. With the two separate set of results that you have presented, it would appear that you obviously have found a usable edge. I would appreciate your comments on these two systems regarding :

1)	Whether they use any of the “micro-pattern” setups that you described in Adaptive Analysis?
2)	Do they look only at the price action immediately preceding the setup or do they scan back many months, eg to see where the previous all time high might be
3)	Are there specific markets whereby they work better than others (liquid stocks, illiquid stocks, futures, commodities etc etc)


----------



## wayneL

Just to clarify:

My comments are specifically about short/medium term trends verses longer term trends.

One day holds are an area I haven't even touched on in a mechanical sense, so cannot comment based on my own (non) research. Nick's mech system mentioned is a corker, I followed it when he was posting the trades live on his site. Tried to reverse engineer it too  Too tricky for me. 

A whole 'nuther bowl of wax IMO.


----------



## Nick Radge

> I would tend to concur with both Wayne and Asxg




That's fine. However, I've just shown 500+ real time trades based on a system using a single bar that has made in excess of 100% per year _*after*_ costs and slippage.



> I have found it difficult to make any form of meaningful return.




What people don't grasp, I assume, is that I do this for a living. I do it hours on end and have done so since the mid-90's. I don't mean a lazy Saturday aftrenoon, I mean hours every single day. These things don't happen over night. They take time and commitment. The edge exsists - you just need to keep looking and thinking differently. My biggest problem is that I lack imagination which is why I spend a lot of time skimming the net and looking for idea's. You'd be amazed what can turn up. I read forums. I visit sites. I even buy systems and courses at times. I need to see what others are thinking. From their work I can build my systems to suit me.

This said, I completely, 100%, agree, that the _*best*_ edge is generated from a longer hold time. Another post in this forum discusses "Elite Traders", Seykota, Dennis et al, and the thing that is missed is that most, if not all, of these elite traders are trend followers. 90% of managed money within alternate asset classes are managed by trend followers and 99% of those are systematic.

_1) Whether they use any of the “micro-pattern” setups that you described in Adaptive Analysis?_
My experience shows that a momentum based strategy will outperform a contrarian strategy at this level. A trend following strategy, such as my Growth or Growth Plus Portfolio's within The Chartist also work very well using 1 min bars. If you can be bothered to sit there, you'd do very well. I've said on numerous occassions, if you understand _*why*_ the profits are being made, then you can start to think very differently. Applying an EOD trend following system to 1-min data to increase trade frequency is one example.

_2) Do they look only at the price action immediately preceding the setup or do they scan back many months, eg to see where the previous all time high might be_
They concentrate on recent activity, especially volatility, which is why I mentioned the 3-inside days.

_3) Are there specific markets whereby they work better than others (liquid stocks, illiquid stocks, futures, commodities etc etc)_
The issue with stocks/CFD's (rephrase; Australian stocks/CFD's) is the cost of doing business. I have several excellent short term systems that trade stocks or CFD's. I can get $33 comm's for $200k worth of stock, but I can't get the leverage. To get the leverage via CFD's means paying the percentage. The percentage takes a big lump off the bottom line, but the systems still make money. It makes me want to become a CFD provider rather than trader though. People wonder why every man and his dog has a CFD platform now - its money for jam. My personal preference is futures. No where can you get the leverage for the cost. In another post on this forum, someone discusses the cost of index CFD's. They mention 2bps r/t, which to me is $100 per trade. I pay $5 r/t to trade the SPI. Why would I ever pay a CFD provider?

The only downside with futures is trade frequency on an EOD basis. I can run my short term system across 3 -4 futures markets, but I can run it across 10 - 15 stocks. With 10 - 15 stocks I can get a much smoother equity curve and build the account a lot more. Problem is that the CFD provider makes more than me...


----------



## bingk6

Hi Nick,

Many thanks for your detailed reply. I guess its all part of the journey in learning about what works and why it works. There is no question in my mind that having a profitable very short term trading system running in the background is an extremely useful tool to have in any traders armory, to complement any longer term strategies that you may have.

The development of a profitable shorter term system is unquestionably more complex than a long term system. The fact that you have managed to develop several of these system would give those of us aspiring down the same path some much needed encouragement and we thank you for that.

Back to the grindstone !!!


----------



## nizar

Nick Radge said:


> Applying an EOD trend following system to 1-min data to increase trade frequency is one example.




Nice!
I think iv just had an "Aha!" moment.

Thanks Nick.


----------



## lesm

Below are a couple of patterns that may be of interest or an idea for a system.


----------



## CanOz

lesm said:


> Below are a couple of patterns that may be of interest or an idea for a system.




Are the ranges the only important factor in these Lesm? Is that why there are no O/Cs?

Cheers,


----------



## Sean K

Is this the type of entry you're looking for with the system?

Looks like a pennant with three inside candles to me, or do they have to be within the full body.

Or am I in the wrong thread? 

(Not holding)


----------



## CanOz

Thats the one.

I'm on holidays  now so i'll fire up the discussion Monday morning.

Cheers,


----------



## CanOz

But hey, thats a weekly right. We're looking for that pattern on a daily...but thats not to say that it wouldn't work, maybe a longer term...food for thought.

Cheers,


----------



## nizar

CanOz said:


> But hey, thats a weekly right. We're looking for that pattern on a daily...but thats not to say that it wouldn't work, maybe a longer term...food for thought.
> 
> Cheers,




This what i have maintained the WHOLE TIME.

But everyone was like, nah thats been done with techtrader and focussed on short term systems.

So whats it gonna be? Short term or longer term.

My personal interest is on longer term systems -- i think they outperform short term systems, at least for stocks. Im my opinion.


----------



## wayneL

nizar said:


> This what i have maintained the WHOLE TIME.
> 
> But everyone was like, nah thats been done with techtrader and focussed on short term systems.
> 
> So whats it gonna be? Short term or longer term.
> 
> My personal interest is on longer term systems --* i think they outperform short term systems, at least for stocks. Im my opinion.*



For a pure mechanical system, and REALLY LARGE accounts, I think I agree.

But depending on a host of factors, short term trading can WAY outperform long term systems.


----------



## nizar

kennas said:


> Is this the type of entry you're looking for with the system?
> 
> Looks like a pennant with three inside candles to me, or do they have to be within the full body.
> 
> Or am I in the wrong thread?
> 
> (Not holding)




Kennas.
Theres nothing i love more than a chart posted by you with the stock code NOT erased! :


----------



## nizar

wayneL said:


> For a pure mechanical system, and REALLY LARGE accounts, I think I agree.




Wayne.
Why is account size important?

Is it because of the high drawdown experienced by the really clean-up longterm systems?


----------



## wayneL

nizar said:


> Wayne.
> Why is account size important?
> 
> Is it because of the high drawdown experienced by the really clean-up longterm systems?



No

It's because most of the big outsized advances are in small cap stocks. A smaller account can move into and out of these stocks un-noticed. A large account is going to make these stock move.

For instance if you are stopped out and your million dollar position, your stop order might take out the whole depth. Big accounts just can't trade this way.

They have to trade the megolithic cap stocks.

A band of Guerillas verses the infantry.


----------



## nizar

wayneL said:


> No
> 
> It's because most of the big outsized advances are in small cap stocks. A smaller account can move into and out of these stocks un-noticed. A large account is going to make these stock move.
> 
> For instance if you are stopped out and your million dollar position, your stop order might take out the whole depth. Big accounts just can't trade this way.
> 
> They have to trade the megolithic cap stocks.
> 
> A band of Guerillas verses the infantry.




Yeh but doesnt that mean a small account size is better to start with ? 

Your starting to confuse me, or maybe im confusing myself


----------



## Sean K

nizar said:


> Kennas.
> Theres nothing i love more than a chart posted by you with the stock code NOT erased! :



Ha ha. I know where your going. Non too suttle. Not holding. I should have done that so I had any cred left with you. Sorry! : 

(I tell you what though, I'll be watching it Mon am! )


----------



## CanOz

kennas said:


> Ha ha. I know where your going. Non too suttle. Not holding. I should have done that so I had any cred left with you. Sorry! :
> 
> (I tell you what though, I'll be watching it Mon am! )




This ones a bit new to me...are we not supposed to post charts with the codes on them?

Cheers,


----------



## Sean K

CanOz said:


> This ones a bit new to me...are we not supposed to post charts with the codes on them?
> 
> Cheers,



LOL. No, that's not the case. I have done it some times so that I am not misread to be a 'ramper', that's all. I think that should probably be the case in this thread as well. We shouldn't be interested in stock codes here, just the chart.


----------



## Disqplay

*Not sure he is completed yet*

Looking at the thread it would appear that CanOz is still in the developement stage of the system. My guess is that he is close to doing some serious backtesting using various stops either n-bar or percent gain or loss. It also appears that the implementation of risk/reward is still in testing.

I agree that looking at stocks in different time frames may be the key to allowing you to make profitable trades on a short term daily basis this could be accomplished by plotting changes in weekly high and low compaired to monthly high and low and quarterly high and lows. This would give you a good idea on the ebb and flow of the stock over a longer time frame and yet allow you to see how the daily stock is behaving. 





above is a thumbnail attachement of showing this in place

Disq


----------



## tech/a

Weekly is easier to develop than Daily.
Daily than intraday and intraday easier than daytrading.

With longterm (Months,years) expect higher R/R.
Lower win rates.
higher peak to valley drawdowns.
Less trades.

Personally I'd like to see a shorter term (weeks days)
method attempted which incorporates shorts.

Just get on with the ideas guys test many different entries exits and stops.
Dont get hung up on making decision which are expected to be set in concrete1.

Once you get some NUMBERS all will start to fall into its place.

Nicks suggested 2 setups and a few others have been suggested.

Its NOT about being RIGHT its about being Profitable.

Code something up and I can test it for you.


----------



## Disqplay

*I agree tech/a*

You are one hundred percent correct on your point of that the trading system does not have to be right all of the time but it must be profitable in order to make it a viable system for trading. That is where the risk/reward from my previous post comes into play. Also you can backtest a system that is only correct 30% of the time but with proper money management you can have a profitable system. But the one thing that coding will not tell you is what your eyes will when looking at the charts. Using Amibroker I have approximate 7 scans I perform each day on the US market. Some of the stock appear on multiple scans and some only show up on one. Looking at the chart to review the results of the scans is what I use to make the final decision as to purchase the stock or to watch in for a few days. In most cases the stocks that appear on more than one scan will in most cases be one of the ones I will play. There are times when one sitting all by it's lonesome on just one scan result will be the play based on what my eyes on the chart are telling me and not what the coded scan is saying.

Disq


----------



## CanOz

tech/a said:


> Once you get some NUMBERS all will start to fall into its place.
> 
> 
> Its NOT about being RIGHT its about being Profitable.
> 
> .




Further to this and along Bany's lines of progress, its suggested that before we move on we select an objective function. The objective function will be used to measure the effectiveness of our system in the tests that we run. To me this makes sense as you need to decide what factors are most important to you before you start testing, otherwise what are you trying to achieve by testing?

Can we have some discussion about this?

We want things like:
1.) low drawdown
2.) frequent trades
3.) short holding period
4.) high percent annual gain
etc.

He suggests assigning scores to the criteria in the OF, and then adding up the score to determine the overall success as we move forward through testing.

Here are some quotes

"Choosing the objective function is the most important, and the most personnel, task in designing a trading syste."

and this

"Selection of the OF is a management decision and must be made prior to extensive model development"

For those experienced in designing systems, did you only use the BT report to score the system, or did you focus on a certain number of metrics in the report as Bandy suggests?

Cheers,


----------



## CanOz

BTW, heres the backtest report from Les's code....

Lets use this a basis to discussing the metrics we want to improve?

Cheers,


----------



## CanOz

As you can see from the report, the Max system and trade DD are quite high. I looked at this further and found 1 short  and a few longs were giving it a headache.

Like this one...

So generally it is worth looking at these trades further to find out specifically what happened?

Cheers,


----------



## CanOz

Here a long that got stopped out...only a few trades really mucked this up. 0 shorts were profitable.


----------



## CanOz

Typical of shorts, we need to take our profits quicker. So we should have a separate stop for the short trades. Any suggestions on how to differentiate the codefor the two differentstops?

Heres the code i'm currently using (i changes the liquidity threshold):



> /*
> 
> ASF Sample System Development
> 
> 2 Inside days AND 6/100 Historical Volatility Ratio
> 
> */
> 
> // Define system options can modify these as required
> 
> SetChartOptions( 2, chartShowDates|chartShowArrows );
> SetBarsRequired(10000,10000);
> SetTradeDelays( 1, 1, 1, 1);
> SetOption( "initialequity", 100000 );
> SetOption( "MaxOpenPositions", 10 );
> SetOption( "PriceBoundChecking", 1 );
> SetOption( "CommissionMode", 1 );
> SetOption( "CommissionAmount", 0.1 );
> 
> BuyPrice = SellPrice = Open;
> ShortPrice = CoverPrice = Open;
> PositionSize = -10; // always invest 10% of the current Equity
> 
> // Setup Conditions
> 
> VolumeCond = EMA(V * C, 21) > 300000; // Ensure at least $300k of money flow for 21 periods
> EMABuyCond = EMA(C, 35);
> EMAShortCond = EMA(L, 35);
> 
> // BuyTrigCond = O > Ref(L,-1); not used in this version
> 
> // NR4DAY
> // NR4Day = (H - L) < Ref(LLV(H-L,3),-1); // not used in this version
> 
> // 6/100 Historical Volatility
> HVSixOneHundred = (StDev(log(C/Ref(C,-1)),6)*100*sqrt(256)) / (StDev(log(C/Ref(C,-1)),100)*100*sqrt(256));
> HVRatioCond = HVSixOneHundred < 0.5;
> 
> // Check if 2 Inside days occur
> 
> InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
> InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
> InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;
> 
> // Long side - buy and sell conditions
> 
> // Buy Condition
> Buy = Sell = Short = Cover = 0;
> 
> BuySig = InsideDayCond AND HVRatioCond AND VolumeCond AND C > EMABuyCond ;
> 
> // Sell Condition
> 
> // SellSig = condition.......
> 
> Buy = BuySig;
> 
> 
> //Buy = ExRem(BuySig, SellSig);
> //Sell = ExRem(SellSig, BuySig);
> 
> // Short side - short and cover conditions
> 
> // Short Condition
> 
> ShortSig = InsideDayCond AND HVRatioCond AND VolumeCond AND Low < EMAShortCond;
> 
> // Cover Condition
> 
> // CoverSig = condition .......
> 
> Short = ShortSig;
> 
> //Short = ExRem(ShortSig, CoverSig);
> //Cover = ExRem(CoverSig, ShortSig);
> 
> // Define Stoploss Conditions
> 
> ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );
> 
> // Lists exploration results conforming to our buy/sell OR short/cover criteria
> 
> //Filter = Buy OR Sell OR Short OR Cover;
> 
> Filter = Buy OR Short;
> 
> AddColumn(Buy, "Buy", 1, colorDefault,IIf(Buy,colorGreen,colorDefault));
> //AddColumn(Sell, "Sell", 1, colorDefault,IIf(Sell,colorRed,colorDefault));
> AddColumn(Short, "Short", 1, colorDefault,IIf(Short,colorGreen,colorDefault));
> //AddColumn(Cover, "Cover", 1, colorDefault,IIf(Cover,colorRed,colorDefault));
> AddColumn(Open, "Open", 4.3);
> AddColumn(Low, "Low", 4.3); //
> AddColumn(High, "High", 4.3); //
> AddColumn(Close, "Close", 4.3); //


----------



## nizar

CanOz said:


> Here a long that got stopped out...only a few trades really mucked this up. 0 shorts were profitable.




No problem with this trade.
Looked like it was going to zero on that day.

*If one trade mucked up the numbers than its obviously not a robust system.*

And drawdown/percent profit is always a tough issue.
Depends on your personality/psychology, timeframe, and how much heat you are willing to take.


----------



## nizar

CanOz said:


> So generally it is worth looking at these trades further to find out specifically what happened?
> 
> Cheers,





I dont think so.
You will always have outliers but like i said in my previous post, they shouldnt affect the result to great degree.

Longterm systems rely on a few great winners a year but for short-term systems with higher trade frequency, outliers should have a lesser impact on the end results.

But Id be keen to hear what Nick or Tech or others have to say about this.

Can, have you got monte carlo analysis?


----------



## tech/a

There are some glaring issues.
D/D and string of losses the obvious.
Zero wins in the short method another infact it pulls down figures.
Testing has shown (my own) that simply reversing at a sell signal to a short
isnt profitable in the majority of cases.
If I have time tonight will comment more.


----------



## CanOz

nizar said:


> I dont think so.
> You will always have outliers but like i said in my previous post, they shouldnt affect the result to great degree.
> 
> Longterm systems rely on a few great winners a year but for short-term systems with higher trade frequency, outliers should have a lesser impact on the end results.
> 
> But Id be keen to hear what Nick or Tech or others have to say about this.
> 
> Can, have you got monte carlo analysis?




No, one of the drawbacks of AB. If you look at the report, you'll see that if we fix the exits on the shorts we should see a huge diff.

Cheers,


----------



## nizar

Omg.
I just had a look at the backtest report.
Its disgusting.
LOL seriously.

Firstly only 10.9% winners.
Iv seen some longterm systems with 30-35% winners but 10%??

As tech mentioned, largest string of losses is 49 as opposed to winners with 6.

Impossible to trade psychologically.

R/R = 0.08

And the drawdown stats....
Well, at 82% its.... 

We got a lot of work to do.


----------



## professor_frink

CanOz said:


> Typical of shorts, we need to take our profits quicker. So we should have a separate stop for the short trades. Any suggestions on how to differentiate the codefor the two differentstops?
> 
> Heres the code i'm currently using (i changes the liquidity threshold):




Hi canuck,

I can't seem to figure out what the entry + exit criteria is

I know we are looking for a reduction in the daily range as one of the parameters, but what actually triggers the entry?

Lesm's code doesn't make much sense to me(that's saying something about me, not the code Les)


----------



## CanOz

professor_frink said:


> Hi canuck,
> 
> I can't seem to figure out what the entry + exit criteria is
> 
> I know we are looking for a reduction in the daily range as one of the parameters, but what actually triggers the entry?
> 
> Lesm's code doesn't make much sense to me(that's saying something about me, not the code Les)




It looks for 3 inside days with this:

InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;

Then determines whether to go long or short with this:

 an EMA (35), but it goes long on a close > than "EMABuyCond = EMA(C, 35);" and shorts on a low less than "EMAShortCond = EMA(L, 35);"

Here's the buy signal...it has a volumecondition too.

BuySig = InsideDayCond AND HVRatioCond AND VolumeCond AND C > EMABuyCond ;

Heres the short signal:

ShortSig = InsideDayCond AND HVRatioCond AND VolumeCond AND Low < EMAShortCond;


I'm trying to figure out how to change the cover signal...so it gets out of the short trade sooner. It identifies short really well in what i've seen so far, it just hangs on too long turning a profit into a loss.

This is kinda fun...

cos i'm on holidays!

Cheers,


----------



## professor_frink

CanOz said:


> It looks for 3 inside days with this:
> 
> InsideDay1 = H < Ref(High,-1) AND Low > Ref(Low,-1);
> InsideDay2 = Ref(High,-1)< Ref(High,-2) AND Ref(Low,-1)> Ref(Low,-2);
> InsideDayCond = InsideDay1 == 1 AND InsideDay2 == 1;
> 
> Then determines whether to go long or short with this:
> 
> an EMA (35), but it goes long on a close > than "EMABuyCond = EMA(C, 35);" and shorts on a low less than "EMAShortCond = EMA(L, 35);"
> 
> Here's the buy signal...it has a volumecondition too.
> 
> BuySig = InsideDayCond AND HVRatioCond AND VolumeCond AND C > EMABuyCond ;
> 
> Heres the short signal:
> 
> ShortSig = InsideDayCond AND HVRatioCond AND VolumeCond AND Low < EMAShortCond;
> 
> 
> I'm trying to figure out how to change the cover signal...so it gets out of the short trade sooner. It identifies short really well in what i've seen so far, it just hangs on too long turning a profit into a loss.
> 
> This is kinda fun...
> 
> cos i'm on holidays!
> 
> Cheers,




OK gotcha. There doesn't seem to be any exit conditions as yet. Correct?


----------



## CanOz

professor_frink said:


> OK gotcha. There doesn't seem to be any exit conditions as yet. Correct?




Only a stop loss, so yes thats correct:


> ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );



But he's got this ready to be considered:



> // Cover Condition
> 
> // CoverSig = condition .......
> 
> Short = ShortSig;
> 
> //Short = ExRem(ShortSig, CoverSig);
> //Cover = ExRem(CoverSig, ShortSig);




 ...its only the "//" comment markers that disable it, it needs a condition to cover defined...so what should we use...it needs to be something that covers once you have three strong closes...like three up days...like this


----------



## professor_frink

CanOz said:
			
		

> Only a stop loss, so yes thats correct:
> 
> 
> 
> 
> ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );
> 
> 
> 
> 
> But he's got this ready to be considered:
> 
> 
> 
> // Cover Condition
> 
> // CoverSig = condition .......
> 
> Short = ShortSig;
> 
> //Short = ExRem(ShortSig, CoverSig);
> //Cover = ExRem(CoverSig, ShortSig);
> 
> Click to expand...
> 
> 
> ...its only the "//" comment markers that disable it, it needs a condition to cover defined...so what should we use...it needs to be something that covers once you have three strong closes...like three up days...like this
Click to expand...



Ok thanks canuck.



Looking for 3 up days before covering a short would mean you are almost looking for a medium term trend to make a decent profit. That doesn't seem to fit in with the idea of a short term trade(well to me anyway).

I quite like the inside day idea as a set up for a short term trade, but it seems to me that it doesn't help on picking direction at all. Whilst the EMA condition will help to keep you on the right side of the overall trend, I don't think the overall trend is really that big of an issue if we are only looking at holding for a few days. My first thought would to be looking at jumping on a breakout of the group of inside days. 

As for exits, I think it was Nick that mentioned it earlier in the thread- looking for range expansion as a possible exit. I quite like this idea, but have absolutely no idea how you would code it

Chart below is a good example of what I'm talking about. I know it's a long trade, but it was the first setup I saw- but it does illustrate one point fairly well- look at the difference in hold times there is when looking for a range expansion to exit, as opposed to waiting for price to move for consecutive days against you. You would be out in half the time in this case.

Looking at the RIO example you just posted,  I'd be looking to code an exit to take advantage of either the first or second thrust down during the downtrend. Might be a more efficient use of capital- you'd save yourself  2 weeks hold time and achieve a similar result- you'd be able to get the system trading more often this way, which would make a pretty big difference to the overall profitability of the system.


----------



## rub92me

CanOz said:


> Further to this and along Bany's lines of progress, its suggested that before we move on we select an objective function. The objective function will be used to measure the effectiveness of our system in the tests that we run. To me this makes sense as you need to decide what factors are most important to you before you start testing, otherwise what are you trying to achieve by testing?
> 
> Can we have some discussion about this?
> 
> We want things like:
> 1.) low drawdown
> 2.) frequent trades
> 3.) short holding period
> 4.) high percent annual gain
> etc.



Here's my suggestions to gauge whether it is a (short term) system worth trading.
1) Drawdown < 40% - I think it will become very hard to sit through anything worse than that without wanting to intervene.
2) > 100 trades (Assuming 1 year of trades)
3) Average holding < 5 days and (average hold for losing trades) < (average hold winning trades)
4) I don't think we want to set a target for annual % gain, that will come automatically once we've taken care of the rest. Maybe consider setting targets on % winning trades (target > 35%) and win/loss ratio > 2.


----------



## wayneL

rub92me said:


> Here's my suggestions to gauge whether it is a (short term) system worth trading.
> 1) Drawdown < 40% - I think it will become very hard to sit through anything worse than that without wanting to intervene.
> 2) > 100 trades (Assuming 1 year of trades)
> 3) Average holding < 5 days and (average hold for losing trades) < (average hold winning trades)
> 4) I don't think we want to set a target for annual % gain, that will come automatically once we've taken care of the rest. Maybe consider setting targets on % winning trades (target > 35%) and win/loss ratio > 2.



For my  here, i think the system should shoot for drawdown WAY less than 40%. 

Short term systems don't have the same risk/reward parameters as long term systems and work because of greater frequency of trades. This means a recovery from say 35% DD can be a long slog.

Also that much DD on a short term system would seriously mess with your head. 

I don't get much DD at all with my trading, but with a mechanical system, "some" must be accepted. I don't know what the figure should be, but perhaps 20%ish?


----------



## CanOz

Prof...excellent thinking...could be applied to the shorts at the very least.

More on this later...got to get some dinner groceries...just woke up from a nap....gotta love holidays

RUB92me and Wayne...can one of you start a matrix scorecard on Excel to use as our Obj.Function...we need to propose the items such as what you listed, then weight them according to importance to us....then we can score each test.

Eg. DD, weight 10, AR - weight 4, Win rate >40% weight 6 ...etc.


Cheers,


----------



## lesm

Can,

Below is another variation. Think it's using Docj's suggestion from memory. Needed to add the volume/liquidity condition though.

Using the IG Markets Shares List and the period is 2/1/2006 to 18/6/2007.



		Code:
	

/* 

ASF Sample System Development Version 1.0

*/

// Define system options can modify these as required

SetChartOptions( 2, chartShowDates|chartShowArrows ); 
SetBarsRequired(10000,10000); 
SetTradeDelays( 1, 2, 1, 2);
SetOption( "initialequity", 100000 );
SetOption( "MaxOpenPositions", 10 ); 
SetOption( "PriceBoundChecking", 1 ); 
SetOption( "CommissionMode", 1 ); 
SetOption( "CommissionAmount", 0.1 ); 

BuyPrice = SellPrice = Open;
ShortPrice = CoverPrice = Open;
Buy = Sell = Short = Cover = 0;
PositionSize = -10; // always invest 10% of the current Equity 

// Setup Conditions

VolumeCond = EMA(V * C, 21) > 500000; // Ensure at least $500k of money flow for 21 periods

// Long side - buy and sell conditions

 
BuySig = Open > Ref(C,-1)<O AND Ref(V,-1)> (2*Ref(EMA(V,13),-1)) AND C>Ref(C,-1) AND ( Ref(H,-1)-Ref(L,-1))< Ref(EMA(H-L,13),-1) AND VolumeCond;
SellSig = 1;

Buy = ExRem(BuySig, SellSig);
Sell = ExRem(SellSig, BuySig);

// Short side - Short and Cover conditions

ShortSig = Open < Ref(C,-1)<O AND Ref(V,-1)> (2*Ref(EMA(V,13),-1)) AND C>Ref(C,-1) AND ( Ref(H,-1)-Ref(L,-1))< Ref(EMA(H-L,13),-1) AND VolumeCond;
CoverSig = 1;

Short = ExRem(ShortSig, CoverSig);
Cover = ExRem(CoverSig, ShortSig);

//Define Stoploss Conditions

ApplyStop(stopTypeLoss, stopModePercent, amount = 10 );

//Lists exploration results conforming to our Buy/Sell OR Short/Cover criteria
 
Filter = Buy OR Sell OR Short OR Cover;

AddColumn(Buy, "Buy", 1, colorDefault,IIf(Buy,colorGreen,colorDefault));
//AddColumn(Sell, "Sell", 1, colorDefault,IIf(Sell,colorRed,colorDefault));
AddColumn(Short, "Short", 1, colorDefault,IIf(Short,colorGreen,colorDefault));
//AddColumn(Cover, "Cover", 1, colorDefault,IIf(Cover,colorRed,colorDefault));
AddColumn(Open, "Open", 4.3); 
AddColumn(Low, "Low", 4.3); // 
AddColumn(High, "High", 4.3); // 
AddColumn(Close, "Close", 4.3); //


----------



## doctorj

I was wondering if that was going to resurface.  I'm rather fond of it, but think its a fair way off being tradeable.  Also, I don't think going short is as simple as reversing the buy condition.  The logic for the system was based on something intended for long trades.

Need to tend to dinner, but will come back with more later.  Will also run it thru tradesim.


----------



## lesm

doctorj said:


> I was wondering if that was going to resurface.  I'm rather fond of it, but think its a fair way off being tradeable.  Also, I don't think going short is as simple as reversing the buy condition.  The logic for the system was based on something intended for long trades.
> 
> Need to tend to dinner, but will come back with more later.  Will also run it thru tradesim.




Doc,

As you originally mentioned it was a bit quick and rough at the time, but it is a starting point.

Yes, quite true, going short is not necessarily as simple as reversing the buy condition.

If you are going to run it through Tradesim and you have the Enterprise edition, would you mind doing a quick Monte Carlo analysis on it?

Cheers.


----------



## CanOz

lesm said:


> Doc,
> 
> As you originally mentioned it was a bit quick and rough at the time, but it is a starting point.
> 
> Yes, quite true, going short is not necessarily as simple as reversing the buy condition.
> 
> If you are going to run it through Tradesim and you have the Enterprise edition, would you mind doing a quick Monte Carlo analysis on it?
> 
> Cheers.




Les, can you explain the differences to me...like i'm a two year old

I see you uncommented the short and cover conds too...

Cheers,


----------



## doctorj

lesm, I'm in the process of translating your exits to metastock language.  It's been a while since I've used AB, so I'm struggling a little.

I see your stop loss, but how does your code account for exiting a winning trade (a trailing stop)?


----------



## lesm

doctorj said:


> lesm, I'm in the process of translating your exits to metastock language.  It's been a while since I've used AB, so I'm struggling a little.
> 
> I see your stop loss, but how does your code account for exiting a winning trade (a trailing stop)?




Doc,

There is only the stop loss (10%).

The AB setting sets up the buy, sell, short and cover delays, as in:

SetTradeDelays(1, 2, 1, 2) or (n=BuyDelay, n=SellDelay, n=ShortDelay, n=CoverDelay)

Buy, Sell, Short and Cover all occur on the respective open.

The buy and short will occur on the next days open or delayed by one day from the original signal.

The sell and cover are delayed by two days from the original signal.

What I am seeing in the AB backtest report is that the trade is being exited two days after the buy or short signal is being activated/executed.

If the buy or short is on the 4/4/2006 then the sell or cover is on the 6/4/2006.

SellSig = 1 and CoverSig = 1

Means that the both the sell and cover signals are set to 'True', hence 'SetTradeDelays' controls/determines the holding period and the trade is exited based on these settings.

A sell/cover condition isn't used, as an exit.

Hope this makes sense.


----------



## tech/a

lesm.
Looks much better.


----------



## doctorj

Apologies for not getting there sooner.

Monte Carlo Report
(ASF Master)

Simulation Summary
Simulation Date:                                            21/06/2007
Simulation Time:                                           10:25:18 PM
Simulation Duration:                                    189.38 seconds

Trade Parameters
Initial Capital:                                            $50,000.00
Portfolio Limit:                                               100.00%
Maximum number of open positions:                                  100
Position Size Model:                                Fixed Percent Risk
Percentage of capital risked per trade:                          2.00%
Position size limit:                                           100.00%
Portfolio Heat:                                                 20.00%
Pyramid profits:                                                    No
Transaction cost (Trade Entry):                                  $0.00
Transaction cost (Trade Exit):                                   $0.00
Margin Requirement:                                            100.00%

Trade Preferences
Trading Instrument:                                             Stocks
Break Even Trades:                                  Process separately
Trade Position Type:                                Process all trades
Entry Order Type:                                        Default Order
Exit Order Type:                                         Default Order
Minimum Trade Size:                                              $0.00
Accept Partial Trades:                                              No
Volume Filter:                               Ignore Volume Information
Pyramid Trades:                                                     No
Use Level Zero trades only:                                        Yes

Simulation Stats
Number of trade simulations:                                     20000
Trades processed per simulation:                                  4929
Maximum Number of Trades Executed:                                2808
Average Number of Trades Executed:                                2800
Minimum Number of Trades Executed:                                2733
Standard Deviation:                                               5.16

Profit Stats
Maximum Profit:                                   $57,227.30 (114.45%)
Average Profit:                                    $33,368.44 (66.74%)
Minimum Profit:                                     $9,128.87 (18.26%)
Standard Deviation:                                 $6,088.64 (12.18%)
Probability of Profit:                                         100.00%
Probability of Loss:                                             0.00%

Percent Winning Trade Stats
Maximum percentage of winning trades:                           47.04%
Average percentage of winning trades:                           45.35%
Minimum percentage of winning trades:                           43.69%
Standard Deviation:                                              0.43%

Percent Losing Trade Stats
Maximum percentage of losing trades:                            43.16%
Average percentage of losing Trades:                            41.17%
Minimum percentage of losing trades:                            39.69%
Standard Deviation:                                              0.42%

Average Relative Dollar Drawdown Stats
Maximum of the Average Relative Dollar Drawdown:               $146.87
Average of the Average Relative Dollar Drawdown:               $125.80
Minimum of the Average Relative Dollar Drawdown:               $111.38
Standard Deviation:                                              $4.04

Average Relative Percent Drawdown Stats
Maximum of the Average Relative Percent Drawdown:              0.2650%
Average of the Average Relative Percent Drawdown:              0.2096%
Minimum of the Average Relative Percent Drawdown:              0.1640%
Standard Deviation:                                            0.0142%

Maximum Peak-to-Valley Dollar Drawdown Stats
Maximum Absolute Dollar Drawdown:                           $15,690.15
Average Absolute Dollar Drawdown:                            $7,673.25
Minimum Absolute Dollar Drawdown:                            $4,266.19
Standard Deviation:                                          $1,101.20

Maximum Peak-to-Valley Percent Drawdown Stats
Maximum Absolute Percent Drawdown:                            26.5318%
Average Absolute Percent Drawdown:                            12.8804%
Minimum Absolute Percent Drawdown:                             7.1799%
Standard Deviation:                                            1.8038%


----------



## doctorj

Hmmm I smell a rat.

Perhaps someone else can run it while I work out what I did wrong


----------



## Kauri

doctorj said:


> Hmmm I smell a rat.
> 
> Perhaps someone else can run it while I work out what I did wrong




 Doc..Not sure if you meant to leave it out but with $30 a side brokerage... might look different.


----------



## SteveM

Kauri said:


> Doc..Not sure if you meant to leave it out but with $30 a side brokerage... might look different.




Average Trades (2800) * Brokerage (30) = $84,000.

With a max profit of $57,227.30 that would turn out to be a loss of @26,772.20


----------



## doctorj

Indeed. Can you tell I don't use tradesim too often? I ran the simulation again just after and it returned a loss (I correctly included the commission the second time) hence why I posted something was amiss.

It's not a complete fowl up though. It does show the entry isn't entirely bad. The question now is whether there is anything practical we can change to make it profitable (position sizing, the exit, the universe of stocks)? Tweaking the entry to exclude stocks without an upward bias by including a long term MA would be my starting point. We need to establish whether or not the system has an edge we can exploit.

Or, alternatively, we decide the system is nice in theory, but isn't tradeable. Plenty of ideas like that around.


----------



## happytrader

doctorj said:


> Indeed. Can you tell I don't use tradesim too often? I ran the simulation again just after and it returned a loss (I correctly included the commission the second time) hence why I posted something was amiss.
> 
> It's not a complete fowl up though. It does show the entry isn't entirely bad. The question now is whether there is anything practical we can change to make it profitable (position sizing, the exit, the universe of stocks)? Tweaking the entry to exclude stocks without an upward bias by including a long term MA would be my starting point. We need to establish whether or not the system has an edge we can exploit.
> 
> Or, alternatively, we decide the system is nice in theory, but isn't tradeable. Plenty of ideas like that around.




Hi Doctorj

May I suggest you test say 10 bluechips across the sectors with entry time at say 2.45pm and exit at 10.45am? 

Cheers
Happytrader


----------



## doctorj

happytrader said:


> Hi Doctorj
> 
> May I suggest you test say 10 bluechips across the sectors with entry time at say 2.45pm and exit at 10.45am?
> 
> Cheers
> Happytrader



Happytrader - I don't have intraday data and I'm not sure how your post follows through on the work we've done to date.


----------



## SteveM

I imagine that position size would have a great bearing on the result. I'm not sure how the software works out the size, but I assume initially it is either starting funds / max positions ($500.00) or starting size * max risk ($1000.00). 
Could you try the same simulation with a trading size around $5,000 as that would reduce the impact of brokerage.


----------



## bingk6

OK Guys, FWIW, I’ll present a very simple (rough as guts) system that is based on a volatility breakout, using Nick’s suggestion as a basis.

The system identifies the 3 inside bar setup and then immediately looks for a breakout bar, which is defined by having High greater than the high of the smallest inside (a clear break from the micro-triangle). The other caveat is that the low of the breakout bar must be within the range of the smallest breakout bar. 

When the breakout bar is identified, a long @ open is initiated the following day and the trade is automatically closed off after 5 days (also at the open). 

Because the system only holds for 5 days and the frequency of trade is not overly high, I have adjusted the parameters to allow each position trade to be larger (otherwise the system will sit there with cash in the bank doing nothing)

1) $100K initial investment
2) only 4 max concurrent trades
3) Each trades uses using 25% of available equity.

Stock Universe:	ASX300
Test Period:	Last 1000 quotations

Even then, the exposure to the market is SFA. 

The Setup, Amibroker code and results follow:


----------



## tech/a

*Good job.*

At last something to work with.

Have you run it over a number of portfolios.
I dont use Ami so dont know its full capabilities.
Can also start playing with exits and stops to seek improvement.
Could also look at various universes.

If someone knocks this up in M/S code I'll run Tradesim Montecarlo on it and try a few varients.

Dont have a lot of time myself.
But if no code pops up I'll do it when I get a chance.


----------



## onemore

tech/A,Bingk6

That Pattern is called a Shark Bar Pattern.
Google "Shark-32 "
At the top of the page you will find the code for Metastock and Tradestation.

The Guy Walter Downs talks about a break above the High of the pattern, not a break above the high of the last inside bar.

I dont Know if this will help or not.

Cheers....Onemore


----------



## bingk6

Tech,

The testing was done on a portfolio level.

The number of trades involved in this system is so small, 228 trades over a test period of 1000 days, across 300 stocks, it works out at roughly less than 1 trade every 4 days. What are the odds of having more than 4 stocks competing for funds on any given day? Probably close to zilch. In any case, when the trade goes on, it only lasts for 5 days, so the exposure to the market is very small. In this instance, Monte Carlo Analysis may have very limited application because funds will be available to take every trade.

As far as the Metastock code is concerned, as there are no looping involved, it can be taken out pretty much exactly as per the Amibroker code I enclosed previously, viz:


LiquidityCond:= EMA(V * C, 21) > 500000;   
InsideDay1:= H <= Ref(High,-1) AND Low >= Ref(Low,-1);  
InsideDay2:= Ref(High,-1)<= Ref(High,-2) AND Ref(Low,-1)>= Ref(Low,-2);  
InsideDayCond:= InsideDay1 AND InsideDay2 ;  
Extremevolume:=V>=2*Ref(EMA(V,5),-1);   
Closepercentile:=(C-L)/(H-L);  
Closeonhigh=:Closepercentile>=0.7;  
Buy:= Ref(Insidedaycond,-1) AND Ref(Liquiditycond,-1)	
AND L>=Ref(L,-1) AND L<=Ref(H,-1) AND H>Ref(H,-1) 
AND Closeonhigh AND Extremevolume;


The Metastock code for the exit is very difficult to code, as we simply want to exit unconditionally after 5 days. Tradesim (I believe) does allow you to simulate these sorts of exits easily. Amibroker does it easily.


As for the system, I have done more testing to test the effectiveness of the of the 5 day stop relative to other stops. Attached below are the results all the way from 1day stop to 30 day stop and everything else in between.

Look at the system %DD, all <20%. For a short term system, we must aim for <20%. The concept for such a short term is to pinch your profit whenever you can, so that hopefully whenever the bad days occur in the market, you are NOT in it. Thats the theory anyway.

So Can (our fearless leader!!! ), plenty of material presented as a starting point, FWIW. Admitted its rough, no sophiscated exits, no money management, no trailing stops - simple entry, so lets see where we go from here.


----------



## bingk6

onemore said:


> tech/A,Bingk6
> 
> That Pattern is called a Shark Bar Pattern.
> Google "Shark-32 "
> At the top of the page you will find the code for Metastock and Tradestation.
> 
> The Guy Walter Downs talks about a break above the High of the pattern, not a break above the high of the last inside bar.
> 
> I dont Know if this will help or not.
> 
> Cheers....Onemore




Yes, I can see the similarities. Wish I had known about this. Will see if we can pinch some ideas from your link. Thanks for posting.


----------



## doctorj

For those looking to set a time-related stop in Metastock that have Tradesim, the following code will do it for you:

ExtFml( "TradeSim.SetTimeStop",X ); 
Where X is an positive whole number.  If it's a daily system, it will exit after x days.

It's probably possible to code a time-related stop with vanilla metastock using the dayofmonth() and year() functions.


----------



## tech/a

Doing a bit of work on this.

This is my code.

I believe we want 2 inside days then the trigger bar.
Hence my code is a little different.

However it only gives me 26 trades in 8 yrs!

Ref(H,-1)<=Ref(HIGH,-2) AND Ref(LOW,-1)>=Ref(LOW,-2)AND Ref(HIGH,-2)<= Ref(HIGH,-3) AND Ref(LOW,-2)>= Ref(LOW,-3)AND L>=Ref(L,-1) AND L<=Ref(H,-1) AND H>Ref(H,-1) AND V>=2*Ref(Mov(V,5,E),-1) AND ((C-L)/(H-L))*.7;

Anyone see anything obvious?


----------



## MS+Tradesim

_"For those looking to set a time-related stop in Metastock that have Tradesim, the following code will do it for you:

ExtFml( "TradeSim.SetTimeStop",X ); 
Where X is an positive whole number. If it's a daily system, it will exit after x days."_

Just a minor correction... The above counts bars, not days, so:
ExtFml( "TradeSim.SetTimeStop",X ); 
...means exit on the Xth bar. 

To use days you need a dash in front of the number: 
ExtFml( "TradeSim.SetTimeStop",-X ); 
...which means exit on the Xth day.


----------



## tech/a

MS+Tradesim said:


> _"For those looking to set a time-related stop in Metastock that have Tradesim, the following code will do it for you:
> 
> ExtFml( "TradeSim.SetTimeStop",X );
> Where X is an positive whole number. If it's a daily system, it will exit after x days."_
> 
> Just a minor correction... The above counts bars, not days, so:
> ExtFml( "TradeSim.SetTimeStop",X );
> ...means exit on the Xth bar.
> 
> To use days you need a dash in front of the number:
> ExtFml( "TradeSim.SetTimeStop",-X );
> ...which means exit on the Xth day.




Do you mean a dash or - if "-" then that makes it a negative number and tradesim will report it as an error.


----------



## MS+Tradesim

From the Tradesim manual:

SetTimeStop

ExtFml(“TradeSim.SetTimeStop”,NBARS);

This function is used to limit the maximum number of bars before the RecordTrades function is forced to exit a trade irrespective of the condition of the ExitTrigger. When a trade is entered and a valid exit trigger has not been detected after NBARS have been counted the trade will automatically be terminated on the next bar. If NBARS is set to zero then the time stop will be disabled. A call to the Initialize function disables the effects of a call to this function. You can also specify the time stop in terms of days. This can be done by using a negative time value.i.e, -10 specifies a time stop of 10 days where as a +10 specifies a time stop of 10 bars.
Note: To avoid confusion the time stop now exits on the actual Nth bar/day rather than one bar/day after.


 Example
The following example sets up a time stop to automatically exit a trade after 60 bars have passed and an ExitTrigger has not been detected.
ExtFml(“TradeSim.SetTimeStop”,60);

 Example
The following example sets up a time stop to automatically exit a trade after 10 days have passed and an ExitTrigger has not been detected.
ExtFml(“TradeSim.SetTimeStop”,-10);


Copyright  © 2000-2007 by Compuvision Australia Pty Ltd. All Rights Reserved
http://www.compuvision.com.au - Last updated on 2 May 2007
Page 88
TradeSim ®
Pre-Release Beta Version 5.3.3


----------



## SteveM

tech/a said:


> Doing a bit of work on this.
> 
> This is my code.
> 
> I believe we want 2 inside days then the trigger bar.
> Hence my code is a little different.
> 
> However it only gives me 26 trades in 8 yrs!
> 
> Ref(H,-1)<=Ref(HIGH,-2) AND Ref(LOW,-1)>=Ref(LOW,-2)AND Ref(HIGH,-2)<= Ref(HIGH,-3) AND Ref(LOW,-2)>= Ref(LOW,-3)AND L>=Ref(L,-1) AND L<=Ref(H,-1) AND H>Ref(H,-1) AND V>=2*Ref(Mov(V,5,E),-1) AND *((C-L)/(H-L))*.7;*
> 
> Anyone see anything obvious?




Should that section be ((C-L)/(H-L))>=.7;

Though I doubt that would give you more results as the way it is written (*.7) would always give a TRUE unless C=L

Most stocks would only achieve the volume requirement a few times a year, without that I think you should find plenty of candidates


----------



## tech/a

Thanks M/S Id forgotten the Comma.

I have also dropped the Volume condition and now have 40 trades in 7 yrs.
I'm using the BT margin list.Which is roughly equivelent to the ASX300.

What are you other guys using for the universe to get 109 trades?

Also looking at the trade log profit is derived from on a few trades (Larger profit)
The problem appear to be frequency (Not enough) and Time in the trade (Not enough for this method.).


----------



## onemore

I found these in my explorer files. I used to search NASDAQ stocks years ago for that Shark Bar Pattern.

Symmetry:=.28;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);

If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2)),
If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
(Ref(L,-2)+(WB*Symmetry)) ,1,0),0);


Symmetry:=.10;
Apex:=(H+L)/2;
WB:=Ref(H,-2)-Ref(L,-2);

If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
Ref(L,-1)>Ref(L,-2)),
If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
(Ref(L,-2)+(WB*Symmetry)) ,1,0),0);


Are They any help?

Onemore.


----------



## Chorlton

onemore said:


> I found these in my explorer files. I used to search NASDAQ stocks years ago for that Shark Bar Pattern.
> 
> Symmetry:=.28;
> Apex:=(H+L)/2;
> WB:=Ref(H,-2)-Ref(L,-2);
> 
> If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
> Ref(L,-1)>Ref(L,-2)),
> If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
> (Ref(L,-2)+(WB*Symmetry)) ,1,0),0);
> 
> 
> Symmetry:=.10;
> Apex:=(H+L)/2;
> WB:=Ref(H,-2)-Ref(L,-2);
> 
> If((H<Ref(H,-1) AND L>Ref(L,-1) AND Ref(H,-1)<Ref(H,-2) AND
> Ref(L,-1)>Ref(L,-2)),
> If(apex <= (Ref(H,-2)-(WB*Symmetry)) AND Apex >=
> (Ref(L,-2)+(WB*Symmetry)) ,1,0),0);
> 
> 
> Are They any help?
> 
> Onemore.





Hello All,

Here's a link to the MS code for the above mentioned 3-bar Shark Pattern...

http://trader.online.pl/MSZ/e-se-Combining_Statistical_Pattern_Analysis_Shark_32.html


Regards,

Chorlton


----------



## howardbandy

Greetings --

Thanks to those of you who had kind words for my book, Quantitative Trading Systems.

I see that the posting I am making now is about 6 weeks after the last post in the thread, so maybe this is a dead issue.  But I would like to make a couple of points.

First -- I am a firm believer that the objective function is extremely important, must incorporate the personality of the trader, and must be decided before serious testing of systems begins.  There were several suggestions in this thread to define an objective function, but I did not see that one was defined.  That is not surprising, since there are so many contributors to the thread.  The objective function needs to be personal.

Second -- Analysis of in-sample results cannot be used to estimate the future profitability (or whatever other metric is being used) of a trading system.  Only out-of-sample results can be used.  

Thanks for listening,
Howard Bandy
www.quantitativetradingsystems.com


----------



## Surly

I have read this thread with great interest as I am trying to get my head around charting and systems generally.

I have been following GBG's chart for some time and note they had reducing range followed by upswing day in July. They also have had reducing range for the last three days.

Sorry I don't have any way of posting a chart at this stage but can anyone confirm if I am reading this right and it fits the mechanics of the system discussed in this thread?

cheers
Surly


----------



## Joe Blow

Surly said:


> Sorry I don't have any way of posting a chart at this stage




Surly, step by step instructions on how to post charts can be found here: https://www.aussiestockforums.com/forums/showthread.php?t=6530


----------



## Surly

Sorry Joe. I also could of alt-printscreened it to I guess.

I have circled what I believe to be the first instance and also circled the last three days whic I think set up the beginning of the second instance.

Have I got this right?

cheers
Surly


----------



## chops_a_must

tech/a said:


> On Waynes adjustable exits.
> Cant use them in a system as the variables have to be fixed.
> Fine for discretionary,but how would you pick which variable to use?



The optimise function in AB works a treat.



tech/a said:


> In the end you'll have a set of parameters that if traded as designed and tested will return the expectancy found through testing.
> What you get with a system is a repetitive entry and exit which over time will give the sested return within the upper and lower boundaries of the returns found through testing.



How has that gone this year?



wayneL said:


> Not really. Stock distributions of returns are leptokurtic i.e. they have fat tails. This means Black Swans happen more often than you would think.
> 
> It is this that makes trend following systems work, and it is this that means you get crunched in a gap down more often than normal distribution suggests.
> 
> In this market traders are just used to the upside fat tail and have been relatively unexposed to the downside fat tail.
> 
> This will also eventually regress to the "mean" and traders will get more frequent unexpected and unwelcome price shocks at some point in the future.
> 
> Be prepared for that.



Lol.


----------



## GumbyLearner

I love candles especially in OTC derivative illiquid markets!


----------



## tech/a

chops_a_must said:


> The optimise function in AB works a treat.




Something I will have to look into as I dont have AB--Yet.




> How has that gone this year?




With T/T results have actually been as tested although a period like that of last year wasn't in the sample testing.What did and has happened is the system stopped itself out of all positions for the first time in 7 yrs.It hasn't triggered a buy for some months.Will however continue to run the system when new trades are triggered.A great learning experience.
I personally exited the system around 18 mths ago.Hindsight shows I am no worse off had I continued with my own trading with the system.

Yes it was a psychological reason I sold out and went cash.I personally didn't wish to put at risk the $$s I had in the system.(A personal choice).
I have however been using part of the funds in discretionary trading.(20% of them).


----------



## chops_a_must

Very interesting Tech.

I guess that's one of the problems, that testing periods may never be the same as those that they actually operate in, but good systems should not be completely killed either...

I'd say a lot of short systems that were once never profitable, are now also profitable on a tested basis.

Would like to see this thread given a re-birth, now that canny can get on here a little more regularly again.


----------



## tech/a

*Chops*

Having been involved in systems over the years and quite sometime since developing a new one I must say that a lot of my thinking has altered and been added to over the years.
A system if I was to develope it now would have different characteristics to those I developed in 2000-2004.
So to would my testing proceedure and I would add to my software with Amibroker.

Howard Bandy and the market have been a huge influence on my thinking---for the better I think.
Not that the others dont work just that perhaps they are the FJ version not the latest Model Grange!!


----------



## chops_a_must

But what happens now?

A lot of systems would never be profitable testing through this period... so do you just set a 'catastrophic movement' filter, to stop it doing anything?

Do you just ignore this period, dismiss it as an anomaly? Does the system have to be profitable during this period for you to think it valid in future? Or do you design systems knowing that it may not perform how it tests, and just accept that?


----------



## MRC & Co

Yeh, some interesting questions Chops.


----------



## tech/a

chops_a_must said:


> But what happens now?
> 
> A lot of systems would never be profitable testing through this period... so do you just set a 'catastrophic movement' filter, to stop it doing anything?
> 
> Do you just ignore this period, dismiss it as an anomaly? Does the system have to be profitable during this period for you to think it valid in future? Or do you design systems knowing that it may not perform how it tests, and just accept that?





*Chops*.

T/T and the other 3 I designed around that same period were and still are designed as long only methods.They are designed to perform well in trends.
To expect them to perform well in choppy or bearish markets is simply not realistic.Those that persevere at at best to become frustrated and at worst disillusioned---no need to be.
I believe that we know pretty well that the coming next 5 or so years are likely to be choppy. There will be times of bullish and bearishness.
If you wish to trade or design systems they should be based around these likely characteristics.
Shorter timeframe.
Both long and short.
More frequent trading.

You can and should search out other markets which may trend either long or short---better than stock. Perhaps currencies or other Futures or FX.

Just my view.


----------



## chops_a_must

That's the way I think it will be.

A lot of sideways movement, therefore we need to look at trading techniques that are supposedly good in these environments, sideways and reversion type systems you would imagine work well.

My suggestion, if anyone wants to test it, would be something like a weekly hi-lo system.

It also suits the wishes that were expressed in this thread, both long and short, with < 4 days trading time exposure.


----------



## MS+Tradesim

I've been working on a system (or set of related systems) to trade currencies and the SPI. It should be transferrable to other markets. At the moment, I'm patiently waiting on intra-day testing capabilities to be added to Tradesim so I can check it out thoroughly. Then I might have something to add....


----------



## CanOz

I'm re-starting this thread now that i have the time and the ASF access to do it full time. 

In my other thread i showed the results of a few systems that I've developed already using a Genetic Program called Adaptrade Builder. These systems did not meet my Objective Function, so i'll try again.

I will attempt to first develop a Price Pattern+Volume system to trade the DAX on a 15 minute time frame. Trying to keep things simple to start with.


-Starting Capital is 25,000 EUR
-Objective function is will be found by multiplying the Win% x Profit Factor x ratio of -W/L with- a goal of greater than *1.2*
-I will try to get this OF unoptimized, not sure if that is realistic at this stage.

I will be using a Genetic Algorithm (Adaptrade Builder) to develop the system.
-Metrics that I'm using are:
-Maximize Profit - which i have weighted at 5
-Pct Wins - weight 4 and a target of 55%
-PF - weight 4 and target 2
-Ratio W/L - weight 4 and a target of 2

For the *data*:
-Construction data is from Sept 01/2009 - May 30/2010
-First OOS period - Sept 01/2010 - May 30/2011
-Second OOS Period - Sept 01/2011 - 01 April 2012
-Reasoning behind the data selection is that generally September to May is the most active period with plenty of liquidity.

Standard procedure for *evaluation*:
1.) Construct according to metrics
2.) Test on OOS1 to see if Objective function is met or not
3.) If OF not met then we will start again at step 1
4.) If OF is met on OOS1 then we will optimize the MM Stops and Exits only, on OOS1 and test on OOS2 
5.) If OOS2 meets the OF then we start to trade on the IB Paper trader and post the results weekly. We will trade for 3 months unless we determine that further testing is needed.

I will post the results as i get through the first OOS period. 

Should be interesting.

Cheers,


CanOz


----------



## CanOz

Ok, after a couple of hours and three separate build runs where i added generations, and changed the weighting of the metrics so that the emphasis was on PF, W%, and W/L Ratio and less on profitability i finally got a system that meets my Objective Function. 

I have system code for a DAX system that over 8 months of historical data produced a profit after slippage and commissions of 9007.00 EUR. 

The PF = 1.833
The W% = 50.2
The W/L ration = 1.8329

Next step is to take the code over to MultiCharts and test it over the same period to ensure the results are the same.

CanOz


----------



## CanOz

CanOz said:


> Ok, after a couple of hours and three separate build runs where i added generations, and changed the weighting of the metrics so that the emphasis was on PF, W%, and W/L Ratio and less on profitability i finally got a system that meets my Objective Function.
> 
> I have system code for a DAX system that over 8 months of historical data produced a profit after slippage and commissions of 9007.00 EUR.
> 
> The PF = 1.833
> The W% = 50.2
> The W/L ration = 1.8329
> 
> Next step is to take the code over to MultiCharts and test it over the same period to ensure the results are the same.
> 
> CanOz




Back to the drawing board...it tests the same on MultiCharts, which was good. Unfortunately when i tested it on unseen data it took no trades at all. I suspect that it was not statistically relevant so I'll need to add that to my metrics. Also I'll allow it to use an ATR and an a Tri-Avg as well.

Well need to make that procedural change too, so we test it first on unseen data to ensure its taking trades on MC then go back and optimize on OOS2.

While we're building another one for the DAX, we'll run the code over the other markets, the HSI, the SPI and ES just in case we stumbled upon something by chance that works.

Cheers,


CanOz


----------



## tech/a

Can
I'm not familiar with the software your using.
Not familiar with sow o the terminology.

But I think your to middle road not at extremes.
By that I mean

(1) if your trading short-term you'll want 65 % and well upwards in win rate.
(2) you'll get trends with a less success rate of 30-40%

The 50% area is very difficult to design a system in--- well that's my experience anyway.


----------



## CanOz

tech/a said:


> Can
> I'm not familiar with the software your using.
> Not familiar with sow o the terminology.
> 
> But I think your to middle road not at extremes.
> By that I mean
> 
> (1) if your trading short-term you'll want 65 % and well upwards in win rate.
> (2) you'll get trends with a less success rate of 30-40%
> 
> The 50% area is very difficult to design a system in--- well that's my experience anyway.




Thanks Tech, the OOS is 'out of sample'.

The higher win rates are usually associated with a scalper, use a wide stop and short target etc.. 

The software I'm using uses an algorithm to design an algorithm. So I've got little control for the moment.

I'm also learning Easy Language so I'll be doing some research as i become more handy with that as well. It will be interesting to see if i can come up with a better system than the software. I've got dozens of ideas, only limit is my basic coding skill...it'll come I'm sure.

Thanks,


CanOz


----------



## sinner

CanOz said:


> The software I'm using uses an algorithm to design an algorithm. So I've got little control for the moment.
> CanOz




If you let the genetic algo run over unbounded time-series it will almost certainly find what you've shown, the 'optimal' solution which isn't very useful walk forward.

You can influence it by providing inputs. 

For example, in finding optimal daily mean reversion signals might be to provide ROC2 and Bollinger(120,1.5) of the ROC2 as inputs to the genetic algorithm. You need to come up with some (very simple and robust) inputs which will influence your algo to the sort of trading edges you think exist!

Do you catch what I'm saying? It's very important for intraday, since you need to avoid the exact issue you've found. You will probably find it's not as important if you 'trained' on daily data.

EDIT:
A very simple place to start is to provide
* Bollinger(N,1) on closing price
* Kelt(N,N,1)
* ROC(N*10) 
* Bollinger(N*10,1.5) on ROC(N*10)
* Bollinger(N*10,1) on volume
* Bollinger(N*10,2) on volume

Do you see why?


----------



## CanOz

sinner said:


> If you let the genetic algo run over unbounded time-series it will almost certainly find what you've shown, the 'optimal' solution which isn't very useful walk forward.
> 
> You can influence it by providing inputs.
> 
> For example, in finding optimal daily mean reversion signals might be to provide ROC2 and Bollinger(120,1.5) of the ROC2 as inputs to the genetic algorithm. You need to come up with some (very simple and robust) inputs which will influence your algo to the sort of trading edges you think exist!
> 
> Do you catch what I'm saying? It's very important for intraday, since you need to avoid the exact issue you've found. You will probably find it's not as important if you 'trained' on daily data.
> 
> EDIT:
> A very simple place to start is to provide
> * Bollinger(N,1) on closing price
> * Kelt(N,N,1)
> * ROC(N*10)
> * Bollinger(N*10,1.5) on ROC(N*10)
> * Bollinger(N*10,1) on volume
> * Bollinger(N*10,2) on volume
> 
> Do you see why?




No, i'm afraid its over my head Sinner....

The code looks like a Bollinger squeeze with the KC and the BB...

The algo can be influenced by the indicators i select and 'let' it use.

I'll try your recommendation and see what happens, but other than programming in EL the indicators based on your BB/KC/ROC i'm sure i cannot get the exact parameters.

Thanks Sinner,

In the meantime I've slapped some indicators on achart to see if i can figure out where you're going with this....


CanOz


----------



## sinner

CanOz said:


> No, i'm afraid its over my head Sinner....
> CanOz




Hmmm...it's not the squeeze or anything like that! 

Let me try and explain it a different way...

Right now you are feeding in pure price to the system, nothing else. 

e.g. tick price time-series
1.01
1.02
1.03
1.02
1.03
1.02
1.03
1.04
1.03
1.02

the optimal algo might just be "buy 1.02 sell 1.03" or "short 1.03 cover 1.02" but what if when the system goes live, it's trading in a price range between 2.00-2.10? "Buy 1.02" or "short 1.03" will never work even though it was "optimal".

but if you added a ROC to it, so that it optimally knew (because they are genetically advantageous) instead "buy on 0.1% dips sell on 0.1% rises"?

*this is just an example* to give you an idea of what I mean.

The above Bollinger, ROC are converting raw numbers into statistical numbers, specifically std. dev from a mean and % (log normalised) changes in price/volume...notice I said ROC and not Momentum (Momentum is raw). This was just an example I chose because it is *simple and robust*. Nothing magic about it, there is very high tech math stuff or even technical rules (N occurrences) you could input instead.

The genetics work out whether it's optimal to buy or sell in any given situation, but you have to parameterise the situation, e.g. is it 'genetically advantageous' to buy when the price/volume is exceeding some mean by some std devs or is it more advantageous to short or even be flat?


----------



## CanOz

sinner said:


> Hmmm...it's not the squeeze or anything like that!
> 
> Let me try and explain it a different way...
> 
> Right now you are feeding in pure price to the system, nothing else.
> 
> e.g. tick price time-series
> 1.01
> 1.02
> 1.03
> 1.02
> 1.03
> 1.02
> 1.03
> 1.04
> 1.03
> 1.02
> 
> the optimal algo might just be "buy 1.02 sell 1.03" or "short 1.03 cover 1.02" but what if when the system goes live, it's trading in a price range between 2.00-2.10? "Buy 1.02" or "short 1.03" will never work even though it was "optimal".
> 
> but if you added a ROC to it, so that it optimally knew (because they are genetically advantageous) instead "buy on 0.1% dips sell on 0.1% rises"?
> 
> *this is just an example* to give you an idea of what I mean.
> 
> The above Bollinger, ROC are converting raw numbers into statistical numbers, specifically std. dev from a mean and % (log normalised) changes in price/volume...notice I said ROC and not Momentum (Momentum is raw). This was just an example I chose because it is *simple and robust*. Nothing magic about it, there is very high tech math stuff or even technical rules (N occurrences) you could input instead.
> 
> The genetics work out whether it's optimal to buy or sell in any given situation, but you have to parameterise the situation, e.g. is it 'genetically advantageous' to buy when the price/volume is exceeding some mean by some std devs or is it more advantageous to short or even be flat?




You know, this could explain why i had 0 trades when i was just using price patterns and volume....

Heres some of my options....


----------



## sinner

CanOz said:


> You know, this could explain why i had 0 trades when i was just using price patterns and volume....
> 
> Heres some of my options....




You gotta be careful what you plug into it of course, many of the indicators you list suffer from the same 'un-normalised' problem which gives the optimality you encountered. 

It really really helps to think in terms of genetics in the case of genetic algorithms (surprise).

If the environment which the species exists in is highly specific, then selection/adaptation will be fast to stabilise but even a small incremental change to the environment can prove catastrophic.

On the other hand species which have traits which allow generalised access to a range of environments can continue to exist in the face of incremental changes.


----------



## CanOz

sinner said:


> You gotta be careful what you plug into it of course, many of the indicators you list suffer from the same 'un-normalised' problem which gives the optimality you encountered.
> 
> It really really helps to think in terms of genetics in the case of genetic algorithms (surprise).
> 
> If the environment which the species exists in is highly specific, then selection/adaptation will be fast to stabilise but even a small incremental change to the environment can prove catastrophic.
> 
> On the other hand species which have traits which allow generalised access to a range of environments can continue to exist in the face of incremental changes.




Well perhaps i should just work my way through the indicators using only a few at a time. I can also change the population size, the number of generations, Crossover and mutation, tree depth and tournament size.

CanOz


----------



## CanOz

Taking a break from developing a DAX system using the Builder today. There are several strategies that come with the builder and today i'm going to test them on MultiCharts, and if they're profitable and meet my OF then I'll trade them on IBs Paper Trader.

Zero strategies were found yesterday. It seems more difficult to find useful systems.

Getting a bit discouraged about using Builder. On a positive rote the EUR.USD stratgy seems quite profitable on the most recent data.

Its a daily system....recalling what Radge said about time frames....intra-day is very difficult.

CanOz


----------



## motorway

CanOz said:


> Taking a break from developing a DAX system using the Builder today. There are several strategies that come with the builder and today i'm going to test them on MultiCharts, and if they're profitable and meet my OF then I'll trade them on IBs Paper Trader.
> 
> 
> Its a daily system....recalling what Radge said about time frames....intra-day is very difficult.
> 
> CanOz




Consider that maybe;

The market reality is in fact built from the momentary meeting of a quantity of demand and supply. A buyer and seller meeting across the Bid Ask Spread.. *This does not occur  as a linear function of time*  so your use of time frames can only introduce noise and distortion. At the smallest time scales this might will become a larger component in proportion..

This paper might interest you.


http://www.newton.ac.uk/programmes/DQF/seminars/070714501.pdf


From that smallest market unit.. Either Supply or Demand is Momentarily Exhausted to a larger or smaller degree... From this building Block are all the trends ( degrees ) composed.

But the largest active trend ( and it's momentum ) is the container from where the arrow of casulality flows.

So the smallest unit is the building block
But the causation flows from the large to the small in terms of trends

There is no contradiction here

It is obviously so when you do away with the time frames and see everything occurring in the moment.

At the bid/ask spread is the only place where buyer can meet seller.
This is  a particular  moment ... The same moment  no matter what  those  particular buyer and seller individual time horizons may be.

Motorway


----------



## CanOz

thanks Motorway....love ya brother!

Here's a daily system for the ES. Nice win rate but it needs a MM stop, hehe, as you can see. It not going to hurt the system much either going by the excursions. I'd say about $5000 stop should do it. This is trading 5 contracts.

CanOz


----------



## CanOz

Here's a pattern that i found using a show me study. I was looking for another pattern at the time. Two of these instances where profitable on the 15 min DAX recently. Once i have it coded up I'll test it over a few years of data and eyeball the chart to see if its worth pursuing.

This is my practice for learning Easy Language.....nothing to do with code is easy for me!

CanOz


----------



## CanOz

I finally have my DAX system coded and i've been testing most of the day. It doesn't take allot of trades on the DAX, about 30 per year, but on the HSI and SPI it trades almost every day. Here are three markets and the results. In order, DAX, HSI, SPI. This is a very simple system with a money management stop, and the exit is end of session.

For being quite raw at the moment, it seems quite robust.

CanOz


----------



## CanOz

Here are the equity curves, same order DAX, HSI and SPI. 3, 5, and 2 years of data.

CanOz


----------



## Joules MM1

thumbs up......kudos to you for the work thus far, can


----------



## CanOz

Joules MM1 said:


> thumbs up......kudos to you for the work thus far, can




Thanks! They're a bit raw right now, so the curves are a little rough, but trade-able IMHO.

CanOz


----------



## Lone Wolf

You said the DAX system trades just 30 times a year. A question I've been asking myself is how many trades per year do you need in order to have confidence that the system is robust? It seems to me that if the trade frequency is too low then it makes any back tested stats less reliable. Any thoughts on this?

I see your equity curve for the HSI has a couple of big dips in there. For example the $125,000 drop from $175,000 down to $50,000. Would you be able to keep trading the system through that kind of drawdown? Also, what would've happened if you had been unlucky enough to start trading at the time where the drawdown first started? Would the account have been blown or would the position size have been smaller and therefore less drawdown?

To me it makes a big difference when you encounter drawdown. I could easily sit through a 30% drawdown after making large gains. But if I were to go into max drawdown right off the bat then I may start to panic that the system is broken and not have the nerve to keep trading the system. So when I consider my drawdown tolerance I need to consider that it could happen right at the start.


----------



## CanOz

All of our points are valid LW. These systems are raw and as such they only have basic money management. With the application of more complex stops and targets the stats will change, but hopefully improve a little. Its all up to the person trading it whether or not they can take the draw-down or not. 

One thing is for sure though, these returns cannot be realized unless you stick with the system, good with the bad. Same as buy and hold yeah? Except the draw-downs should be much much less.

That's why many agree its better to build your own system than to trust someone else's. 

If you cannot understand how the system makes money then forget about trading it, you'll never make it through the first DD.

Also, many traders use an equity/system curve switch. The system shuts off and turns on based on the equity curve.

CanOz


----------



## Lone Wolf

I fully agree with the concept of understanding why your system works and sticking to it. That's why I find it important to have enough trades to support the results and to ensure the drawdown is something I can tolerate. I first started with a financial adviser in a buy and hold with leverage strategy. Max system drawdown is something I pay great attention to these days.  

I've never tried the equity curve switch, my luck I'd always turn it off right before a recovery. But I do use a system filter to keep it out of undesirable conditions, so I guess the concept is the same.


----------



## CanOz

Lone Wolf said:


> I've never tried the equity curve switch, my luck I'd always turn it off right before a recovery. But I do use a system filter to keep it out of undesirable conditions, so I guess the concept is the same.




A filter, such as an index filter, is there to take you to cash when the broader market turns out of trend. An equity curve switch shuts your system off before it can go underwater too far. There are many examples, one such is the MSA from Adaptrade.

Joe Krutsinger uses one on most of his highly acclaimed trading systems. As does David Bean from Capstone trading systems on his NY Scalper.

Here is a very basic one, a 100 period MA of the equity. You can see how it would be useful. The thing is, some equity curves are mean reverting and some are more trendy.

Cheers,


CanOz


----------



## Lone Wolf

Thanks for that CanOz. 

I've been playing with some amibroker code for an equity switch this afternoon and it may be useful. But I'd rather design a system with an equity curve that doesn't need an off switch.:


----------



## CanOz

Lone Wolf said:


> Thanks for that CanOz.
> 
> I've been playing with some amibroker code for an equity switch this afternoon and it may be useful. But I'd rather design a system with an equity curve that doesn't need an off switch.:




Yeah me too, but they might be handy anyway! Sort of like a condom i.e. - better to have one and not need it, than need one and not have it.

CanOz


----------



## tech/a

CanOz said:


> Yeah me too, but they might be handy anyway! Sort of like a condom i.e. - better to have one and not need it, than need one and not have it.
> 
> CanOz




Have a look at turning your system on and off using YOUR systems equity curve.


----------



## sinner

I use this technique. It used to be difficult to play along, now there is an ETF for almost everything, it is quite easy.

http://www.cxoadvisory.com/43/big-ideas/beat-the-market-with-hot-anomaly-switching/
http://www.cxoadvisory.com/54/big-ideas/diversifying-across-equity-anomalies/

*All* my systems have a switch, sometimes implicit, sometimes explicit which stops the system trading if the market regime is not appropriate for that sort of trading.


----------



## tech/a

sinner said:


> I use this technique. It used to be difficult to play along, now there is an ETF for almost everything, it is quite easy.
> 
> http://www.cxoadvisory.com/43/big-ideas/beat-the-market-with-hot-anomaly-switching/
> http://www.cxoadvisory.com/54/big-ideas/diversifying-across-equity-anomalies/
> 
> *All* my systems have a switch, sometimes implicit, sometimes explicit which stops the system trading if the market regime is not appropriate for that sort of trading.




So you follow anomolies in EFTs and use them as your filter?
Can you elaborate more on this.?


----------



## sinner

tech/a said:


> So you follow anomolies in EFTs and use them as your filter?
> Can you elaborate more on this.?




tech, I am really not even sure what you mean? What you wrote sounds like gibberish.

The links are an example of tracking momentum for a set of trading strategies and trading the ones with high momentum while ignoring those with low momentum. The ETFs track the anomaly, I am not looking for new anomalies in them. Seems you are having trouble with the lingo, so I will make it clear: an anomaly is just a market phenomenon that is not explained by efficient market hypothesis. For example, some well known anomalies are momentum, value and liquidity.

Tracking the momentum of a set of ETFs which tracks a set of anomalies is exactly the same as "turning your system on and off using YOUR systems equity curve" except across multiple systems.

Instead of turning off the system and going to cash, I turn off one system and turn on another one which the new market regime is suited for. I don't choose, I just follow the momentum of the set of systems.


----------



## tech/a

> Tracking the momentum of a set of ETFs which tracks a set of anomalies is exactly the same as "turning your system on and off using YOUR systems equity curve" except across multiple systems



.

This is what I thought.

Can you give me an example of the ETF's you are traking.
I dont trade ETFs but am interested in this approach to test.
How do you know which ETF is tracking which anomaly?
Which you use as your switch/s and when to apply it/them.

A working example would be excellent.
Thanks.


----------



## sinner

tech/a said:


> .
> 
> This is what I thought.
> 
> Can you give me an example of the ETF's you are traking.




A simple example would be the growth and value ETFs for the Russell 2000. I don't track those two specifically, but they are a good example of anomaly tracking funds.



> I dont trade ETFs but am interested in this approach to test.
> How do you know which ETF is tracking which anomaly?




Because the ETFs have been created specifically to track that anomaly. Obviously not all anomalies (like very short term mean reversion) have an ETF, you need to track the equity curve for those yourself.



> Which you use as your switch/s and when to apply it/them.
> 
> A working example would be excellent.
> Thanks.




As per above (this is a very simple example):

Track the 6 month log returns for IWM, IWN and IWO, each month invest 100% of equity in the highest performing of the three.


----------



## tech/a

OK
Clear me up on this.
Your tracking these and you place 100% equity in the best performing each month.

If so then your trading the EFT??

If not how do you relate the chart to your own group of stocks in your portfolio??

How do you implement it/them as a filter?


----------



## CanOz

tech/a said:


> Have a look at turning your system on and off using YOUR systems equity curve.




That's what i was talking about in the post above.

CanOz


----------



## CanOz

tech/a said:


> OK
> Clear me up on this.
> Your tracking these and you place 100% equity in the best performing each month.
> 
> If so then your trading the EFT??
> 
> If not how do you relate the chart to your own group of stocks in your portfolio??
> 
> How do you implement it/them as a filter?



Yeah, seems like more of a filter than a switch...semantics i guess.

Interesting stuff Sinner. Like to see a visual though.


CanOz


----------



## sinner

tech/a said:


> OK
> Clear me up on this.
> Your tracking these and you place 100% equity in the best performing each month.
> 
> If so then your trading the EFT??




If there is an ETF which tracks the anomaly I'm interested in, then I will of course rotate into the ETF, if not then of course I will trade the stocks which make up the equity curve.



> How do you implement it/them as a filter?




I'm really not sure you understand the concept tech. 

The idea in the above example is that by trading the top N anomalies, you are also not trading the remaining anomalies, i.e. they are filtered out of your overall equity curve.

So at the end of a given month, if 'growth' is outperforming 'value' and 'the benchmark' on a 6 month basis, then by investing 100% in growth I am filtering out the value and market cap anomalies from my equity curve.


----------



## Gringotts Bank

tech, it's like rotational trading.  A rotational trading system won't switch off altogether, but built into its mechanism is a constant switching from weaker to stronger instruments.


----------



## sinner

CanOz said:


> Yeah, seems like more of a filter than a switch...semantics i guess.
> 
> Interesting stuff Sinner. Like to see a visual though.
> 
> 
> CanOz




Ok, you get the visual once, but stating in advance I feel it's only because you are too lazy to visualise it yourself! This is not a hard concept to understand, especially considering the links I provided.

*To clarify again, this is only an example!!!*

Let's say I have a portfolio for allocating to anomalies,  I divide the capital equally into the number of anomalies I wish to track. In this case, let's say I am interested in the anomalies:

* Equity: momentum
* Equity: value
* Equity: dividend yield
* Equity: large vs small

So each gets a 25% allocation of total portfolio size. Now I define a statistical rule which stops me from trading a particular anomaly and move that quarter of the account to cash or short term guaranteed notes (or invest in the benchmark itself).

Let's say I am using:
* 65 day mean (avg) of returns
* 1 std dev of returns
* 2 std dev of returns

I will invest 25% of total portfolio into an anomaly if the returns of that anomaly exceed the 65 day mean of returns by 1std dev of returns, and exit the position if the returns of that anomaly decrease below the 65 day mean of returns by 2 std dev of returns.










Now in this example, I used a slightly more complex method than trading the anomaly with highest 6 month ROC but functionally the results are very similar, the idea is to show you can use most momentum tracking methods without problem. 

Hope it is starting to make sense...like I said, all my systems have such an (implicit or explicit) on/off switch which get them in/out based on the momentum of their returns, a metric that usually changes when the market regime is changing. 

EDIT: err that last arrow on the right in the IWN chart should be green...


----------



## CanOz

Sinner, thanks for providing the example. I see what your saying. I think I've seem something similar using the VIX once.

Cheers,


CanOz


----------



## CanOz

Well we've added an ATR stop to the DAX system. While its made an improvement to the equity curve and to my OF on the DAX, the results for the HSI and the SPI have not been as spectacular. Still trying to find a decent combination on the SPI.

Cheers,


CanOz


----------



## CanOz

Here is the SPI, with the ATR.

CanOz


----------



## Trembling Hand

CanOz said:


> Still trying to find a decent combination on the SPI.



Why? 

Might as well try and find a decent way to make make money as a blacksmith?

:


----------



## tech/a

Trembling Hand said:


> Why?
> 
> Might as well try and find a decent way to make make money as a blacksmith?
> 
> :




Howard Hughes' Catalina.
Just couldnt get it to fly.


----------



## CanOz

Trembling Hand said:


> Why?
> 
> Might as well try and find a decent way to make make money as a blacksmith?
> 
> :




Really what i meant here is that i was trying to find the last variable that i used on the raw version. I didn't save my test reports on the raw version as i had the ATR stop coming along....i know, that's not good. 

Not stuck on trading the SPI, but it does help my confidence if my system work ok on it.

Going to try it on Soy Beans, Corn and Wheat today, if i can get enough data.

CanOz


----------



## CanOz

I wish they were all like this one!


----------



## Trembling Hand

CanOz said:


> I wish they were all like this one!




How funny is that. I just trash it for its lack of movement and it pulls one right outa the bag.


----------



## CanOz

TH, you ever trade the Eurodollar interest rate futures? There is a mini contract on Globex(EEDK2). It is supposed to be the most liquid fut in the world.

Just wondering if you had traded it before, and if i had the right instrument?

CanOz


----------



## Trembling Hand

CanOz said:


> TH, you ever trade the Eurodollar interest rate futures? There is a mini contract on Globex(EEDK2). It is supposed to be the most liquid fut in the world.
> 
> Just wondering if you had traded it before, and if i had the right instrument?
> 
> CanOz




Think you mean GE,
http://www.cmegroup.com/trading/interest-rates/files/IR148_Eurodollar_Futures_Fact_Card.pdf

And nope never touched it. HSI for me.


----------



## CanOz

This just keeps getting more interesting all the time, here is the DAX system on AAPL intra-day.

100 share lot. It's not pretty but it works.

CanOz


----------



## captain black

CanOz said:


> I wish they were all like this one!




Is that an open range breakout system on the SPI CanOZ?

No need to disclose full system, just looks like an ORB to me.


----------



## CanOz

captain black said:


> Is that an open range breakout system on the SPI CanOZ?
> 
> No need to disclose full system, just looks like an ORB to me.




Well done Captain.  

CanOz


----------



## captain black

Have you tried testing an ORB on the Kospi?

I swing trade the Kospi, usually 10-15 trades/day but often let one or 2 contracts run from the open if it moves strongly. Perhaps I should just test it myself  Just curious to know if you've had a look at the Kospi yet?


----------



## CanOz

captain black said:


> Have you tried testing an ORB on the Kospi?
> 
> I swing trade the Kospi, usually 10-15 trades/day but often let one or 2 contracts run from the open if it moves strongly. Perhaps I should just test it myself  Just curious to know if you've had a look at the Kospi yet?




I'm getting around to testing it as well, but I've only got a little data for it as its IB data. I thought of getting some tick data for it but it looked too counter trend to me, I'll test it and see what its like. Being a TF system you can certainly find out which markets are trendy and which are CT.

CanOz


----------



## waza1960

> Being a TF system you can certainly find out which markets are trendy and which are CT.




 CanOz refresh my memory on your time frames for these systems.
 I basically only design mean reversion systems for time frames under 1 hour and  consider TF Systems in the Longer Time Frames


----------



## CanOz

Its got potential, but i need more data.

This is based on the first 10 minute range.

Cheers,

CanOz


----------



## Trembling Hand

CanOz said:


> Its got potential, but i need more data.




What are you using? Tick or 1 min? I got both thats timestamped to Oz hours back to 2007-8ish. Its in NT format,

20120305 051500;264.55;264.6;264.45;264.55;473
20120305 051600;264.55;264.6;264.5;264.55;333
20120305 051700;264.55;264.55;264.5;264.55;181
20120305 051800;264.55;264.6;264.5;264.6;435
20120305 051900;264.55;264.6;264.5;264.55;451
20120305 052000;264.55;264.65;264.55;264.55;839
20120305 052100;264.55;264.65;264.5;264.65;357
20120305 052200;264.6;264.6;264.5;264.5;436
20120305 052300;264.55;264.6;264.5;264.6;620
20120305 052400;264.6;264.65;264.55;264.6;362
20120305 052500;264.6;264.6;264.55;264.55;105
20120305 052600;264.55;264.6;264.55;264.6;284
20120305 052700;264.6;264.6;264.55;264.6;173
20120305 052800;264.55;264.65;264.55;264.6;304
20120305 052900;264.6;264.6;264.5;264.55;583
20120305 053000;264.55;264.6;264.55;264.6;260
20120305 053100;264.6;264.65;264.55;264.6;485

Can email it to you if you want.


----------



## CanOz

waza1960 said:


> CanOz refresh my memory on your time frames for these systems.
> I basically only design mean reversion systems for time frames under 1 hour and  consider TF Systems in the Longer Time Frames




I'm using a 1 minute chart to test because it enters next bar at market, but you could use anything up to 15 minute i suppose. One would wonder why you would use anything more than that unless you planned to hold overnight (that's something we can try too).

From what I've learned with it, most markets make their move in the first 15-30 minutes, if they move much.

I think it would perform better with a more clever trailing stop....perhaps you guys may have a more experience view on that than I.

The Kospi seems to trend and then reverse part way through the session, maybe when another market opens, the HSI maybe? Perhaps it would benefit from a time stop?

CanOz


----------



## CanOz

Trembling Hand said:


> What are you using? Tick or 1 min? I got both thats timestamped to Oz hours back to 2007-8ish. Its in NT format,
> 
> 20120305 051500;264.55;264.6;264.45;264.55;473
> 20120305 051600;264.55;264.6;264.5;264.55;333
> 20120305 051700;264.55;264.55;264.5;264.55;181
> 20120305 051800;264.55;264.6;264.5;264.6;435
> 20120305 051900;264.55;264.6;264.5;264.55;451
> 20120305 052000;264.55;264.65;264.55;264.55;839
> 20120305 052100;264.55;264.65;264.5;264.65;357
> 20120305 052200;264.6;264.6;264.5;264.5;436
> 20120305 052300;264.55;264.6;264.5;264.6;620
> 20120305 052400;264.6;264.65;264.55;264.6;362
> 20120305 052500;264.6;264.6;264.55;264.55;105
> 20120305 052600;264.55;264.6;264.55;264.6;284
> 20120305 052700;264.6;264.6;264.55;264.6;173
> 20120305 052800;264.55;264.65;264.55;264.6;304
> 20120305 052900;264.6;264.6;264.5;264.55;583
> 20120305 053000;264.55;264.6;264.55;264.6;260
> 20120305 053100;264.6;264.65;264.55;264.6;485
> 
> Can email it to you if you want.




Thanks TH...

1 minute would do.

Perhaps 6 months for a start, then if its promising whatever you got.

Can i map that with an ASCII mapper? *Waza*, you ever convert your NT data for your MultiCharts using the ASCII mapper?

CanOz


----------



## waza1960

No not as yet ,as I understand it much easier to get data into Multicharts than the other platforms


----------



## odds-on

sinner said:


> I use this technique. It used to be difficult to play along, now there is an ETF for almost everything, it is quite easy.
> 
> http://www.cxoadvisory.com/43/big-ideas/beat-the-market-with-hot-anomaly-switching/
> http://www.cxoadvisory.com/54/big-ideas/diversifying-across-equity-anomalies/
> 
> *All* my systems have a switch, sometimes implicit, sometimes explicit which stops the system trading if the market regime is not appropriate for that sort of trading.




Sinner,  

Is there an inverse ETF available for the S&P500? I have searched but am unable to find one. I would like to create simple rebalance strategy using an inverse ETF and an ASX stock. Index falls buy more of the ASX stock. Stock rises buy more of the index. Keep it 50/50 and just rebalance it every month. Is this possible? Or do i have to use CFD type instrument to short the S&P500?

5 minutes of your time would be most appreciated.

Cheers

Oddson


----------



## CanOz

odds-on said:


> Sinner,
> 
> Is there an inverse ETF available for the S&P500? I have searched but am unable to find one.
> 
> Cheers
> 
> Oddson




SPXU - Proshares UltraPro Short S&P500


----------



## CanOz

I think bonds (ZN) deserve a better look with more data.

CanOz


----------



## odds-on

CanOz said:


> SPXU - Proshares UltraPro Short S&P500




Thanks, but i am unable to buy through my online broker here in NZ. Change broker


----------



## sinner

odds-on said:


> Sinner,
> 
> Is there an inverse ETF available for the S&P500? I have searched but am unable to find one. I would like to create simple rebalance strategy using an inverse ETF and an ASX stock. Index falls buy more of the ASX stock. Stock rises buy more of the index. Keep it 50/50 and just rebalance it every month. Is this possible? Or do i have to use CFD type instrument to short the S&P500?
> 
> 5 minutes of your time would be most appreciated.
> 
> Cheers
> 
> Oddson




There are heaps, very surprised you didn't find any considering how many there are. They are all listed on the NYSE or other US exchanges. SH is the 'correct' unleveraged instrument, the one canoz listed is leveraged. 

It really depends on your timeframe, if it's less than 2-3 months you should really just use a futures contract imho.

Don't forget currency differences.


----------



## CanOz

Well, although my system does ok on the SPI, it was mainly using the gaps from overnight trading and i think the typical SPI system performs better. 

It failed to produce a profit over 3 years of 10 year T-note data. While i am optimizing the trailing stop on the DAX at the moment i don't really have any hope that it will be a viable system. 

So looks like its back to the drawing board again...the search for an intra-day index system continues.

I think it would be easier to just buy a system.

CanOz


----------



## sinner

CanOz said:


> Well, although my system does ok on the SPI, it was mainly using the gaps from overnight trading and i think the typical SPI system performs better.
> 
> It failed to produce a profit over 3 years of 10 year T-note data. While i am optimizing the trailing stop on the DAX at the moment i don't really have any hope that it will be a viable system.
> 
> So looks like its back to the drawing board again...the search for an intra-day index system continues.
> 
> I think it would be easier to just buy a system.
> 
> CanOz




Not all markets are the same, multiplied by a million on the intraday scale. e.g. what I try and do in forex performs pretty badly in the local market equity index. In fact I don't even treat pairs the same, AUDUSD or EURJPY trading in Tokyo is different to EURUSD on the London Open GBPUSD on the LO as well! Liquidity, interest, fixing times, etc...Why expect the same results from t-notes as SPI?


----------



## CanOz

sinner said:


> Not all markets are the same, multiplied by a million on the intraday scale. e.g. what I try and do in forex performs pretty badly in the local market equity index. In fact I don't even treat pairs the same, AUDUSD or EURJPY trading in Tokyo is different to EURUSD on the London Open GBPUSD on the LO as well! Liquidity, interest, fixing times, etc...Why expect the same results from t-notes as SPI?




More expecting a profitable result on the T-notes, not needed to be similar. To me if its robust it should be able to be traded on many different markets. 

I see you point too about the times but this system enters at about the same time each session.

CanOz


----------



## sinner

CanOz said:


> More expecting a profitable result on the T-notes, not needed to be similar. To me if its robust it should be able to be traded on many different markets.
> 
> I see you point too about the times but this system enters at about the same time each session.
> 
> CanOz




Man if its a runner you're gonna get hit trying to fade it every day and if it likes to move up a tick before giving it back then you got some guts hanging around waiting for it to run. Make hay whe*re* the sun is shining.

Courtesy bloomberg here is 3 years of MOVE index, does your t-notes equity graph look like this?


----------



## CanOz

sinner said:


> Man if its a runner you're gonna get hit trying to fade it every day and if it likes to move up a tick before giving it back then you got some guts hanging around waiting for it to run. Make hay whe*re* the sun is shining.
> 
> Courtesy bloomberg here is 3 years of MOVE index, does your t-notes equity graph look like this?




Yes, very similar, except it came back recently, almost even again. Basically the curve was underwater the whole time.

CanOz


----------



## sinner

CanOz said:


> Yes, very similar, except it came back recently, almost even again. Basically the curve was underwater the whole time.
> 
> CanOz




Q.E.D

You are trying to long intraday volatility in a market where the Fed is selling puts all day long. 

Tried it on GBPUSD or the HSI?


----------



## CanOz

I see, its like the vix for bonds....volatility has dropped so much, so thats why system did well recently and not in the past. The market has changed.

Thanks Sinner.


CanOz


----------



## sinner

CanOz said:


> I see, its like the vix for bonds....volatility has dropped so much, so thats why system did well recently and not in the past. The market has changed.
> Thanks Sinner.
> CanOz




Your system is probably robust where a specific type of volatility is present. No point trying to trade it in a market where that volatility isn't present. You can write filters for that kind of thing


----------



## CanOz

Yeah, i was trading a system for a while that used the vix as a filter, more looking for selling climaxes for counter trend plays. I was thinking of plotting the vix alongside my indices and looking for a level of volatility that may increase the success rate. Makes sense.

Actually the DAX has been the most successful because it uses a volatility filter that only works on the DAX. I've got more data for the DAX now so I'll give that a go shortly.

Thanks for the inspiration Sinner...!

CanOz


----------



## CanOz

This is the Hang Seng with an optimized ATR trail and trade carry over to the next session....yeah i know but i does some sweet things to the PF.

CanOz


----------



## sinner

CanOz said:


> This is the Hang Seng with an optimized ATR trail and trade carry over to the next session....yeah i know but i does some sweet things to the PF.
> 
> CanOz




I reckon if you check you'll find on the good days you don't need the stop and on the bad days any sane stop will do. Looking at your scatter I'd say -20,000

If you're gonna optimise, why not see what the best opening range width (or duration, or combination) is? Or how many days you can hold for i.e. 1,2,3 day returns...


----------



## CanOz

The DAX is untradeable. In desperate need another filter of some sort.c:

CanOz


----------



## CanOz

I discovered today, that i don't need a volatility filter. I can achieve the same thing by re-optimizing a system every quarter or when needed based on the present state of the market according to a measure of the volatility of the market, or the systems equity curve.

This, i discovered by trialing a reasonably well know system that does exactly that. I believe this system (locked code for the trial period) does a similar thing as my system to get into the market, but it has a much better system of stops, my ATR Trail is notoriously poor, as i just found out. 

Check out this EC of the trial system on the HSI. This is with 4 points of slippage each way and commissions.  

Now the dilemma, do i just lease/purchase the open code for this system, or put more money and time into coding my own system at a similar cost?

This is hard to beat...it works on the DAX, the HSI and the SPI at 1, 5 and 60 minute time frames.


CanOz


----------



## Trembling Hand

CanOz said:


> The DAX is untradeable. In desperate need another filter of some sort.c:




LOL.. Come on man its sweet!!


----------



## CanOz

This is sweet...


----------



## waza1960

Yes Canoz must be tempting to buy the system and trade it , if you bought the open code at least it is a learning excerise as well but depends how much it is I guess


----------



## CanOz

waza1960 said:


> Yes Canoz must be tempting to buy the system and trade it , if you bought the open code at least it is a learning excerise as well but depends how much it is I guess




That HSI is the real attraction...a win rate of 75%.

The DAX is 47%, still doable.

Lots of work to do yet though Waza.

CanOz


----------



## CanOz

Check out this system that trades 5 contracts on the HSI. It scalps for quick profits and only trades for the opening 45 minutes. It back tests over as much OOS data as i can throw at it with the same results.

Can anyone tell me the problem with it? OR at least what i suspect the problem is...

CanOz


----------



## howardbandy

CanOz said:


> Check out this system that trades 5 contracts on the HSI. It scalps for quick profits and only trades for the opening 45 minutes. It back tests over as much OOS data as i can throw at it with the same results.
> 
> Can anyone tell me the problem with it? OR at least what i suspect the problem is...
> 
> CanOz




Hi CanOz --

The results look too good.  Suspect either some untradable condition or a future leak.

What is the system you are considering leasing?  Name?  Publisher?  URL?

Howard


----------



## CanOz

howardbandy said:


> Suspect either some untradable condition




Close.....i might have to give another hint....it has to do with 'inside' the bar.

CanOz


----------



## Joules MM1

*Re: Developing a mechanical system from scratch - Van Tharp*

http://www.traderplanet.com/newsletter_articles/view/8068/distribution:8/

in mistakes.

So let’s look at the psychology of trading from the angle of mistakes. When you don’t follow your rules, you make a mistake. It’s that simple. And making the same mistake repeatedly is called self-sabotage. Self sabotage is another area of psychology rich with the opportunity for understanding yourself to improve your trading results. Here, however, we’ll focus on mistakes relating to some broad categories of traders.

First, let me introduce one way to measure mistakes' impact on your trading. Trader efficiency is a measure of how effective a trader is in making mistake free trades. So a person who makes five mistakes in 100 trades is 95% efficient. In the last five years I’ve requested that my Super Traders document their mistakes so that we can look at their efficiency levels. I have found that 95% is actually a very good trading efficiency level; many traders can’t even trade at 75% efficiency””which is terrible. That’s one mistake in about every four trades. This is most important for one category of traders: rule-based discretionary traders. In my opinion, when rule based discretionary traders become efficient, they are by far the best type of trader.

There are two other groups of traders I’d like to talk about: 1) mechanical traders and 2) no-rule discretionary traders.

First, we’ll look at mechanical traders. Mechanical traders believe that they can eliminate psychologically related trading problems by becoming mechanical. Many people aspire to be mechanical traders, letting a computer make all the decisions for them, because they believe it factors out many human-based errors.

In fact, one of my best trader friends said to me once that psychology didn’t enter into his trading because his operation was totally automated. My response was “You could decide not to take a trade.” About 18 years after I made that statement, his CTA business closed down. His partner decided against taking one trade””the trade that would have made their entire year had they taken it.

I’ve always said that people can only trade their beliefs about the market, so let’s look at some of the most important beliefs that a pure mechanical trader might have:

With mechanical trading, I can be objective and not make mistakes (except the psychological mistake of overriding my system).

Mechanical trading is objective. My system testing will allow me to determine my future results.

Mechanical trading is accurate.

If a system’s underlying logic cannot be turned into a mechanical trading system, it probably isn’t worth trading.

Human judgment is too prone to errors. I can eliminate those through mechanical trading.

So then, is mechanical trading truly objective? I tend to think not because there are all sorts of errors that can creep into an automated trading system: data errors, errors in the software platform, errors in your own programming, and many more. (Interestingly, one of the main categories of errors that my Super Traders come up with consistently is programming errors.)

Let’s consider data errors. Is your data accurate or does it have bad ticks and other issues with it? Mechanical traders are always dealing with data errors of some sort. For example, price errors can show up in streaming data quite regularly. Sometimes those are resolved within seconds and the error “disappears” but, by that point, the bad data may have triggered a trade already. Additionally, historical stock data may or may not have dividend and split adjustments. And what happens when a company goes bankrupt? What if it goes private or is bought out by another company? Those companies’ data may simply disappear from your data set.

I once wanted to research an efficient stock trading system. We looked for efficient stocks (moving up without much noise) and bought them with a 25% trailing stop. We had an S&P 500 data set going back 40 years that was supposed to be clean and adjusted for splits and dividends. I was very pleased with the results because my system made a small fortune. I didn’t realize this at the time, however, but the system traded on “inside information.” Because of the data set, I was able to buy stocks at the IPO that would later become part of the S&P 500. Thus, my system, in back test, bought Microsoft, EBay, Intel, and many other companies before anyone knew they would become part of the S&P 500. Why? Because, as I said, my data set was today’s S&P 500 going back 40 years.

And what about Thursday May 6th, 2010? The Dow Jones dropped 1,000 points in the space of about 20 minutes. Blue chip stocks like Procter & Gamble dropped over 20 points, and Accenture even went to a penny per share briefly. While there may not have been one root cause for that mini-crash, it had a major effect on mechanical trading systems. Things like that happen in the markets; such are the challenges (error/mistakes) for mechanical systems. (That afternoon’s swing affected lots of regular traders, too. One client said he used 25% trailing stops on all of his positions and got stopped out of every single stock.)

Meanwhile, one of our instructors, Ken Long, trades rule-based discretionary systems and made 100R in that same week. As always, he was very conservative in his trading and very careful to make sure that he fully managed his risk.

There is another class of error that is made by mechanical trading systems: the error of omission. Because the criteria by which trade setups and entries are so precisely defined, mechanical systems miss many good (or great) trades that a discretionary trader would spot easily.

For example, suppose your systems screens for five consecutive lower closes. After you get five consecutive lower closes you then look for an inside day. Now you have your full setup. Your entry is a few cents above yesterday’s high.

So let’s look at some examples of other entry signals you might miss by being so precise. You could have four down days that were extreme””perhaps the price is down 30%. Or you could have less than four down days that where the price is 30% lower or more. However, neither of those example would be an adequate down move according to your strict mechanical criteria.

Let’s say you found something that had five days of new lower lows but the fifth down day might open on a new low and then close on a new high. That’s usually an extremely bullish signal, but you’d miss it by your precise definition. Or, you could have five days of lower closes and the sixth day opens on a new low but closes on a new high. Thus, the precise entry definition would miss a trade opportunity with even more weakness followed by an extreme bullish signal.

There are a lot more variations of this entry that a mechanical system would miss, but you get the point. As soon as you state your rules so precisely that a computer can execute the trades, you open yourself to errors of omission””good or outstanding trades that your automated system cannot take because of its precision. Those missed opportunities don’t qualify as mistakes but they severely limit the potential results of the underlying logic behind the system. The mechanical system results will look rather weak next to the results of a trader who used that same system and was allowed some discretion to take the all of those other trades that didn’t quite fit the precise mechanical system rules.

Next week we’ll look at mistakes and another type of trader: the no-rule discretionary traders.

-------------------------------------------------------------------------------------

Dr. Van K. Tharp is the founder and president of the Van Tharp Institute and stands out as an international leader among professional trading coaches and consultants. Helping others become the best trader or investor that they can be has been Tharp’s mission since 1982.

Tharp collected more than 5,000 successful trading profiles in a 10-year study of individual traders and investors


----------



## Trembling Hand

*Re: Developing a mechanical system from scratch - Van Tharp*



Joules MM1 said:


> First, let me introduce one way to measure mistakes' impact on your trading. Trader efficiency is a measure of how effective a trader is in making mistake free trades.* So a person who makes five mistakes in 100 trades is 95% efficient*. In the last five years I’ve requested that my Super Traders document their mistakes so that we can look at their efficiency levels. I have found that 95% is actually a very good trading efficiency level; many traders can’t even trade at 75% efficiency””which is terrible. That’s one mistake in about every four trades.




He's taking the p!ss.... surely??!!

:freak3:


----------



## tech/a

*Re: Developing a mechanical system from scratch - Van Tharp*



Trembling Hand said:


> He's taking the p!ss.... surely??!!
> 
> :freak3:




This is Rhetoric pumped out of their media department in volumes on a daily basis.
Designed to have Joe Average feel that he needs to be one of these " Super Traders "
So they better sign up NOW.---before Super Trader status runs out!

I get these pages en mass from Traders Help desk/Elliott/Van Tharp/Tradeguider/Daily.

Just full of Wha Wha.
*Truth is* they are finding the markets exactly as we are ---tough!

Just read the complete artical.
No time at the moment but remind me if I forget to answer it!


----------



## Punta

Yeah this guy seems to spout a lot of hot air.  Based on a recommendation on this site, I picked up his book the other day (my first book on trading), but only managed a page or two before the dross was overwhelming ...


----------



## tech/a

*Re: Developing a mechanical system from scratch - Van Tharp*



Joules MM1 said:


> http://www.traderplanet.com/newsletter_articles/view/8068/distribution:8/
> 
> in mistakes.
> 
> So let’s look at the psychology of trading from the angle of mistakes. When you don’t follow your rules, you make a mistake. It’s that simple. And making the same mistake repeatedly is called self-sabotage. Self sabotage is another area of psychology rich with the opportunity for understanding yourself to improve your trading results. Here, however, we’ll focus on mistakes relating to some broad categories of traders.
> 
> First, let me introduce one way to measure mistakes' impact on your trading. Trader efficiency is a measure of how effective a trader is in making mistake free trades. So a person who makes five mistakes in 100 trades is 95% efficient. In the last five years I’ve requested that my Super Traders document their mistakes so that we can look at their efficiency levels. I have found that 95% is actually a very good trading efficiency level; many traders can’t even trade at 75% efficiency””which is terrible. That’s one mistake in about every four trades. This is most important for one category of traders: rule-based discretionary traders. *In my opinion, when rule based discretionary traders become efficient, they are by far the best type of trader*.




Further to my other reply.
I find this comment suspicious.
If a Rule based discretionary trader is compared to a Rule based Systems trader it is seen by this guy as a distinct advantage to be able to select any trade in which the rules apply at his discretion.
In other words he or his super traders  are able to select from those stocks chosen by the "Rules" that will
Not be stopped
Will out perform others.
Now I have discretionary filters that I dont programme into my systems so I "think" Im clever enough to out fox everyone else.
Truth is what Im trying to do is out perform the mean of my systems---or rule base.
Under Montecarlo analysis my ---and everyone elses--rule based trading will have deviations each side of the mean. So we attempt to get on the up side of results above our mean---its human nature.
Over all Im above it--the mean--but not well above it.
Im still taking a trade that is chosen by the rules and due to capital restraints not every trade---every portfolio trader has the same dilema.



> There are two other groups of traders I’d like to talk about: 1) mechanical traders and 2) no-rule discretionary traders.
> 
> First, we’ll look at mechanical traders. Mechanical traders believe that they can eliminate psychologically related trading problems by becoming mechanical. Many people aspire to be mechanical traders, letting a computer make all the decisions for them, because they believe it factors out many human-based errors.
> 
> In fact, one of my best trader friends said to me once that psychology didn’t enter into his trading because his operation was totally automated. My response was “You could decide not to take a trade.” About 18 years after I made that statement, his CTA business closed down. His partner decided against taking one trade””the trade that would have made their entire year had they taken it.




Again very suspicious.
The one trade which in HINDSITE left a years opportunity un collected!
His partner decided not to take the trade not the systems trader!!
His CTA business closed down----inferring it was due to his system---sounds like a story--you know Snow white--etal.



> I’ve always said that people can only trade their beliefs about the market, so let’s look at some of the most important beliefs that a pure mechanical trader might have:
> 
> With mechanical trading, I can be objective and not make mistakes (except the psychological mistake of overriding my system).
> 
> Mechanical trading is objective. My system testing will allow me to determine my future results.
> 
> Mechanical trading is accurate.
> 
> If a system’s underlying logic cannot be turned into a mechanical trading system, it probably isn’t worth trading.
> 
> Human judgment is too prone to errors. I can eliminate those through mechanical trading.
> 
> So then, is mechanical trading truly objective? I tend to think not because there are all sorts of errors that can creep into an automated trading system: data errors, errors in the software platform, errors in your own programming, and many more. *(Interestingly, one of the main categories of errors that my Super Traders come up with consistently is programming errors*.)




And interestingly they are still Super traders.--They identify the issue---



> Let’s consider data errors. Is your data accurate or does it have bad ticks and other issues with it? Mechanical traders are always dealing with data errors of some sort. For example, price errors can show up in streaming data quite regularly. Sometimes those are resolved within seconds and the error “disappears” but, by that point, the bad data may have triggered a trade already. Additionally, historical stock data may or may not have dividend and split adjustments. And what happens when a company goes bankrupt? What if it goes private or is bought out by another company? Those companies’ data may simply disappear from your data set.




Survivourship--nothing new.



> I once wanted to research an efficient stock trading system. We looked for efficient stocks (moving up without much noise) and bought them with a 25% trailing stop. We had an S&P 500 data set going back 40 years that was supposed to be clean and adjusted for splits and dividends. I was very pleased with the results because my system made a small fortune. I didn’t realize this at the time, however, but the system traded on “inside information.” Because of the data set, I was able to buy stocks at the IPO that would later become part of the S&P 500. Thus, my system, in back test, bought Microsoft, EBay, Intel, and many other companies before anyone knew they would become part of the S&P 500. Why? Because, as I said, my data set was today’s S&P 500 going back 40 years.




An excellent example of how you can be trapped but nothing more.



> And what about Thursday May 6th, 2010? The Dow Jones dropped 1,000 points in the space of about 20 minutes. Blue chip stocks like Procter & Gamble dropped over 20 points, and Accenture even went to a penny per share briefly. While there may not have been one root cause for that mini-crash, it had a major effect on mechanical trading systems. Things like that happen in the markets; such are the challenges (error/mistakes) for mechanical systems. (That afternoon’s swing affected lots of regular traders, too. One client said he used 25% trailing stops on all of his positions and got stopped out of every single stock.)




Black Swan events happen. Let me assure you in the example above the discretionary Rule Based traders would have suffered just the same.



> Meanwhile, one of our instructors, Ken Long, trades rule-based discretionary systems and made 100R in that same week. As always, he was very conservative in his trading and very careful to make sure that he fully managed his risk.




I really see this as a selective example.
Im sure there were regression systems that would have done well also.



> There is another class of error that is made by mechanical trading systems: the error of omission. Because the criteria by which trade setups and entries are so precisely defined, mechanical systems miss many good (or great) trades that a discretionary trader would spot easily.
> 
> For example, suppose your systems screens for five consecutive lower closes. After you get five consecutive lower closes you then look for an inside day. Now you have your full setup. Your entry is a few cents above yesterday’s high.
> 
> So let’s look at some examples of other entry signals you might miss by being so precise. You could have four down days that were extreme””perhaps the price is down 30%. Or you could have less than four down days that where the price is 30% lower or more. However, neither of those example would be an adequate down move according to your strict mechanical criteria.
> 
> Let’s say you found something that had five days of new lower lows but the fifth down day might open on a new low and then close on a new high. That’s usually an extremely bullish signal, but you’d miss it by your precise definition. Or, you could have five days of lower closes and the sixth day opens on a new low but closes on a new high. Thus, the precise entry definition would miss a trade opportunity with even more weakness followed by an extreme bullish signal.
> 
> There are a lot more variations of this entry that a mechanical system would miss, but you get the point. As soon as you state your rules so precisely that a computer can execute the trades, you open yourself to errors of omission””good or outstanding trades that your automated system cannot take because of its precision.




But thats the whole point of it.
It can be measured
Perhaps your being deluded by the mind believing it can find EVERY (95%) of winning trades.
I think that in itself is a psycological problem---



> Those missed opportunities don’t qualify as mistakes but they severely limit the potential results of the underlying logic behind the system. The mechanical system results will look rather weak next to the results of a trader who used that same system and was allowed some discretion to take the all of those other trades that didn’t quite fit the precise mechanical system rules.




Some discretion!!!
The whole outcome is completely changed it is nothing like a mechanical system
There would be longterm results from discretionary trading---I have mone and so does everyone else.
Now sit down and work out all the stats and youll find they are --well mine are---similar to results I get with systems over time.




> Next week we’ll look at mistakes and another type of trader: the no-rule discretionary traders.




Cant wait.

-------------------------------------------------------------------------------------



> Dr. Van K. Tharp is the founder and president of the Van Tharp Institute and stands out as an international leader among professional trading coaches and consultants. Helping others become the best trader or investor that they can be has been Tharp’s mission since 1982.
> 
> Tharp collected more than 5,000 successful trading profiles in a 10-year study of individual traders and investors




His agenda is to have a successful business---dont lose sight of that!


----------



## Joules MM1

*Re: Developing a mechanical system from scratch - Van Tharp*

lulz.......when i first read this article i did a double take on most of the ideas....."hang on a mo......c'mon" 

and he's got a huge rep, too


----------



## Trembling Hand

*Re: Developing a mechanical system from scratch - Van Tharp*



Joules MM1 said:


> lulz.......when i first read this article i did a double take on most of the ideas....."hang on a mo......c'mon"
> 
> and he's got a huge rep, too




Its not a bad idea to keep track of your error rate. That is not how many trades go bad as such but how many actions you do that are not in keeping with your proven "plan".

But F
	

		
			
		

		
	



	

		
			
		

		
	
 me if any discretionary trader can make only 5 mistakes out of 100. I make more fat fingers than that let alone dumb trades!


----------



## Trembling Hand

And further how do you keep track of errors that are trades you didn't take?


----------



## tech/a

Trembling Hand said:


> And further how do you keep track of errors that are trades you didn't take?




Hang on thats logic.
Joe Pleb doesnt use logic.

Hindsite the best indicator known.


----------



## CanOz

CanOz said:


> I thought it would be interesting to develop a mechanical trading system from scratch with some of the members on ASF.
> 
> Maybe this has been tried before here, not sure. I know that it has been done a few times on ReefCap, with some obvious results, mostly positive from what i can gather.
> 
> I know very little about mechanical systems, but i am very keen to learn more about them and develop and test several of my own for application one day.
> 
> So if your interested, then drop by and add your "2 bob" as we proceed through the development stages.
> 
> How about a few ground rules:
> 
> 1.) There are no such things as stupid questions or suggestions, lets brain storm this together.
> 
> 2.) If you have 'been there, done that' then please let us work through some of the issues so we get a feel of ownership. Maybe a few hints now and then would be good too.
> 
> 3.) Those more experienced at this are most welcomed to provide thier guidence and constructive criticsm for us, without you we cannot learn.
> 
> 4.) Keep in mind we all have different software, lets try to be as generic as possible when talking about code. If you post code then at least label it for us code dummies.
> 
> Lets try to agree on the plan for the project first.
> 
> As Tech suggested to me, we could go like this to start with:
> 
> 
> Instrument/Universe
> Time Frame
> 
> Anyone to start things off?
> 
> Cheers,




Well its been a long time since i started this thread. Since then I've learned allot about the markets and discretionary / systematic trading. 

I'm now able to say i have a portfolio of systems that i'm ready to start forward testing. So far they consist of:

1) A DAX channel breakout
2) A DAX Open Range Fade
3) An HHI/HSI Open Range Breakout
4.) A Crude Oil Reversal System

I have 1 more in testing currently and two additional systems at the coder. One is for FX and the other should be ok on the SPI, or the FESX.

Today i'm working on an aggregate equity curve of the four combined systems to see how smooth it is and how they might compliment each other.

Although my testing has been done in Ninjatrader, i'll convert them to Multi-charts for forward testing and operating.

This process has taken weeks and weeks of work. Many evenings and a couple of thousand in coding. Still i need to forward test them on real market conditions to ensure they're still performing as expected.


----------



## VSntchr

CanOz said:


> Today i'm working on an aggregate equity curve of the four combined systems to see how smooth it is and how they might compliment each other.
> 
> Although my testing has been done in Ninjatrader, i'll convert them to Multi-charts for forward testing and operating.
> 
> This process has taken weeks and weeks of work. Many evenings and a couple of thousand in coding. Still i need to forward test them on real market conditions to ensure they're still performing as expected.



Congrats on getting through all the hard work Can. Looking forward to seeing some equity curves


----------



## Wysiwyg

CanOz said:


> 2) A DAX Open Range Fade
> 3) An HHI/HSI Open Range Breakout



Hello. Just wondering how the open range is defined? (time,  limits)


----------



## CanOz

Wysiwyg said:


> Hello. Just wondering how the open range is defined? (time,  limits)




One uses time and one uses a non-time dependent series.


----------



## CanOz

A portfolio equity curve. Some systems did not come online here until 2013. This was 1 contract for each system with slippage and commission.


----------



## Wysiwyg

CanOz said:


> One uses time and one uses a non-time dependent series.



You have probably already seen this but for others interested in opening range trading. They like the first 30 minutes range.

https://www.wpi.edu/Pubs/E-project/...910-142422/unrestricted/Veselin_Iliev_IQP.pdf


----------



## CanOz

Wysiwyg said:


> You have probably already seen this but for others interested in opening range trading. They like the first 30 minutes range.
> 
> https://www.wpi.edu/Pubs/E-project/...910-142422/unrestricted/Veselin_Iliev_IQP.pdf




Yeah i have Crabel's book. Another guy, Murray Ruggiero has done allot of work on ORB's....taking from where Crabel had left off and considering the extended trading hours of equity indices and commodities. I got some of my ideas from him on alternative's to time dependent ranges.

Thanks for the paper, will make some interesting reading during my nightly period of insomnia!


----------



## CanOz

Some additional statistics on the portfolio:

All stats are in AUD


Win% 48
Average Trade 189.83
Average Win 647.00
Average Loss -413


profit factor is 1.56

and the most important figure to me, MAX drawdown - 9.05%


----------



## Gringotts Bank

CanOz said:


> Still i need to forward test them on real market conditions to ensure they're still performing as expected.




Why not just walk forward on a few years of unseen data?


----------



## CanOz

Gringotts Bank said:


> Why not just walk forward on a few years of unseen data?




I've done that already. I'm more concerned about issues executing the orders, connectivity, the api etc.


----------



## fiftyeight

CanOz said:


> Some additional statistics on the portfolio:
> 
> All stats are in AUD
> 
> 
> Win% 48
> Average Trade 189.83
> Average Win 647.00
> Average Loss -413
> 
> 
> profit factor is 1.56
> 
> and the most important figure to me, MAX drawdown - 9.05%




How do these numbers compare with your discretionary trading?


----------



## howardbandy

Greetings --

Check opening range data carefully.  I was working in a Commodity Trading Advisory (CTA) firm in the 1990s and spent a little time with Toby Crabel.  He is talented and a lot of his ideas are good.  Rules, regulations, and market operations have changed significantly since the books and articles he wrote then.  Multiple market makers, electronic trading, decimalization, etc have changed the opening.  Historical data may, or may not, represent trades that are achievable today.

Each bar (day) has four prices associated with it -- open, high, low, close.  Some commodities have an additional price -- settle.  Each bar has two known times -- open and close.  Open price does not necessarily coincide with open time.  For the issues that are highly active, the opening price may have occurred at the opening time.  Similarly for the close.  For less active issues, there could be substantial time difference between the opening of trading and the first trade.  Intra-day bars may be needed to determine the accuracy of the system.   

I recommend doing development work using recent data but not quite current -- reserve a year or two.   Data before about 2000 may have very different characteristics than current data, but that is dependent on the specific issue being traded.  When everything looks good, do a one time walk forward over the reserved data as an out-of-sample validation.  Really one time only.  If the system is modified based on the out-of-sample results of the walk forward, that validation has been compromised and is no longer useful as an estimate of future performance.

Recall the one-liner:  If you do not do system validation yourself, the market will do it for you -- using real money.    

Best,
Howard


----------



## CanOz

Thanks Howard, great points.

Regarding the ORB strategies, they don'y work very often on indices, but fading them does. There are some Asian markets where they perform quite well. 

I'm not a fan of optimizing allot of parameters and my strategies that work well don't have allot of parameters to optimize.


----------



## CanOz

Another system to add to the portfolio, fresh from the coder. This one does require some optimization due to volatility. I optimized it on 4 years of old data and then walked it forward on 4 years of oos data. Then i optimized it on more recent data and then tested it on new oos data. In all tests it works well and its works well on several different markets. It will be tested on the IB paper trader with the other systems.


----------



## Gringotts Bank

Can, you're going to automate all these through Multicharts and AMP or IB?


----------



## Roller_1

CanOz said:


> Another system to add to the portfolio, fresh from the coder. This one does require some optimization due to volatility. I optimized it on 4 years of old data and then walked it forward on 4 years of oos data. Then i optimized it on more recent data and then tested it on new oos data. In all tests it works well and its works well on several different markets. It will be tested on the IB paper trader with the other systems.




It has some fairly drawn out DD periods, looks like one is ~2 years. Are these all single market systems?


----------



## CanOz

Gringotts Bank said:


> Can, you're going to automate all these through Multicharts and AMP or IB?




Likely Multi-charts and IB. So i need to get the operational versions all re-coded in EL.

I've had so many ideas to code over the years but couldn't find a decent coder that was reasonably priced, friendly and fast....until this year. Its been a great year for system development and because i have a quiet office, i get allot of work done.


----------



## Gringotts Bank

CanOz said:


> Likely Multi-charts and IB. So i need to get the operational versions all re-coded in EL.
> 
> I've had so many ideas to code over the years but couldn't find a decent coder that was reasonably priced, friendly and fast....until this year. Its been a great year for system development and because i have a quiet office, i get allot of work done.




Yeh some people definitely have a knack for coding - speed/precision/originality.  The best of the best seem to write in 2 lines what others take 50 lines to do.  Trash used to be like that with AB.

When you go live with the automation, can you post a video?  Would like to see how it works.


----------



## CanOz

Gringotts Bank said:


> Yeh some people definitely have a knack for coding - speed/precision/originality.  The best of the best seem to write in 2 lines what others take 50 lines to do.  Trash used to be like that with AB.
> 
> When you go live with the automation, can you post a video?  Would like to see how it works.




Sure, i'm tryng to have them setup before i go home tonight and i can do some video tomorrow.


----------



## Lone Wolf

CanOz said:


> Likely Multi-charts and IB. So i need to get the operational versions all re-coded in EL.




I recall having some kind of issue with multicharts auto trading and IB. I think something like if there was a momentary disconnection from IB servers, multicharts would turn off auto trading and wouldn't automatically restart. If it dropped connection while in a trade, you had to close manually through IB.

This was a very long time ago and may have been fixed now. But it might be worth pulling the plug on your internet during the test phase so you know what to expect when money is on the line. Not so much a problem if you don't intend to leave the PC.

Edit:
Actually I just remembered it was slightly worse than that. Multicharts appeared to be working fine, auto trade was on and connected to IB. But after the interruption it no longer generated orders. So the system was actually off, but looked like it was on.


----------



## CanOz

Lone Wolf said:


> I recall having some kind of issue with multicharts auto trading and IB. I think something like if there was a momentary disconnection from IB servers, multicharts would turn off auto trading and wouldn't automatically restart. If it dropped connection while in a trade, you had to close manually through IB.
> 
> This was a very long time ago and may have been fixed now. But it might be worth pulling the plug on your internet during the test phase so you know what to expect when money is on the line. Not so much a problem if you don't intend to leave the PC.
> 
> Edit:
> Actually I just remembered it was slightly worse than that. Multicharts appeared to be working fine, auto trade was on and connected to IB. But after the interruption it no longer generated orders. So the system was actually off, but looked like it was on.




Thanks for that Wolf, i'll keep that in mind.


----------



## CanOz

The HHI is a real pain to automate. IB's historical data is not continuous, so in order to trade the first three days of the month i have to shut off a filter and virtually force it to take trades when they're required.  I don't this is a problem other than i'll have to be at the PC all day.


----------



## CanOz

Hey, i've been here ten years and almost 10,000 posts...not so much as a brass razoo from Joe!!


----------



## CanOz

Here's a trend following system thats tests well on Soy Beans. The win rate is only 38%, a bit low. Any suggestions on a filter?


----------



## Gringotts Bank

CanOz said:


> Here's a trend following system thats tests well on Soy Beans. The win rate is only 38%, a bit low. Any suggestions on a filter?




I have one.  Count the number of soy milk cartons on sale in your local Supermarket!

You could do worse.


----------



## CanOz

Gringotts Bank said:


> I have one.  Count the number of soy milk cartons on sale in your local Supermarket!
> 
> You could do worse.




Yeah, i could have an insider at Coles and Woolied sending real time inventory counts, develop an API for that input. Hmmmmhow am i going to back test that?


----------



## Roller_1

are you using an index filter of some type, ie, C > 100 day MA. Could go long/short depening on the trend


----------



## CanOz

Got a rare signal on my CL Counter Trend strategy finally....


----------



## CanOz

Roller_1 said:


> are you using an index filter of some type, ie, C > 100 day MA. Could go long/short depending on the trend




No, none at all. Only a narrow range filter. It tests best at NR4. It takes trade when yesterday was the narrowest range of the last 4 days. 

I looked at volatility, doesn't seem to be anything there either....

It has no problem getting in on a trend, the problem is false signals. Perhaps a seasonal filter?


----------



## CanOz

This is a Counter Trend system for GC. Can't figure out why the big change in performance. This could be due to gold trading in Asia. Can anyone fill me in on when gold begun trading heavily in Asia?

Hmmm, never mind, the peak in gold was in 2011. i think i need to use a prices adjusted volatility measure...


----------



## CanOz

I need a volatility filter that works as a % of Price.  Anyone got any ideas how to plot the ATR as a percentage of price in Amibroker?


----------



## RowanC

CanOz said:


> I need a volatility filter that works as a % of Price.  Anyone got any ideas how to plot the ATR as a percentage of price in Amibroker?




Not sure exactly what you mean but at a glance...

n = 10;
TR = ATR(n);
perc_ATR = TR / C;
Plot(perc_ATR, "Percent ATR", colorBrightGreen, styleLine);


----------



## CanOz

RowanC said:


> Not sure exactly what you mean but at a glance...
> 
> n = 10;
> TR = ATR(n);
> perc_ATR = TR / C;
> Plot(perc_ATR, "Percent ATR", colorBrightGreen, styleLine);





Thats it, perfect. Why doesn't anyone else use this? It seems logical for instruments that have more price volatility over time than other...

Thanks Rowan!


----------



## CanOz

I'll get this coded and use it on my ninjatrader strats and see how it tests...


----------



## RowanC

CanOz said:


> Thats it, perfect. Why doesn't anyone else use this? It seems logical for instruments that have more price volatility over time than other...
> 
> Thanks Rowan!




No worries CanOz.

I like the concept of volatility for building strategies, specifically volatility compression and expansion. To me it makes a lot of sense especially for futures which have a tendency to breakout from areas of volatility compression.


----------



## CanOz

RowanC said:


> No worries CanOz.
> 
> I like the concept of volatility for building strategies, specifically volatility compression and expansion. To me it makes a lot of sense especially for futures which have a tendency to breakout from areas of volatility compression.




Yeah exactly, i use narrow range filters as well, but the price volatility is better for regimes i reckon.


----------



## Roller_1

I read a paper the other day to do with volatility, basically for trend following you are better off with low volatility stocks compared to higher volatility. Can't remember where or who it was though.... not real handy lol


----------



## captain black

Roller_1 said:


> I read a paper the other day to do with volatility, basically for trend following you are better off with low volatility stocks compared to higher volatility. Can't remember where or who it was though.... not real handy lol




Is this the one from Connors research?

(pdf download link)

http://connorsresearch.com/wp-content/uploads/2015/01/CR_Historical_Volatility.pdf


----------



## Roller_1

captain black said:


> Is this the one from Connors research?
> 
> (pdf download link)
> 
> http://connorsresearch.com/wp-content/uploads/2015/01/CR_Historical_Volatility.pdf




Yep, that's it


----------



## Gringotts Bank

Came across this in my travels.
  Search "soy" in...

https://authoritynutrition.com/optimize-omega-6-omega-3-ratio/


----------



## Wysiwyg

From the Connors Research paper. 


> What is price? It’s essentially a culmination of all the known information of a company. Therefore, price is real as it represents what the majority of the market participants know at that given time.



Not wholly true! Price is also an anticipation of better (or worse) future company success, mediocrity or failure. In other words unknown information. Not the "majority of the market participants" either but the majority of securities held in one place.


----------



## CanOz

Gringotts Bank said:


> Came across this in my travels.
> Search "soy" in...
> 
> https://authoritynutrition.com/optimize-omega-6-omega-3-ratio/




Dead link....


----------



## Gringotts Bank

CanOz said:


> Dead link....




https://authoritynutrition.com/optimize-omega-6-omega-3-ratio/

works for me.


----------



## Newt

Roller_1 said:


> I read a paper the other day to do with volatility, basically for trend following you are better off with low volatility stocks compared to higher volatility. Can't remember where or who it was though.... not real handy lol




Nick Radge made mention of this on his Facebook page recently if I recall correctly.  Someone (Alverez?) had commented on combining Radge's Weekend trend trader with volatility screening/metrics.  Its an interesting idea.  For my longer term trend following there is a lot to support gut feel for less volatile trending stocks (per unit price).

Suspect ATR/price is just the tip of the iceberg though Canoz - probably need someway to incorporate linearity /correlation and rate of change in price.  Arguably then too much at risk of lagging moving average sort of situation.  Will have to play more in Amibroker when some quiet time comes along.  Might add some value/edge to new high screens perhaps?


p.s.  Seem to also recall Pixel commenting previously on using %ATR successfully in his trading over many years.  Would have to go digging for the thread though.  Not something I succeeded in distilling into a useful approach last time I played with it - which is of course usually the way until you invest a lot of effort, experience and thought into these things!


----------



## CanOz

Here's an interesting statistic, after 500 minutes of morning trend, there is a 62% chance the that the 6A will reverse the trend. No Stops, Average trade is $300. Exit is the reverse signal.

This system did not work before 2009.


----------



## CanOz

This Dax momentum system trades just after the open and holds through until the next day. The ATR% filter will shut this down soon. I'll have the filter for this tomorrow. It should take the chop out of the equity curve, as well as some of the best trades.... a smoother curve is what we want.


----------



## Roller_1

What sort of % returns and DD are you looking at with these system CanOz?

This one looks to hve some deep and sustained DD's. Could be tough to trade


----------



## Lone Wolf

CanOz said:


> Here's an interesting statistic, after 500 minutes of morning trend, there is a 62% chance the that the 6A will reverse the trend.




500 minutes (8.33 hours) of morning trend? Typo?


----------



## Trendnomics

Newt said:


> Nick Radge made mention of this on his Facebook page recently if I recall correctly.  Someone (Alverez?) had commented on combining Radge's Weekend trend trader with volatility screening/metrics.  Its an interesting idea.  For my longer term trend following there is a lot to support gut feel for less volatile trending stocks (per unit price).
> 
> Suspect ATR/price is just the tip of the iceberg though Canoz - probably need someway to incorporate linearity /correlation and rate of change in price.  Arguably then too much at risk of lagging moving average sort of situation.  Will have to play more in Amibroker when some quiet time comes along.  Might add some value/edge to new high screens perhaps?
> 
> 
> p.s.  Seem to also recall Pixel commenting previously on using %ATR successfully in his trading over many years.  Would have to go digging for the thread though.  Not something I succeeded in distilling into a useful approach last time I played with it - which is of course usually the way until you invest a lot of effort, experience and thought into these things!




My trend-following system is constructed from two custom indicators (self designed/constructed - unaware of any other indicators that are similar). One of the indicators is a trend-strength + volatility indicator. Trading high volatility is perfectly acceptable, given the volatility has consequentially resulted in a comparatively strong trend.


----------



## CanOz

Roller_1 said:


> What sort of % returns and DD are you looking at with these system CanOz?
> 
> This one looks to hve some deep and sustained DD's. Could be tough to trade





Yeah this one had a doozy at the start, 30% plus. I don't plan on trading it live until i can smooth things out a bit. If that means giving up too much in returns then i'll bin it. I haven't done anything with annual returns of any sort yet.


----------



## CanOz

Lone Wolf said:


> 500 minutes (8.33 hours) of morning trend? Typo?




Nah its literally 500 minutes of trend, now that could be all kinds of different price patterns. This one is based on a certain number of higher closes.


----------



## Newt

Trendnomics said:


> My trend-following system is constructed from two custom indicators (self designed/constructed - unaware of any other indicators that are similar). One of the indicators is a trend-strength + volatility indicator. Trading high volatility is perfectly acceptable, given the volatility has consequentially resulted in a comparatively strong trend.




Agree there will usually be expanding volatility as the trend accelerates, but the gist of the Connors PDF referenced earlier was that (supposedly) over the longer term lower volatility stocks give more reliable gains that those with high volatility.  I haven't been able to get my head around the volatility measures they talk about - may even include intra-day volatility if I've read it right, but not ATR or similar many of us grab when "thinking volatility".

Glad to hear your metrics are working for you trendnomics.  I personally think honing a few well thought out indicators/calculations can really help you explore different dimensions of YOUR trading system as you move from modelling to developing confidence trading it.  Certainly for the way my mind seems to tick.


----------



## Wyatt

> Nick Radge made mention of this on his Facebook page recently if I recall correctly.  Someone (Alverez?) had commented on combining Radge's Weekend trend trader with volatility screening/metrics.  Its an interesting idea.  For my longer term trend following there is a lot to support gut feel for less volatile trending stocks (per unit price).



Here is the link http://bettersystemtrader.com/037-cesar-alvarez-studies-stop-losses/



> Suspect ATR/price is just the tip of the iceberg though Canoz - probably need someway to incorporate linearity /correlation and rate of change in price.  Arguably then too much at risk of lagging moving average sort of situation.  Will have to play more in Amibroker when some quiet time comes along.  Might add some value/edge to new high screens perhaps?




Apparently, Volatility (ATR) based position sizing for trend following systems is a 2 edge sword, it will lower your drawdowns but also your returns at times. 

Trendnomics system gives his stocks lots of time and room to move, so that when the inevitable dips occur, the loss or reduced profit is not taken at that time if the dip recovers within the shorter term. The attached chart shows some of the benefits of such concepts. Interestingly, on this model, the Feb '16 D/D was more acute than any other during the period. 

View attachment 67763


----------



## CanOz

Newt said:


> Suspect ATR/price is just the tip of the iceberg though Canoz - probably need someway to incorporate linearity /correlation and rate of change in price.  Arguably then too much at risk of lagging moving average sort of situation.  Will have to play more in Amibroker when some quiet time comes along.  Might add some value/edge to new high screens perhaps?!




Sorry Newt, just saw this ...

I like ATR% because for most of my momentum systems, that are equity index, they rely of volatility to drive the big moves. The problem with indices like the Dax and the NK is that they get expensive as well as volatile. I just want volatile. With a filter then yeah of course its lagging and i'll miss out on some...only testing will tell if that still keeps things trade-able for me...

I did notice i had one system that actually benefits from lower volatility, i'll have to go through my notes again to see which was it was, but i'll be able to apply my filter to that as well.


----------



## CanOz

Wyatt said:


> Here is the link http://bettersystemtrader.com/037-cesar-alvarez-studies-stop-losses/
> 
> 
> 
> Apparently, Volatility (ATR) based position sizing for trend following systems is a 2 edge sword, it will lower your drawdowns but also your returns at times.
> 
> Trendnomics system gives his stocks lots of time and room to move, so that when the inevitable dips occur, the loss or reduced profit is not taken at that time if the dip recovers within the shorter term. The attached chart shows some of the benefits of such concepts. Interestingly, on this model, the Feb '16 D/D was more acute than any other during the period.
> 
> View attachment 67763




I think it was Perry Kaufman on bettersystemtrader that was talking about using position sizing to improve performance of good performing system. So not to fix a poor system but to smooth returns. He was suggesting however, that a normal size should be used in volatile times and a larger size in less volatile periods. This has the effect of creating volatility in returns when it is needed, and less so when its not.


----------



## Newt

Wyatt said:


> Here is the link http://bettersystemtrader.com/037-cesar-alvarez-studies-stop-losses/
> 
> 
> 
> Apparently, Volatility (ATR) based position sizing for trend following systems is a 2 edge sword, it will lower your drawdowns but also your returns at times.
> 
> Trendnomics system gives his stocks lots of time and room to move, so that when the inevitable dips occur, the loss or reduced profit is not taken at that time if the dip recovers within the shorter term. The attached chart shows some of the benefits of such concepts. Interestingly, on this model, the Feb '16 D/D was more acute than any other during the period.
> 
> View attachment 67763




Thanks Wyatt
And here's the link to Radge's page I was thinking of:
https://www.thechartist.com.au/Better-Trading-Series/make-it-your-own.html

(disclaimer - not currently a subscriber, but definitely an admirer of The Chartist  )

Linda Bradford Raschke often talks about markets transitioning between low and high volatility.  Makes sense shorter term trader will seek out Volatility, while long trend traders may prefer entering on low (but increasing or soon to be increasing) volatility.....


----------



## Newt

CanOz said:


> Sorry Newt, just saw this ...
> 
> I like ATR% because for most of my momentum systems, that are equity index, they rely of volatility to drive the big moves. The problem with indices like the Dax and the NK is that they get expensive as well as volatile. I just want volatile. With a filter then yeah of course its lagging and i'll miss out on some...only testing will tell if that still keeps things trade-able for me...




Interesting to hear your take on shorter term index trading utility too Canoz...


----------



## Trendnomics

Wyatt said:


> Here is the link http://bettersystemtrader.com/037-cesar-alvarez-studies-stop-losses/
> 
> Trendnomics system gives his stocks lots of time and room to move, so that when the inevitable dips occur, the loss or reduced profit is not taken at that time if the dip recovers within the shorter term. The attached chart shows some of the benefits of such concepts. Interestingly, on this model, the Feb '16 D/D was more acute than any other during the period.
> 
> View attachment 67763




Correct - no stop losses and equal position sizing. I'm not trying to avoid draw-downs. I embrace draw-downs, due to equity market draw-down occurrences, consequently supporting my positive expectancy (i.e. everyone is trying to avoid draw-downs, by chasing high sharpe ratios). Also, there are strong risk-reward relationships - the higher the risk the greater the reward.


----------



## soso

Trendnomics said:


> Correct - no stop losses and equal position sizing.




No stop loss at all? You never exit losing positions? Tx.


----------



## Trendnomics

soso said:


> No stop loss at all? You never exit losing positions? Tx.




I'm implying that I don't set automatic stop-losses. My exit criteria is a 30% drop in price from entry or a confirmation that the trend is down (signal based).

As my records show, I exit more than enough losing positions.


----------



## CanOz

Same momentum system on the Nikkei. IT works better over time than the Dax.

Win rate is above 40%, average trade is acceptable and the avg. win to loss is good. Max Drawdown is 10%. I was quite surprised at how well it worked recently on OOS data.


----------



## CanOz

Similar momentum system on the SPI, hasn't taken a trade since March


----------



## Roller_1

Wouldn't a more robust idea be to build a system that trades reasonably well in all of the markets? Other wise if one market changes overtime you are going to be in trouble. Its like having a system that trades CBA and not ANZ 

I am not saying they aren't any good, Just a thought..


----------



## CanOz

These systems I'm using here are all two variants of a single system. The difference is a simple signal switch. The key to the successful back tests is to find the sweet spot in the time of day, then test that on alot of OOS data.


----------



## CanOz

CanOz said:


> These systems I'm using here are all two variants of a single system. The difference is a simple signal switch. The key to the successful back tests is to find the sweet spot in the time of day, then test that on alot of OOS data.




I replied to this whilst in the doctors office...to elaborate a bit, its my belief, that certain times of day hold the key to successful, robust results. These time periods need to make fundamental sense as well. For example, the closing few hours of the US session is known for its reversals as traders take profits. The Eu morning on the Euro has typically been bullish and the afternoon bearish as the US opens....these types of things. So do some data snooping, but only to determine key time periods that make logical sense. If the thesis is valid it should test well on at least 3x the amount of OOS data.


----------



## CanOz

Roller_1 said:


> Wouldn't a more robust idea be to build a system that trades reasonably well in all of the markets? Other wise if one market changes overtime you are going to be in trouble. Its like having a system that trades CBA and not ANZ
> 
> I am not saying they aren't any good, Just a thought..




This is an example of a SPI system and the same system on the ES.


----------



## howardbandy

Roller_1 said:


> Wouldn't a more robust idea be to build a system that trades reasonably well in all of the markets? Other wise if one market changes overtime you are going to be in trouble. Its like having a system that trades CBA and not ANZ
> 
> I am not saying they aren't any good, Just a thought..




Greetings --

Trading systems are models plus data.  The sole purpose of the model is to identify patterns in the data that precede profitable trades.  In my opinion, there is no requirement -- no reason why we should expect -- the patterns for one issue to be the same as the patterns for any other issue.      

Maybe bank stocks are similar enough to each other, as the pattern goes, that one model will find profitable patterns for several bank stocks.  Or maybe not even that.  But I would not expect that same model to find profitable patterns in a country ETF, for example.  

Finding models that detect profitable patterns in any one issue is hard enough.  Requiring that it find profitable patterns in many issues -- or even just several issues -- is a very high bar.

Thanks for listening,
Howard


----------



## howardbandy

CanOz said:


> This is an example of a SPI system and the same system on the ES.




Beware of relying on in-sample testing.  In-sample results are always good -- whether the model learned to recognize profitable signals or just fit to the idiosyncrasies of the data.  It is only out-of-sample testing -- using never before seen data that is more recent than the in-sample data -- that provides useful estimates of future performance.

Best,
Howard


----------



## CanOz

howardbandy said:


> Greetings --
> 
> Trading systems are models plus data.  The sole purpose of the model is to identify patterns in the data that precede profitable trades.  In my opinion, there is no requirement -- no reason why we should expect -- the patterns for one issue to be the same as the patterns for any other issue.
> 
> Maybe bank stocks are similar enough to each other, as the pattern goes, that one model will find profitable patterns for several bank stocks.  Or maybe not even that.  But I would not expect that same model to find profitable patterns in a country ETF, for example.
> 
> Finding models that detect profitable patterns in any one issue is hard enough.  Requiring that it find profitable patterns in many issues -- or even just several issues -- is a very high bar.
> 
> Thanks for listening,
> Howard




Howard, you're either in a different time zone to your home or burning the midnight oil...

I sort of expected the system to work on the ES in this case as the concept of the system was based on the US action. I was pleasantly surprised to see it 'works' on the ES, as i had not tested it until the post by Roller.

In regard to in sample and OOS i always test my concepts on a brief period (in sample) and then follow up testing with OOS tests back roughly 2x the initial period and then forward roughly on 1-2x the in the sample period.

Any markets that have insufficient data to conduct this test regime on, then i shelve it and come back several months later and test again, case in point would be the HKFE markets where i only have three years of data.


----------



## CanOz

I'm pretty much finished setting up my strategies and ready to leave them running whilst i am away. I'll tally up the results when i get back from behind the wall...I will continue to test until around the first of October when i would like to start trading them on my live accounts.


----------



## CanOz

Got my ATR% Filter working....as planned.

Here is the Dax result from 2009 until current, without and with the filter.


----------



## CanOz

Some results with an additional short term volatility filter and with and without trailing stops....


----------



## CanOz

Arghh, arrived in China on Friday....already missing my desk. Lots of time to read this time though with my young fella more independent now. Got some good systems books by Kaufman, chan, Williams etc.

Funny enough my systems aren't taking any trades. Still short the nk from Friday but that's it, no new signals. Everything connected as normal though.

It's hot and humid here in Shanghai....the building keeps going, construction everywhere!


----------



## Gringotts Bank

CanOz said:


> Arghh, arrived in China on Friday....already missing my desk. Lots of time to read this time though with my young fella more independent now. Got some good systems books by Kaufman, chan, Williams etc.
> 
> Funny enough my systems aren't taking any trades. Still short the nk from Friday but that's it, no new signals. Everything connected as normal though.
> 
> It's hot and humid here in Shanghai....the building keeps going, construction everywhere!




Have you ever tried King Grade Dragonwell green tea?  Exy, but wow.


----------



## CanOz

I don't think so but I never know what I'm drinking....Jenny just gets it from her family. Is it from hangzhou?


----------



## Gringotts Bank

CanOz said:


> I don't think so but I never know what I'm drinking....Jenny just gets it from her family. Is it from hangzhou?




Zhejiang province has the real deal stuff, apparently.  Gives you a bit of a high I reckon - possibly the high caffeine content.  I got it from this guy.
http://shop.amazing-green-tea.com/dragon-well-tea.html#description


----------



## CanOz

Recent returns on my multi system portfolio, last 100 days in most cases. In a couple of cases where the systems trade less frequently there are no trades at all.

Overall, certainly worth continued testing. These results are just the back tests on recent unseen data, not live results or live results on simulated accounts.


----------



## jjbinks

CanOz said:


> Recent returns on my multi system portfolio, last 100 days in most cases. In a couple of cases where the systems trade less frequently there are no trades at all.
> 
> Overall, certainly worth continued testing. These results are just the back tests on recent unseen data, not live results or live results on simulated accounts.




how much starting capital do you have in your system canoz?

Also what data do you use?

thanks!


----------



## CanOz

jjbinks said:


> how much starting capital do you have in your system canoz?
> 
> Also what data do you use?
> 
> thanks!




It's not live yet, but I'll be using my super. It has roughly 150k in it. 

I'll use cqg data but execute through IB.


----------



## Quant

With regards to Building Systems i'm curious to know what traders filter or measure to define parameters of what will give a signal . Given the many states that the market operates in are traders  building separate systems for each individual type of market conditions ? I have spent many years developing a system that operates in all market conditions , obviously it's a compromise trying to build a system that deals with the entire spectrum of market conditions . I primarily trade indice and have based my rules and parameters on the individual style of price action attributable to index . The whole premise of building a 1 system does all is intricate and complex with many sets of rules to switch between various market conditions. I am curious to know whether there are other Traders they have gone down this road . I have written many of my own indicators to achieve accurate filters to determine the signals I require . Looking for feedback from other systems developers . Eventually i plan building an automated system around my core strategy , given the complexities and rules of my system writing the code is above my pay grade , at some stage I need to hire or collaborate with someone that has advanced code writing abilities . Anyway i'm hopeful that we can get positive discourse going on this subject . Looking forwards to any useful commentary


----------



## Quant

Whilst developing systems I have found it constructive to break each element down and work on one element at a time . These elements can consist of several things . Given that the best bang for buck trades are with the trend I find that making trend following trades the primary source a profit , so once we have defined a trend we need to ascertain places in the trend to join trend . When we have a ranging market the profit potential is equal in both directions therefore the parameters will be different to those of a trending market and a different set of rules needs to be applied . In regards 2 trading Indice tops and bottoms have distinctly different styles and parameters therefore the rules to trade a top distinctly different for those involved a bottom . Index swing highs slow and bottoms fast therefore different parameters are required to identify if market is topping or bottoming . This is where the complexity of rules come into play as you just can't use an inverse set . So breaking it down a set of rules is required for each condition and the change of conditions . This is where a list of bullet points comes in handy so you can work on one at a time and optimise the rules pertaining 2 each condition. This is where it's obvious that it becomes a complex task . Identifying the price action that defines conditions and change of conditions needs to be turned into a maths based equation ( an indicator ) so as to systemize  .


----------



## Quant

I been playing with daily systems to trade indice , this one straight of the mould with ZERO risk management applied just buy and sell predefined signals/ parameters with custom indicators  , also long only ( at this stage ) adding the short side will smooth the curve and reduce the drawdown ( i think )  . also flat position size as well so dynamic position sizing will likely improve returns  . Such interesting concepts


----------



## Quant

The thing with these systems to stand the test of time a GFC type event must be dealt with and so I have done some work on the short side aspect , obviously long setups dismal over gfc type event but the short side setup absolutely creams it with massive returns , will work on combining the 2 into one system to evaluate the curve even thought its easier to run 2 systems concurrently  ...  this stuff is so exciting


----------



## Quant

Exact same setup applied to my intra time frames , obviously gets killed after swing highs with zero risk management but pretty easy to apply a filter to prevent longs in declines and limit loss sizes , and same thing adding shorts smooth it right out  . OBVIOUSLY  drawdowns not acceptable but i think thats an easy hurdle to overcome  
	

		
			
		

		
	




Worst 10 trades not hard at all to iron these out to something much more palatable with a trend filter and some sort of active stop loss


----------



## CanOz

Great work Quant, this is a system that I'm walking forward at the moment (simulated) and was inspired by your 'descretionary systematic' approach and uses volume profile for context. Its a work in progress and something i hope to fully automate some day. Stops are wide and entries not so important, don't require all the order flow tools....Its trading GC, CL, FDAX, FGBL, 6B


----------



## rb250660

Quant said:


> Given the many states that the market operates in are traders building separate systems for each individual type of market conditions?




I have been trading a swing type model for the last 12 months. I just finished coding a large cap trend following model a few days ago that I will let loose in April after I finished validating and tweaking it. They are two distinctly different systems and will be run as such. I don't use regime switching in the one model, too complex on so many levels.



Quant said:


> In regards 2 trading Indice tops and bottoms have distinctly different styles and parameters therefore the rules to trade a top distinctly different for those involved a bottom. Index swing highs slow and bottoms fast therefore different parameters are required to identify if market is topping or bottoming.




Right on. In fact I would set up 2 different systems to manage this.



Quant said:


> The thing with these systems to stand the test of time a GFC type event must be dealt with and so I have done some work on the short side aspect , obviously long setups dismal over gfc type event but the short side setup absolutely creams it with massive returns , will work on combining the 2 into one system to evaluate the curve even thought its easier to run 2 systems concurrently  ...  this stuff is so exciting




Make sure that in these types of events you can actually short the stocks you want to short. I am under the impression a ban was placed on shorting many stocks during the GFC.


----------



## Quant

rb250660 said:


> I have been trading a swing type model for the last 12 months. I just finished coding a large cap trend following model a few days ago that I will let loose in April after I finished validating and tweaking it. They are two distinctly different systems and will be run as such. I don't use regime switching in the one model, too complex on so many levels.
> 
> 
> 
> Right on. In fact I would set up 2 different systems to manage this.
> 
> 
> 
> Make sure that in these types of events you can actually short the stocks you want to short. I am under the impression a ban was placed on shorting many stocks during the GFC.




Financial stock shorts were banned after lehmans collapse  , easy enough to leverage shorts on indice , if you were short banks pre ban you were entitled to keep/hold them .  

Re regime switching , sure its reasonably complex but all totally actionable and not overlly difficult , plenty of lines of code but tedious more than anything  . I know a guy who has algos with 6000 lines of code  , the decision trees are all logic its just the rules involved that create the dynamic algorythym , maths skillsets required but we arent doing quantum physics are we . 

Re the large cap system , i am working on a similar thing  , just working on the bullet points atm and should have a workable idea soon  . I am doing the whole technical/fundamental combo . Pretty unique stuff i believe and should produce some industry leading returns   . Mean reversion is easiest on large caps due to the solid and reasonably predictable balance sheets , over shoots either bull/bear all very actionable and predictable  . Interested to see your results , need any encouragement i can find  . Biggest issue for me is i have more ideas than time  . One day hope to have some staff , this year the plan . Just need to trade up the capital


----------



## rb250660

Quant said:


> Interested to see your results , need any encouragement i can find  . Biggest issue for me is i have more ideas than time  . One day hope to have some staff , this year the plan . Just need to trade up the capital




I have the luxury of not working so I get to spend a lot of time on model development and testing. I write all my own validation and monitoring tools too. I believe being able to code and having sound maths and statistics skills are necessary to take the quantitative road. My day job was in engineering and I have found that experience to be invaluable.

I also think too many people make decisions on single run back tests. On top of that they load position sizing into the model too which is inappropriate in almost all cases. Elements of risk should be assessed outside the model after every trade. Looking at discrete/average figures is so misleading. I see everything in trading (and life for that matter) as a distribution of probabilities. Before I enter any trade I know my stats. A lot of people don't know their stats so that's probably why they don't stick to their model, they can't cope with the uncertainty.

My swing model I actually finished developing in December 2013 but I was too busy with work to trade it up until about 12 months ago. The out of sample performance from 2014 has been really good so that confirms my model works and it still works. I made a few minor changes to it this week after observing it trade real money for a year and getting some screen time. The issues were all related and concerned liquidity, spread and volatility.

My trend model was an old idea I had back in 2013 as well. I couldn't get the code working back then and gave up too easily. 2 weeks ago I was cleaning up some files in my code folder and looked at it again and saw the problem right away. I've spent 2 weeks solid working on it and now it's essentially finished. I'm just waiting for some capital to come out of a term deposit next month and I'm set to go.

Single back test results below. I know I just **** canned that approach but the distribution of results is very tight so these averages are a pretty good representation with the exception of the draw downs. The most frequent occurrences of the draw downs are much lower than the maximums stated (about a 1/6):
Swing model:
Win: 74% of trades, 5.6% avg. gain
Loss: 26% of trades, -4.2% avg. loss
CAGR 39%, MaxDD 12%
115 trades a year

Trend model:
Win: 60% of trades, 28.4% avg. gain
Loss: 40% of trades, -6.2% avg. loss
CAGR 37%, MaxDD 27%
30 trades a year

I have capped position size on the swing model due to the relationship between liquidity and the amount of trading opportunity I am looking for (I limit my position size to around 7% of the days liquidity). The Trend model doesn't suffer from this (large cap stocks only taken) and position size is uncapped. This is an often overlooked element in those great looking back tests everyone has.

Both models are very simple and have very few 'moving parts'.

The correlation between each system's daily returns is 0.13


----------



## rb250660

Here's an observation I have made in my time testing systems and it's regarding the index filter. People seem to include it 'just because everyone else does' to getting their mechanical systems to spit back a decent back test. Presumably to limit draw downs.

I don't agree with the principle and don't use it in any of my trading. There are more intelligent ways to manage the issues that an index filter is supposed to manage. It might be the case that not all your open positions are correlated to the index in minor corrections. Too often the index filter will pull you out of quality positions just to have you re-enter soon after at a higher price. Yes, during events like the GFC correlation goes to 1 pretty much across the board but if you deal with this intelligently it's not a problem.

Anecdotally, the day traders around here know that on the days when the market has gone to **** and there are one or two stocks running everyone is flocking to them. These are the easy money and often make for a great day of trading. That's how I like to think of it but on a longer time frame.

Have a good reason to get out of a trade such as you were just plain wrong and it decided to move against you. Don't release good positions just because the XAO decided to move below its own 75SMA.

So think about it another way, I'll leave it up to you to consider. Don't just include it every time you code a new system because it's in your template or because 'everyone else' does it.


----------



## howardbandy

Quant said:


> Re regime switching , sure its reasonably complex but all totally actionable and not overlly difficult , plenty of lines of code but tedious more than anything.  I know a guy who has algos with 6000 lines of code , the decision trees are all logic its just the rules involved that create the dynamic algorythym, maths skillsets required but we arent doing quantum physics are we .




Regime switching has become easier.  There is a working example in AmiBroker in my "Mean Reversion" book, and a much different example in Python in my "Quantitative Technical Analysis" book.  

The AmiBroker algorithm is about 150 lines long, of which over half are comments, system settings, and lines listed separately for clarity.  In essence, there are multiple (two in the code shown) separate models in the file.  The trading result of each is tracked and the buy and sell signals come from the one that is best.  The listing of the afl is on page 192 and is easily understood.  This works, and the chart shown on the cover of the book is the out-of-sample result of this program.

The Python algorithm uses the CAR25 universal objective function along with sequential Bayesian analysis to track and switch among any number of alternatives.  CAR25 is the estimate of risk-normalized profit potential.  It is a Dominant metric -- which means that the best use of funds is to trade the single system that has the highest CAR25, switching to another when the ranking changes.  There is no need for a portfolio.  In fact, forming a portfolio means that a portion of the funds are being used sub-optimally.  Risk-normalization, distributions of results, CAR25, and dynamic position sizing are all developed and explained in the QTA book.  The Python code that implements dynamic position sizing is about 200 lines of code.  See page 412.

For more information, and to read portions of each book, begin here:
http://www.blueowlpress.com/123-2

In always, perform your own validation before considering using either technique.

Best regards,  Howard


----------



## tech/a

*Howard*.

You have a long "association" with Amibroker. Written many books on systems development.

But my question is
Is it adequate for the development of trading systems particularly shorter term as you have alluded to in your replies over the last few months.
Or
Do you really need to in corporate python with its greater capability? Is the software required not here yet?

Would you combine the two---could you?
Or stand alone python?

Is there enough out there for the general punter to design and monitor a profitable trading system----in your opinion?

Do you think the general punter without sound mathematical skills beyond basic high school maths and sound computer programming and literacy skill has the tools available to invent and implement a profitable trading system?


----------



## howardbandy

Greetings --

Traditional trading system development platforms, such as AmiBroker, TradeStation, and NinjaTrader, have the benefits of features specific to traditional technical analysis with its roots in chart interpretation.  Analysts and traders who find value in those techniques should stay with those platforms.  But skip to and read my final comments before leaving this message.  

More recently, traditional platforms added capabilities to develop and test rule-based trading systems.  Trading system specific languages such as TradeStation's Easy Language and AmiBroker's afl are examples.  There are two primary limitations to traditional platform trading systems.
1A.  They, with very few exceptions, use the "decision tree" model.  Decision trees have several advantages, including rapid testing of alternative sets of rules and ease of understanding the resulting model.  One of the major disadvantages of decision tree models built using traditional platforms is that they are easily and often overfit -- that is, it is easy to adjust the rules so that the fit to the in-sample data is excellent and perhaps too good.  
1B.  There are model development techniques that can be used to test whether a model has been overfit, and to test whether it has identified general characteristics of the data.  One such technique is crossvalidation.  It is regularly and widely used in almost all areas of application -- but trading systems seems to be the most important area that is missing.  The model development literature describes crossvalidation well.
1C.  The primary purpose of systems we develop is prediction.  We want the system to identify conditions that precede profitable trading opportunities.  That is, we want the model to have learned to identify some persistent signal within the data, so that it can continue to identify similar signals in data that was not used during development.  The only way to know whether a model has "learned" something general or "memorized" something specific is rigorous validation.  Traditional platforms are weak in validation. 
1D.  Model development for prediction is guided by an objective function.  Traditional platforms have very limited capabilities with regard to the definition of objective functions and evaluation of models.  Almost always the objective function is a single value -- such as the final equity or smoothness of an equity curve.  A more thorough development makes use of a distribution of results, of which the single value is one example.  Traditional platforms are weak in capabilities for analysis of the distribution of results.
2A.  Decision tree models are only one of many alternative model techniques.  Others include support vector machines, boosted models, nearest neighbors, neural networks, forests of individual models (including decision trees) -- there are several dozen well documented and professionally implemented alternative models available.    
2B.  Individual decision tree models are seldom the best of the alternatives.  Unfortunately, there is no way to determine in advance of extensive model development which model technique will be best for a given set of data.  Fortunately, the models available from the scikit-learn library have a common interface and can be tested, fitted, compared, and validated in a single computer run.

Machine learning is the label often given to the broad technique of developing models that learn from data.  (In a very limited sense, traditional trading system development is machine learning, but with a very restricted set of applications and capabilities.)

To address your specific questions:

----------------

The two techniques -- traditional platforms and machine learning -- are equivalent with regard to bar length.  Either can use data bars of any length.  The pandas library -- developed by Wes McKinney while he was an analyst for Cliff Asness' AQR Capital hedge fund -- makes data manipulations (such as dealing with missing data, changing periodicity, standardizing time zones, adding columns of intermarket data, etc) easy.

There is a fundamental difference in point of view between the two techniques.  
With traditional platform development, many decision are made in advance either by the publisher of the platform (in terms of what techniques and tools are available) or by the developer during development.  Within those constraints, the focus is:  "Compute an indicator, then see what happened later."
Contrast with machine learning, where the focus is:  "Identify a useful pattern, then see what preceded it."

Holding period is related to this difference.  But even that comes after frequency of evaluation.  I have written extensively about the difference between impulse signals and state signals.  

Traditional platforms primarily (but not exclusively) use impulse signals (Buy, Sell, Short, Cover) to mark the beginning and end of trades.  State signals indicate the position to be held from the current time to the time of the next evaluation.  If you are using daily bars and updating after every close, the evaluation period is daily.  If you are using impulse signals (and strictly following the rules of your model), no action is taken until a new signal is issued.  The holding period is the time between the Buy and the Sell.  That might be limited by one of the rules, such as a minimum or maximum holding period exit.  But there is no inter-signal action.

State signals are generated by the model at every evaluation.  If the model is examining daily data, it is searching for patterns daily, and it will issue its recommendation for the trade for the next day.  That will be one of the states you want your trades to include -- "beLong," "beFlat," or "beShort."  The accounting for a multi-day hold is identical whether it was due to two impulse signals some days apart, or to several beLong state signals in succession. 

With a traditional platform, decisions made by the the developer determine ahead of analysis of the data what the holding period will be.  With machine learning, the model looks for the signal within the data and reports it as it occurs.    

-------------

You could combine the two techniques.  Traditional platforms are specialists at reading data from providers such as Yahoo, Google, and Norgate.  And they have builtin functions to compute indicators (which may or may not be a good thing).  You can, and I have demonstrated code that does this, read data, compute indicators, and write a csv file to disk using a tradition platform; then use a machine learning program to read that csv file, build and validate the model.

You will probably not be able to call the machine learning libraries or completed model directly from the traditional platform.  So signal generation will always be a two step process involving both tools.

Python is equally as good as reading financial data.  Yahoo, Google, and Quandl provide free data.  Quandl provides high quality subscription data with over 4000 data series.  I have had several conversations with Richard Dale of Norgate encouraging him to support a Python API.    

-------------

I am not certain about what a general punter can do, or wants to do.  

The profession of trading has already moved to bigger firms, shorter time periods, more sophisticated systems, and stiffer competition; and the markets are becoming more efficient and profits more difficult to come by.  Machine learning is already dominant, and will become more so in the future.  Being successful is not just being best among a small group of non-professional traders, but rather among the best in the entire arena.  There are no handicaps given to newbies, no do-overs.  David Shaw and Goldman Sachs will vacuum up all wrong trades and bankrupt all mediocre traders without a second glance.

In my opinion, every trading system developer needs to know that his or her systems can compete profitably.  

-------------

Some general suggestions.  All have already been published in my books and presentations.

1.  Use state signals.  Even if you are staying with a traditional platform.  Evaluate every day.  Be willing to change position every day.  

2.  The sweet spot is: trade frequently, trade accurately, hold a short period, avoid serious losses.

3.  Use CAR25 as your objective function.  It is a Dominant metric.  It can be used to compare any two or more alternative uses of funds.  Trade the single best, switching to the next best when CAR25 values change.  

4.  Trade a single issue -- the single issue with the best CAR25.  Forming a portfolio only ensures that some of the funds are being used suboptimally.     

5.  Keep position sizing out of the signal generation model.  The pattern recognition portion has no way of knowing whether a distribution drift is taking place.  And -- if position sizing is not in the trading management system, then there is no "knob to turn" to adapt to changes in system health. 

-------------

In summary.  

My association with AmiBroker began over 15 years ago.  At that time, I was in recovery from a very bad business experience where a trading system platform I had designed, built, and was beginning to market was stolen from me by a disreputable business partner.  I was in the process of writing a new platform when a colleague introduced me to AmiBroker.  It had most of the features I was planning to put into my new platform.  Since I wanted to be a trading system developer, not a platform supporter, I gladly bought an AmiBroker license and dropped my own.  Over time, AmiBroker was expanded to include most of the pieces I though were missing.  I continue to support and recommend AmiBroker as the traditional platform of choice.  It is inexpensive, well documented, fast, well supported, etc.      

Move to machine learning-based development if you can.  There is a learning curve.  There is math.  A few of my consulting clients are continuing to use AmiBroker.  I have moved my own development and trading to machine learning.  I recommend Python -- although those who already have substantial experience with, or support for, R might consider it instead.

If you decide to stay with traditional systems, at very least take position sizing out of the trading system and implement a separate trading management system.  Reduce position size during drawdowns.

My macro view.  It is not scientific.  That is, it is not based on evaluation of in-sample data followed by validation using out-of-sample data.  That said, I believe we are in the biggest bubble yet seen in all financial classes -- equities, bonds, real estate.  I expect we will revisit the 2009 lows, and probably go lower, in all financial classes.  I have no way to predict when this will happen, but the trading management system will recognize it when it happens and save my trading account.  Holding through a deep drawdown is an act of faith -- not, in my opinion, a good thing.

Best regards,
And thanks for listening,  Howard


----------



## tech/a

Thanks Howard
Excellent.


----------



## rb250660

Howard, any suggestions on learning resources for Python and the libraries mentioned? I plan to begin studying this from mid-March. I know your book has teaching resources but I'd like a few resources at my disposal.

Cheers
rb


----------



## howardbandy

Thanks for the kind words.  

As I was writing a response, I thought it might deserve its own thread.  Please look for "Getting Started in Machine Learning for Trading" 
https://www.aussiestockforums.com/t...chine-learning-for-trading.32963/#post-939573

Best,  Howard


----------



## CanOz

My very first self coded breakout strategy.....not life altering but it was fun! I think i'm going to enjoy this, its creative...

No slippage or commision and 3 years worth of data....strictly for fun at this stage.


----------



## tech/a

Wow wait until your serious!


----------



## CanOz

Same breakout system with Slippage and commision and only trading the first 4 hours of the European session....


----------



## tech/a

Have you live traded this or simmed it long enough to see how it goes?


----------



## CanOz

Nah tech, it's fresh outta the language editor....every time I open tradestation I have a look at it recently.


----------



## CanOz

As I learn to code different filters I try it out....


----------



## CanOz

Had lunch with a mate today and we were talking about ATR. I mentioned that as a regime filter i sometimes use two ATRs of differing lengths as a switch. I then pondered if it might be a good signal....Turns out it is....here's the stats on the currencies and the EL Code. I used a simple moving average cross for a stop and the ATR cross for the signal. More likely a good idea of a regime filter than a system though.


		Code:
	

//ATR Crossover woth SMA cross trailing stop_use on daily TF_by CanOz
if marketposition <1 and AvgTrueRange(20) crosses above AvgTrueRange(100) then sell short this bar;
If marketposition = 1 and average(c,25) crosses above average (c,15)then buy to cover this bar;

If marketposition<1 and AvgTrueRange(20) crosses below AvgTrueRange(100) then buy this bar;
If marketposition = 1 and average(c,25) crosses below average (c,15) then sell this bar;


----------



## Wysiwyg

CanOz said:


> 2.) If you have 'been there, done that' then please let us work through some of the issues so we get a feel of ownership. Maybe a few hints now and then would be good too.



Gee whiz I spent much time into the early hours of mornings running mechanical systems on Amibroker and found nothing that gave me real money similar results or confidence to put real money on (since I lost a fair bit on the learning treadmill anyway). The overall market conditions, bad news announcement, a glitch here, a stall there, stopped out on desperate large parcel offloads, missed exits because system said hold and generally different from backtest results. I felt I knew way more than a mechanical system so I stopped and collated all what I have learned and make "decisions" from a variety of set ups (not restricted there) with "consideration" of way more market nuances than my mechanical systems can see. Market depth, short positions open, market sentiment and all the little experiences picked up along the way for example.

Still use the charts but fixed rules did not work for me. I know I am not alone.


----------



## rb250660

Volatility ratios can be good filters for identifying optimal times for contrarian trading I find.


----------



## rb250660

Wysiwyg said:


> Gee whiz I spent much time into the early hours of mornings running mechanical systems on Amibroker and found nothing that gave me real money similar results or confidence to put real money on (since I lost a fair bit on the learning treadmill anyway). The overall market conditions, bad news announcement, a glitch here, a stall there, stopped out on desperate large parcel offloads, missed exits because system said hold and generally different from backtest results. I felt I knew way more than a mechanical system so I stopped and collated all what I have learned and make "decisions" from a variety of set ups (not restricted there) with "consideration" of way more market nuances than my mechanical systems can see. Market depth, short positions open, market sentiment and all the little experiences picked up along the way for example.
> 
> Still use the charts but fixed rules did not work for me. I know I am not alone.




Remember when you were a smart arse to me when I pointed out your gross errors in you mechanical system a while back? Maybe you failed because you didn't want to listen to other people's input.
https://www.aussiestockforums.com/threads/why-isnt-everyone-rich-trading-these-systems.31106/page-4


----------



## CanOz

Certainly intraday systems are pretty difficult to have faith in, but there are still persistent edges trading longer term. At the moment I'm just having fun learning to code. I've no pressure to earn a living from this and along the way I may learn something that helps me in my discretionary trading...


----------



## CanOz

My 30/30 intrday strategy now with and optimised trading window and optimised stops. Plus an ATR % filter. Next step is to code up or steal a trailing stop. I think i'll run that on a third data series.


----------



## Boggo

An extract from Kevin Davey's book that may have some points of interest.


----------



## CanOz

Thanks Boggo. The expectancy expressed that way certainly doesn't look very good....but I need to have another look when I'm not lying in bed on my iPad.....


----------



## CanOz

I've added a trailing stop and although its improved the longs i need to split the inputs in order to max out the usefulness of the trail on short trades as they happen quicker. Trailing stops are definately better than hard targets though. The code, although already in Tradestation had to be integrated and that was challenging, but rewarding when i figured it out. Kicking myself for not learning to code years ago, i could have been a gun by now!


----------



## captain black

CanOz said:


> Kicking myself for not learning to code years ago, i could have been a gun by now!




Coding is a useful skill to have.  I've been contributing to open source projects for a number of years (mostly using Python) as a bit of a hobby but have recently been using Python in trading systems.  Learnt coding in Amibroker early on which made all the difference with trading mechanical systems.

Even something as simple as using flowcharts to map out code structure is a useful skill to develop.


----------



## CanOz

So here is both trailing stops optimised separatly. This strategy work ok, but the numbers are not great. It was a great excercise in adding filters and stops. I also set it up on the Euro and it works ok as well. If anything that i could do that may help is to add a relative volume filter. Something i've wanted to code up anyway, we'll see....


----------



## CanOz

Here is the Euro (6E)....


----------



## CanOz

Just for kicks and giggles i thought i'd see how it did on the Swiss Franc....on the right side at least!

Been flat on the OOS data.


----------



## CanOz

GOLD Is a screamer, a little low on the average trade though....no slippage and commisions in these so that would kill it.


----------



## CanOz

CL - Again the average trade is too small. Still, tested well OOS so that was encouraging.


----------



## CanOz

Here is the code for the system setup for Gold.


		Code:
	

//*************************************Thirty-Ten Breakout************************************************

//************30m10bar breakout strategy for GC by CanOz************
///////////////////Created September 2017////////////////////////////
//This strategy enters the market on a break of the 10 bar high or low and uses a
//trailing stop after an inital stop loss.

//These inouts can be optimised, Bars before break, start time and end time, Long and short stops and the ATR %
//Filter and threshold

Inputs:BBS(15),starttime(300), endtime(830), SLLE(1300),SLSE(350), Length( 30),Threshold( .5),
    
//Long entry ATR Trail stop settings, also optimisable   
    ATRLengthLE( 2) ,
    NumATRsLE( 2) ,
    NumBarsLE(  9),
//Short entry ATR Trail stop settings
    ATRLengthSE(  2) ,
    NumATRsSE( 4) ,
    NumBarsSE(  5) ;


//Filters//////////////////////////////////////////////
//Regime Filter - stays out of extreme low volatility
Condition1 = (AvgTrueRange( Length ) / Close * 100)data2>Threshold;
//Trading time Filter - only trade the first three hours of the European session
Condition2 = time is >=starttime and time is <=endtime;

///////////////////////////////////////////////////////
//Bull_Bear Filter - you can try using this one by uncommenting and cutting in the conditions
//Condition3 = the c[1]data2 > average(c,100)data2;
//condition4 = the c[1]data2 < average(c,100)data2;

 
variables:
MaxN_ATR(0) ,
MP( 0 ),
TT( 0 ),
TargetPrice( 0 );

MP = MarketPosition;
TT = TotalTrades;   

    
If condition1 then begin;
//Long Entry
If MP <1 and Condition2  then buy next bar at highest(h,BBS) stop;

//Initial Stop Loss
Setstoploss(SLLE);
//Exit before the close
Setexitonclose;


//Short Entry
If MP > -1 and Condition2 then sell short next bar at lowest(l,BBS) stop;
//Initial Stop Loss

SetStoploss(SLSE);
//Exit before the close
Setexitonclose;


//Trailing Stop
if MP = 1 then
begin
    if TT <> TT[1] or MP[1] <> 1 then
        TargetPrice = EntryPrice + AvgTrueRange( ATRLengthLE )data3 * NumATRsLE;
    if BarsSinceEntry < NumBarsLE then
        Sell ( !( "ATTLX-Tgt" ) ) next bar at TargetPrice limit
    else
        Sell ( !( "ATTLX-Trl" ) ) next bar at Low stop;
    end;
    
    if MP = -1 then
    begin   
        
    if TT <> TT[1] or MP[1] <> -1 then
        TargetPrice = EntryPrice - AvgTrueRange( ATRLengthSE )data3 * NumATRsSE;
    if BarsSinceEntry < NumBarsSE then
        Buy To Cover ( !( "ATTSX-Tgt" ) ) next bar at TargetPrice limit
    else
        Buy To Cover ( !( "ATTSX-Trl" ) ) next bar at High stop;
end;

end;
////////////////////Enjoy!////////////////////////////////////////////////////////


----------



## CanOz

Jeez, who would have thought, slapped the breakout system onto the Bund and boom! IT works, really well....with slippage and commisions.....Lets see if we can break it with more OOS data, surely....


----------



## CanOz

YUP, that broke it....

I didn't optimise it on the intial data series. I merely applied the FDAX strategy to a 2 year period from Jan 2014-2016. This tells me the regime has changed. Can i optimise the first part of that series and see it if holds. In other words, train it on new data, and test it to see if it holds? Otherwise its curve fit.


----------



## CanOz

Alright, given the bund has gone through a regime change (end of QE?) we optimised on a couple of recent years worth of data to see if there is a possibility of a "trained" strategy working on OOS data that is more recent....here is the trained result on two years of "recent"  data.....lets see what happens when we run it right up to date....


----------



## CanOz

Here, as you can see, this strategy is not worth pursuing as it cannot be profitable without heavy optimising.[/ATTACH]


----------



## CanOz

Ok, so given that the last strategy was pretty much a fizzer. I want to start from scratch with an idea i had using the regime type filter, an ATR cross filter. I want to start with this because i had decent probabilities using EOD charts on currencies. This might make a good filter. So what i'm thinking is we use an ATR Cross and then an MA Cross as a trend filter. For exmple, if we get the signal, an ATR cross, we'll take a short right away, apply our trailing stops on a smaller time frame (240, 120 or 60m) and then enter again on a pullback.


----------



## CanOz

We'll then go to a second data series for the trailing stop and then take new entries based on pullbacks of some kind (mean reversion) followed by some kind of momentum, or range expansion....stay tuned...i'm working so this may take a few days!


----------



## CanOz

In regards to the code for my first system, I have found errors in it that mean it tests well, but I don't think it's possible to achieve those results ..... I'll post more soon...just trying to fix it.


----------



## rb250660

Have you switched from TradeStation to AmiBroker CanOz? Or do you use both?


----------



## CanOz

I still use both, just using TS for intraday. I may try and code some for Amibroker, but only EOD strats


----------



## CanOz

For my first paint bar study i've just completed an indicator that uses two normalised ATRs and an RSI to show me where extremes have occured and the market may turn. Enlightful and rewarding experience, i.e. that was fun.


----------



## rb250660

I use bar painting alot to visualise what my code is doing during development. A very helpful technique.


----------



## CanOz

I love how the Bulls clean out the weak bears on the lower low after the initial extreme so consistently in that shot.


----------



## CanOz

My volitility model smells a rat.....Two Index sells and a GC buy


----------



## CanOz

This is an old Strategy i got from a book. I applied it to the Dax after a few optimisations. It hadn't done too well until the last 6 months or so when it climbed out of Drawdown. Good to see it performing again...


----------

