3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Strange effect with asset() function
[Re: trenki2]
#464082
01/20/17 12:42
01/20/17 12:42
|
Joined: Dec 2016
Posts: 12
worron
OP
Newbie
|
OP
Newbie
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: jcl]
#464168
01/26/17 14:02
01/26/17 14:02
|
Joined: Dec 2016
Posts: 12
worron
OP
Newbie
|
OP
Newbie
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: jcl]
#464284
02/02/17 09:37
02/02/17 09:37
|
Joined: Dec 2016
Posts: 12
worron
OP
Newbie
|
OP
Newbie
Joined: Dec 2016
Posts: 12
|
|
|
|
|