Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
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
0 registered members (), 649 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Baklazhan, Hanky27, firatv, wandaluciaia, Mega_Rod
19052 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Machine Learning calculate and perform only at certain times #462992
11/10/16 02:39
11/10/16 02:39
Joined: Nov 2016
Posts: 3
B
Beauey Offline OP
Guest
Beauey  Offline OP
Guest
B

Joined: Nov 2016
Posts: 3
Hi JCL and Co,
Thanks for your help in advance. I have added a time definition to the machine learning strategy in hopes it will only take in data only on the london session, however upon backtesting it is returning exactly the same results before. Leading me to think this isn't working properly.
Here is the code, please let me know if this is right-

Quote:
///////////////////////////////////////////////////////////////////////
#include <r.h>

var change(int n)
{
return scale((priceClose(0) - priceClose(n))/priceClose(0),100)/100;
}

var range(int n)
{
return scale((HH(n) - LL(n))/priceClose(0),100)/100;
}

///////////////////////////////////////////////////////////////////////

function run()
{
StartDate = 20140601;
BarPeriod = 60; // 1 hour
LookBack = 100;

WFOPeriod = 252*24; // 1 year
DataSplit = 90;
NumCores = -1;

set(RULES|LOGFILE|TESTNOW|PLOTNOW);
Spread = RollLong = RollShort = Commission = Slippage = 0;
LifeTime = 3;
if(Train) Hedge = 2;
Trail = optimize(4,2,20) * ATR(50);

///////////////////////////////////////////////////////////
// skipping bars for a certain time period
static int BarsMissing = 0;
if(hour() >= 1600 and hour() <= 900) // 0 when the current bar has no price quotes
{
TimeFrame = 0; // set to zero when not in frame
BarsMissing++;
}
else if (hour() == 900 and minute() == 0 )
{
TimeFrame = -BarsMissing; // set TimeFrame to the negative number of skipped bars for ending the frame
BarsMissing = 17;
}
else
TimeFrame = 1; // Normal operation

{
if(adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4)) > 0.5)
enterLong();
if(adviseShort() > 0.5)
enterShort();
}

PlotWidth = 800;
PlotHeight1 = 340;
ColorUp = ColorDn = ColorWin = ColorLoss = 0;
}

Re: Machine Learning calculate and perform only at certain times [Re: Beauey] #462994
11/10/16 07:32
11/10/16 07:32
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I give you two hints: which number is bigger than sixteen and smaller than nine? And when does the clock strike sixteenhundred?



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