Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Price action based system #435965
01/16/14 15:52
01/16/14 15:52
Joined: Jul 2013
Posts: 75
R
royal Offline OP
Junior Member
royal  Offline OP
Junior Member
R

Joined: Jul 2013
Posts: 75
Hi guys!
I am trying to implement the strategy presented on today's Mechanical Forex blog: Price action system

This is the code I got so far:

Code:
// http://mechanicalforex.com/2014/01/global-trading-building-a-forex-price-action-based-system-for-the-4-majors.html

function run() 
{

	StartDate = 2002;
	BarPeriod = 1440;
	LookBack = 200;
	NumWFOCycles = 10; // activate WFO, 10 cycles
	

	while(asset(loop("EUR/USD", "GBP/USD", "USD/JPY", "USD/CHF"))){
	

	if(priceClose(9) > priceClose(10) && priceOpen(158) > priceLow(130) && priceClose(156) > priceClose(173)) 
		reverseLong(1);
		Stop = 1.8*ATR(20);
	if(priceClose(9) < priceClose(10) && priceOpen(158) < priceLow(130) && priceClose(156) < priceClose(173)) 
		reverseShort(1);
		Stop = 1.8*ATR(20);
	}
}



For completing the code I need some advice how to implement the following:

Quote:
Note that the system reverses trades on opposite signals so if a system is within a long and it receives a short signal it will close the long and go short. Another important factor is that the system uses a 180% of the 20-ATR stop-loss which is updated whenever a signal in the same direction is received (for those of you with the doubt, adding new positions on new signals in the same direction increases draw downs significantly, much more than it does profits). Another important aspect – if you want to reproduce my tests – is that my data is refactored within the F4 framework to be GMT +1/+2, the refactoring also makes all Monday candles start at 4 and all Friday candles end at 19 (GMT +1/+2 time).


The system seems to be quite interesting in long term trading. (Especially with some additions like OptimalF and equity curve trading, etc.)
So thanks in advance for any tips laugh

Re: Price action based system [Re: royal] #436022
01/17/14 09:34
01/17/14 09:34
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You almost have it, there's only a small mistake in your script - the stop is placed at a wrong line in the code. And remove the "NumWFOCycles" line.

Code:
Stop = 1.8*ATR(20);
if(priceClose(9) > priceClose(10) && priceOpen(158) > priceLow(130) && priceClose(156) > priceClose(173)) 
		reverseLong(1);
if(priceClose(9) < priceClose(10) && priceOpen(158) < priceLow(130) && priceClose(156) < priceClose(173)) 
		reverseShort(1);



- Please do not trade this system live. I'm wondering why Daniel Fernandez, whom I know as a honest and serious trader, is putting up such a nonsense system on his website. There is no way that comparing a price from 173 days ago can produce a useful trade signal.

Such systems happen when people only rely on the outcome of their code generators, and do not think about whether the algorithm really makes sense. Systems like that certainly produce any result in a backtest, but fail miserably in a WFO test.

Re: Price action based system [Re: jcl] #436028
01/17/14 10:44
01/17/14 10:44
Joined: Jul 2013
Posts: 75
R
royal Offline OP
Junior Member
royal  Offline OP
Junior Member
R

Joined: Jul 2013
Posts: 75
In the comments he's saying that
Quote:
The system was mined on 1993-2003 data, 2003 to 2013 is out-of-sample.

But you are right, I also wondered what's the approach in his logic.

Re: Price action based system [Re: royal] #436030
01/17/14 12:19
01/17/14 12:19
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
In fact his test was most likely not out-of-sample. If he mined price patterns that cover hundreds of days, he must have ended up with millions of profitable patterns. When he then selects the single pattern that was most profitable with 2003-2013 data, it's just as in-sample as if he had used that data for mining.

For a real out-of-sample test he had to include all mined patterns in the system.

Re: Price action based system [Re: jcl] #436032
01/17/14 13:03
01/17/14 13:03
Joined: Jan 2014
Posts: 2
D
danielfp Offline
Guest
danielfp  Offline
Guest
D

Joined: Jan 2014
Posts: 2
Hi Guys,

The system was picked up as the top performer from an absolute profit perspective in the 1993-2003 period, there was no data-snooping in the system's selection (otherwise the 2003-2013 period would in-sample as jcl says). It is also worth mentioning that I ended up with 5 systems (R2 > 0.95 in the in-sample region) and all had similar OS results nonetheless.

It is also worth mentioning that the unlikeliness of a correlation does not automatically mean it's spurious. There could be a lag 1000 system that is causally correlated with price action. I will be posting an article about this soon, you'll see that having lag 0 or lag X systems doesn't mean that you cannot be OS successful. There are most probably valid correlations with all sorts of lags , only that those with lag 0 (using data up to the last moment) are the most intuitive. There is no proof that a system with a lag beyond the last closed bar cannot be profitable in the OS.

Thanks a lot for reading my blog guys :o)

Best Regards,

Daniel

PS: As I said on the post I also wouldn't trade this system, as it's statistical characteristics are still quite bad. I would have to improve it a lot before even considering it for live trading.

Last edited by danielfp; 01/17/14 13:05.
Re: Price action based system [Re: danielfp] #436037
01/17/14 14:11
01/17/14 14:11
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Hi David, thanks for your comment!

I can imagine that some algorithms with large lag, like a long term MA crossover, might indeed produce useful signals. But I can really not see any causal connection between a trade today and some singular price patterns from half a year ago. Such an algorithm rather gives me the impression that there may be something wrong with the underlying idea, or possibly some hidden problem with the system generation or testing method. Anyway I'm looking forward to your next article.


Re: Price action based system [Re: jcl] #436038
01/17/14 14:40
01/17/14 14:40
Joined: Jan 2014
Posts: 2
D
danielfp Offline
Guest
danielfp  Offline
Guest
D

Joined: Jan 2014
Posts: 2
Hi Jcl,

I just posted it if you want to take a look here, note that this is a preliminary analysis on EUR/USD daily data. It shows that while small lag systems do have an advantage regarding a probability of OS success, long lag correlations do not constitute a certainty of OS failure (this could be unique to the EUR/USD, I don't know yet).

I also mention how you could potentially have a long term lag that has a causal relationship. For example if a non-speculative market player makes systematic moves across fixed time intervals.

I will run a more complete analysis on this matter and will publish it in a few weeks when it's ready (when I have more data around different symbols and larger numbers across larger/smaller lags). A more complete analysis is needed to really draw some conclusions.

For the global trading strategy, I would indeed be inclined to examine it further. Perhaps this persistent long-lag and long-lived correlation across several symbols is a consequence of something else, that can be expressed in a less odd manner.

Thanks again for visiting my website :o)

Best Regards,

Daniel


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1