Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Imhotep, opm), 785 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Strange effect with asset() function #464066
01/19/17 14:54
01/19/17 14:54
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
Hi,
When optimizing my script i faced the following weird issue:
The system shows different testing results depending on the way the currency pair is set. If it is set in concole form - one result, if it is set by calling asset() in script code - another result. As if in this case the price data is taken from some other source..(see screenshots attached). In both cases first i perform training and then testing. Could you explain what i do wrong?
Thanks in advance.

Attached Files
Screenshot_1.png (16 downloads)
Screenshot_2.png (11 downloads)
Re: Strange effect with asset() function [Re: worron] #464077
01/20/17 10:22
01/20/17 10:22
Joined: Aug 2016
Posts: 95
Wien
T
trenki2 Offline
Junior Member
trenki2  Offline
Junior Member
T

Joined: Aug 2016
Posts: 95
Wien
It might be usefull if you could post a minimal example code that can reproduce this behaviour so anyone can test and verify. Without code its really hard.

Re: Strange effect with asset() function [Re: trenki2] #464082
01/20/17 12:42
01/20/17 12:42
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
Hi, here is the code, which is simply the copy of workshop 7 with slight changes:

#include <profile.c>

function run()
{

MaxBars = 4320; //half a year
BarPeriod = 60; // H1
Weekend = 1; // don't merge Friday and Sunday bars
LookBack = 3; // only 3 bars needed
NumWFOCycles = 13;
Capital = 1000;
asset("USD/JPY");

set(RULES+FACTORS+TESTNOW);

if(Train) Hedge = 2; // for training, allow long + short

if(ReTrain) {
UpdateDays = -1;
SelectWFO = -1;
reset(FACTORS); // don't re-train factors
}
//
Margin = 0.5 * OptimalF * Capital * sqrt(1 + ProfitClosed/Capital);


if(adviseLong(PATTERN+2,0,
priceHigh(2),priceLow(2),priceClose(2),
priceHigh(1),priceLow(1),priceClose(1),
priceHigh(1),priceLow(1),priceClose(1),
priceHigh(0),priceLow(0),priceClose(0)) > 50)
reverseLong(1);

if(adviseShort() > 40)
reverseShort(1);

}

If you comment the line with asset(...) and set the pair in list box of console you`ll receive different result.

Re: Strange effect with asset() function [Re: worron] #464084
01/20/17 12:57
01/20/17 12:57
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
The results will be most likely the same, but the training files have different names dependent on whether it's a portfolio system with "asset" calls, or not. So make sure that you're using the right files.

Re: Strange effect with asset() function [Re: jcl] #464168
01/26/17 14:02
01/26/17 14:02
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
Hi,
I encountered another issue with asset(). The following code does not cause error messages in train mode until asset() is called (if it is commented), and a pair is selected in the listbox. When called the message "Error 030 - Check lookback, settings, asset order" appear.

#include <profile.c>

function run()
{
StartDate = 2016;
EndDate = 2017;
BarPeriod = 60; // 1 day
LookBack = 0; //
NumWFOCycles = 10;

asset("AUD/USD");

set(RULES+PARAMETERS+TESTNOW);

if(Train) Hedge = 2;

Stop = 3*ATR(5);
Trail = optimize(13,8,55);
TrailLock = 1;
TrailSlope = 50;



LookBack = 3; // only 3 bars needed
if(adviseLong(PATTERN+2,0,
priceHigh(2),priceLow(2),priceClose(2),
priceHigh(1),priceLow(1),priceClose(1),
priceHigh(1),priceLow(1),priceClose(1),
priceHigh(0),priceLow(0),priceClose(0)) > 40)
reverseLong(1);

if(adviseShort() > 40)
reverseShort(1);

PlotWidth = 600;
PlotHeight1 = 300;
}

Here i set LookBack to 0 at the beginning to avoid problrms with calling ATR() and then change to 3 to set the number of candels for advise algorithm as mentioned in Workshop 7. Why that cease to work because of calling asse()?
Thanks in advance

Re: Strange effect with asset() function [Re: worron] #464194
01/27/17 14:28
01/27/17 14:28
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
Just as the error message says: You must set the lookback period before you can load the asset.

Re: Strange effect with asset() function [Re: jcl] #464284
02/02/17 09:37
02/02/17 09:37
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
Thanks! Got it finally)

Re: Strange effect with asset() function [Re: worron] #464304
02/03/17 13:41
02/03/17 13:41
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
Hi, I hurried a bit to admit the issue solved. The problem is i can`t use in the same script ATR and adviseLong/Short because they need different LookBack values. In my case adviseLong/Short needs value 3 which is the number of bars in pattern, and ATR needs much more. First i change the value to suit ATR and after calling it i change the value to 3 for adviseLong/Short. But in this case Zorro returns error 030 (though LookBack-settings-asset sequense seems to be right).
Here is the code fragment (the whole text is similar to above posted):

LookBack = 500 (or 0);
NumWFOCycles = 10;

set(RULES+TESTNOW);
asset("EUR/USD");
Stop = 2*ATR(3);

LookBack = 3;
if(adviseLong(PATTERN+2,0,....

What is wrong here? How can i set a marketaware stop loss in case of using machine learning algo?

Re: Strange effect with asset() function [Re: worron] #464342
02/06/17 18:25
02/06/17 18:25
Joined: Jul 2000
Posts: 27,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
Frankfurt
A variable can not be 3 and 500 at the same time, so use the higher value.

Re: Strange effect with asset() function [Re: jcl] #464376
02/08/17 09:53
02/08/17 09:53
Joined: Dec 2016
Posts: 12
W
worron Offline OP
Newbie
worron  Offline OP
Newbie
W

Joined: Dec 2016
Posts: 12
And then how AdviseLongShort will know that it should use 3(in this case) bars pattern for analysis? Or is 3 const value?

Page 1 of 2 1 2

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