Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Having trouble getting Stop to work the way I expect #426858
07/30/13 20:51
07/30/13 20:51
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I'm still struggling with a very basic use of Stop. I'm sure this is just something stupid I'm doing, due to my ignorance of lite-C scripting. I've simplified this example way down, and I still can't get a basic Stop to act proper. What am I doing wrong here?

Here is the very basic script (note, it's not supposed to be profitable, I just threw it together for example purposes):
Code:
function run()
{
	set(PARAMETERS+NFA);
	BarPeriod = 240;
	StartDate = 2012;
	LookBack = 500;

	vars Price = series(price());
	var EMAfast = optimize(5,3,10);
	var EMAslow = optimize(14,7,30);
	Stop = optimize(10,5,20) * ATR(100);
	
	if ( EMA(Price,EMAfast) > EMA(Price,EMAslow) ) enterLong();
	else enterShort();
	
	PlotWidth = 1000;
	PlotHeight1 = 600;
}



What I'm confused about is certain pairs like AUDUSD where it seems to not honor the Stop. Other pairs like EURUSD seem to be fine. See attached screenshots. I don't understand why some pairs work and others don't.

THANKS for any tips. I'm definitely a n00b!

Attached Files
Re: Having trouble getting Stop to work the way I expect [Re: dusktrader] #426861
07/30/13 21:24
07/30/13 21:24

A
acidburn
Unregistered
acidburn
Unregistered
A



For AUDUSD your stop parametar gets optimized to 17.5 * ATR(100). That's a pretty wide stop that rarely gets hit. But, optimizer picks it because you get the best profitability that way. Try with closer stops, it should help.

Also, your optimize space for EMAfast and EMAslow overlaps. That will also enable optimizer to pick a set where EMAfast is slower of EMAslow, and turn your nice little trend following strategy upside down to do mean reversion. Or do some even nastier combinations like picking very close values for EMA periods and produce some interesting results, just to make you happy. wink

Unfortunately, you can't feed whatever you want to the optimizer, because it then gets ideas of it's own, as you can see. wink Been there, done that, decided to stay away from optimizer until I can get profitable WITHOUT it first. Then use it to properly curve f^H^H... err, slightly optimize my already profitable strategy. grin

Re: Having trouble getting Stop to work the way I expect [Re: ] #426886
07/31/13 10:50
07/31/13 10:50
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
I GET IT!! Thanks for explaining that so well, and for the tips about the overlap! grin

Using a super simple script like this, I can tinker around and add other snippets to study the different ways Zorro works. The problem is, there so SO MANY snippets of code throughout the manual... it can be overwhelming. Trying to focus on tiny bits at a time. I don't want to skip over something and then have it bite me later!

Re: Having trouble getting Stop to work the way I expect [Re: dusktrader] #426887
07/31/13 10:54
07/31/13 10:54
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
Thank you also acid. We are not so many here at the forum so every help is fantastic.
When i will find a strategy to program, i will remember this part also. :-)


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