0 registered members (),
984
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485539
03/21/22 23:04
03/21/22 23:04
|
Joined: Feb 2018
Posts: 68
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 68
|
I first tried with loop: while(algo(loop("DeepLearnKeras1","DeepLearnKeras2"))){ But only loads DeepLearnKeras2.ml file, no way to load first DeepLearnKeras1.ml so I don´t find the way to load both models in the same script/strategy.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485540
03/21/22 23:09
03/21/22 23:09
|
Joined: Feb 2018
Posts: 68
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 68
|
This is the full code with algo loop: // Deep Learning Test ///////////////////////////////////////////
//#define DO_SIGNALS // generate sample set in Train mode
//#define DEEPNET
//#define H2O
//#define MXNET
#define KERAS
///////////////////////////////////////////////////////////////////////
#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()
{
NumCores = -1;
StartDate = 20170101;
EndDate= 20190101;
BarPeriod = 1440; // 1 hour
LookBack = 100;
//WFOPeriod = 252*24; // 1 year
//DataSplit = 90;
assetList("AssetsDarwinexFMB");
asset("EUR/USD");
set(RULES);
Spread = RollLong = RollShort = Commission = Slippage = 0;
LifeTime = 3;
if(Train) Hedge = 2;
var Threshold = 0.5;
var vLong,vShort,vLong1,vShort1;
///////////////////////////////////////////////////////////
SelectWFO = -1; // use the last WFO cycle for calibrating the neural net
set(LOGFILE|PLOTNOW);
if(Init) print(TO_WINDOW,"\nR1 and Keras required");
while(algo(loop("DeepLearnKeras1","DeepLearnKeras2"))){
if(Algo = "DeepLearnKeras1"){
Script = "DeepLearnKeras1";
vLong = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
vShort = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
}
if(Init) print(TO_WINDOW,"\nR and Keras required");
//Script = "DeepLearnKeras1";
//if (Algo = "DeepLearnKeras2"){
if(Algo = "DeepLearnKeras2"){
Script = "DeepLearnKeras2";
vLong1 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
vShort1 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
}
if (vLong > Threshold
and vLong1 > Threshold )
enterLong();
if(vShort > Threshold
and vShort1 > Threshold)
enterShort();
plot("Long",vLong,NEW|LINE,BLACK);
plot("Short",vShort,NEW|LINE,GREY);
plot("Long1",vLong1,NEW|LINE,BLUE);
plot("Short1",vShort1,NEW|LINE,RED);
}
} If I click Test: DeepLearnK1y2ensemble2 compiling.............. R1 and Keras required R and Keras required R and Keras required Test: DeepLearnK1y2ensemble2 EUR/USD 2017..2019 Assets AssetsDarwinexFMB Load DeepLearnKeras2.ml Loss -4.93$ MI -0.21$ DD 4.93$ Capital 11.30$ Trades 1 Win 0.0% Avg -49.3p Bars 4 AR -22% PF 0.00 SR 0.00 UI 0% R2 0.00 So no way to use both .ml files (DeepLearnKeras1.ml and DeepLearnKeras2.ml). Is there someway to do it? Thank you
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485541
03/21/22 23:35
03/21/22 23:35
|
Joined: Feb 2018
Posts: 68
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 68
|
It doesn´t work this way either: // Deep Learning Test ///////////////////////////////////////////
//#define DO_SIGNALS // generate sample set in Train mode
//#define DEEPNET
//#define H2O
//#define MXNET
#define KERAS
///////////////////////////////////////////////////////////////////////
#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 DL1()
{
var vLong,vShort;
if(Init) print(TO_WINDOW,"\nR DL1 and Keras required");
Script = "DeepLearnKeras1";
vLong = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
vShort = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
return vLong;
return vShort;
}
function DL2()
{
var vLong1,vShort1;
if(Init) print(TO_WINDOW,"\nR DL2 and Keras required");
Script = "DeepLearnKeras2";
vLong1 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
vShort1 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4));
return vLong1;
return vShort1;
}
///////////////////////////////////////////////////////////////////////
function run()
{
NumCores = -1;
StartDate = 20170101;
EndDate= 20190101;
BarPeriod = 1440; // 1 hour
LookBack = 100;
//WFOPeriod = 252*24; // 1 year
//DataSplit = 90;
assetList("AssetsDarwinexFMB");
asset("EUR/USD");
set(RULES);
Spread = RollLong = RollShort = Commission = Slippage = 0;
LifeTime = 3;
if(Train) Hedge = 2;
var Threshold = 0.5;
var vLong,vShort,vLong1,vShort1;
///////////////////////////////////////////////////////////
//SelectWFO = -1; // use the last WFO cycle for calibrating the neural net
set(LOGFILE|PLOTNOW);
while(algo(loop("DeepLearnKeras1","DeepLearnKeras2"))){
if(Algo == "DeepLearnKeras1")
DL1();
if(Algo == "DeepLearnKeras2")
DL2();
if (vLong > Threshold
and vLong1 > Threshold )
enterLong();
if(vShort > Threshold
and vShort1 > Threshold)
enterShort();
plot("Long",vLong,NEW|LINE,BLACK);
plot("Short",vShort,NEW|LINE,GREY);
plot("Long1",vLong1,NEW|LINE,BLUE);
plot("Short1",vShort1,NEW|LINE,RED);
}
} So, I try different things but no success.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485542
03/21/22 23:56
03/21/22 23:56
|
Joined: Aug 2017
Posts: 296 Netherlands
Grant
Member
|
Member
Joined: Aug 2017
Posts: 296
Netherlands
|
Correct, it should be '==' for 'if(Algo =='
Not sure why it's still not working with the algo loop defined. I would suggest to include some printf() checks for conditions & values.
Last edited by Grant; 03/22/22 00:49.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485544
03/22/22 11:11
03/22/22 11:11
|
Joined: Feb 2018
Posts: 68
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 68
|
Prints DLK1y2ensemble3 compiling............... R DL1 and Keras required R DL2 and Keras required Test: DLK1y2ensemble3 EUR/USD 2017..2019 Assets AssetsDarwinexFMB Load DeepLearnKeras2.ml So runs through function DL1() and function DL2() but only loads DeepLearnKeras2.ml. Anyway even loading DeepLearnKeras2.ml, vLong1 and vLong2 does not return any values. So I´m stucked trying to make it work.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485546
03/22/22 12:03
03/22/22 12:03
|
Joined: Feb 2018
Posts: 68
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 68
|
Yes I can: DLK1y2ensemble3 compiling.............. R DL1 and Keras required Test: DLK1y2ensemble3 EUR/USD 2017..2019 Assets AssetsDarwinexFMB Load DeepLearnKeras1.ml But does not returns any value for vLong and vShort either. Can´t figure out how to make advise function run twice with different .ml files (keras). Any idea???
|
|
|
|