1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485552
03/23/22 08:29
03/23/22 08:29
|
Joined: Feb 2018
Posts: 69
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 69
|
Hello, I have already trained both models. I will try wtih support but wanted to use the forum so probably more people can get the idea and may be useful for future questions. I don´t want to train two models again. What I´m trying is to "ensemble" or use both models at the same time for Test/Trade. No more training is needed. If I test/trade each single strategy with its model, works fine. The problem is to have two different Long signals to enter/not enter the trade. I´m not sure if I´m explaining well what I´m looking for. vLong = adviseLong(NEURAL+BALANCED,0, change(1),change(2),change(3),change(4), range(1),range(2),range(3),range(4)); Retuns a "var" value. vLong1= adviseLong(NEURAL+BALANCED,0, change(1),change(2),change(3),change(4), range(1),range(2),range(3),range(4));
Retunrs the same "var" value if I use the same model (.ml file) but if I use a different model (different .ml file) is a different value So I want to use those different values ( vLong and Vlong1) to enter or not a trade. ¿Have I explain well what I´m trying to do? Thank you for your help.
Last edited by tomaslolo; 03/23/22 08:30.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485567
03/25/22 10:04
03/25/22 10:04
|
Joined: Feb 2018
Posts: 69
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 69
|
Hello again, I´m back! Script adapted to what I´m trying: // WDL6 trying to make it work ///////////////////
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 tradeUNO()
{
if(Init) print(TO_WINDOW,"\nR and Keras required");
Script = "DeepLearnKeras1";
bool sube1=false;
bool baja1=false;
var Threshold1 = 0.5;
var vLong1,vShort1;
if (vLong1 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold1)
return sube1=true;
if (vShort1 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold1)
return baja1=true;
}
function tradeDOS()
{
if(Init) print(TO_WINDOW,"\nR and Keras required");
Script = "DeepLearnKeras2";
bool sube2=false;
bool baja2=false;
var Threshold2 = 0.5;
var vLong2,vShort2;
if (vLong2 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold2)
return sube2=true;
if (vShort2 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold2)
return baja2=true;
}
function run()
{
NumCores = -2; // use multiple cores (Zorro S only)
StartDate = 20170101;
EndDate= 20190101;
BarPeriod = 1440; // 1 hour
LookBack = 100;
assetList("AssetsDarwinexFMB");
asset("EUR/USD");
set(RULES);
LifeTime=3;
while(algo(loop("TRND","CNTR")))
{
if(Algo == "TRND")
tradeUNO();
else if(Algo == "CNTR")
tradeDOS();
}
if(sube1 and sube2) // <<<----- THIS IS LINE 96
enterLong();
if(baja1 and baja2)
enterShort();
PlotWidth = 600;
PlotHeight1 = 300;
} As you may see, I want to enterLong if both conditions "sube1" and "sube2" are true. Same for enterShort with "baja1" and "baja2" Problems: 1.- I´m not sure how "sube1, sube2, baja1 and baja2" returned values (true/false) can be red inside run() function. WDL6 compiling........ Error in 'line 96: 'sube1' undeclared identifier < if(sube1 and sube2)>.
Last edited by tomaslolo; 03/25/22 11:23.
|
|
|
Re: Use 3 zorros, one for trading the other two for calculating
[Re: tomaslolo]
#485568
03/25/22 10:23
03/25/22 10:23
|
Joined: Feb 2018
Posts: 69
tomaslolo
OP
Junior Member
|
OP
Junior Member
Joined: Feb 2018
Posts: 69
|
If I "declare" bool sube1, sube2, sube3 and sube4 if solves previous issue but then: Problem 2: Can't go to FALSEGOTO:DOUBLE:: ---> Why is this error? I´m trying to obtain a true statement if a condition is true. WDL6 compiling......... Error in 'line 29: Syntax error: Can't go to FALSEGOTO:DOUBLE::. < range(1),range(2),range(3),range(4))>Threshold1) // line 28 > This is same script with sube1, sube2, baja1 and baja2 declared: // WDL6 trying to make it work ///////////////////
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 tradeUNO()
{
if(Init) print(TO_WINDOW,"\nR and Keras required");
Script = "DeepLearnKeras1";
bool sube1=false;
bool baja1=false;
var Threshold1 = 0.5;
var vLong1,vShort1;
if (vLong1 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold1) // line 28
// line 29
return sube1=true; // line 30
if (vShort1 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold1)
return baja1=true;
}
function tradeDOS()
{
if(Init) print(TO_WINDOW,"\nR and Keras required");
Script = "DeepLearnKeras2";
bool sube2=false;
bool baja2=false;
var Threshold2 = 0.5;
var vLong2,vShort2;
if (vLong2 = adviseLong(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold2)
return sube2=true;
if (vShort2 = adviseShort(NEURAL+BALANCED,0,
change(1),change(2),change(3),change(4),
range(1),range(2),range(3),range(4))>Threshold2)
return baja2=true;
}
function run()
{
NumCores = -2; // use multiple cores (Zorro S only)
StartDate = 20170101;
EndDate= 20190101;
BarPeriod = 1440; // 1 hour
LookBack = 100;
assetList("AssetsDarwinexFMB");
asset("EUR/USD");
set(RULES);
LifeTime=3;
bool sube1=false; [color:#FF0000]// DECLARED HERE TOO SO THERE´S NO ERROR MESSAGE[/color]
bool baja1=false;
bool sube2=false;
bool baja2=false;
while(algo(loop("TRND","CNTR")))
{
if(Algo == "TRND")
tradeUNO();
else if(Algo == "CNTR")
tradeDOS();
}
if(sube1 and sube2)
enterLong();
if(baja1 and baja2)
enterShort();
PlotWidth = 600;
PlotHeight1 = 300;
} Thank you
Last edited by tomaslolo; 03/25/22 11:23.
|
|
|
|