Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (ozgur, Ayumi, VHX, monarch), 1,161 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
I know someone can help me, I wish once I get the trigger to buy #487064
01/07/23 23:05
01/07/23 23:05
Joined: Mar 2021
Posts: 24
A
antoniorenar Offline OP
Newbie
antoniorenar  Offline OP
Newbie
A

Joined: Mar 2021
Posts: 24
int minutesToTime(int pMinutes)
{
int hora=(int) (pMinutes/60);//Ejemplo con pMinutes=916 min. >> Parte entera de 916/60=Parte entera de 15.27=15 h.
int minutos=pMinutes-60*hora;//Ejemplo con pMinutes=916 min. >> 916-60*15=16 min.

return 100*hora+minutos;//Ejemplo con pMinutes=916 min. >> 100*15+16=1500+16=1516 >> 15:16 h.
}
var objective()
{
if(NumWinTotal+NumLossTotal < 30) return 0.; //Exigimos un mínimo de 30 trades
return (WinTotal-LossTotal)/max(1,DrawDownMax);
}
function run()
{

set(LOGFILE);
set(PARAMETERS);

setf(PlotMode,PL_BENCHMARK+PL_FINE);

set(BALANCE);

setf(TrainMode,GENETIC+TRADES);

set(TESTNOW);

set(PLOTNOW);

assetList("AssetsAntonio");

StartDate=20200101;
EndDate=20210312;

BarPeriod = 15;//BARRAS DE 15 MINUTOS
LookBack = 1;//EQUIVALENTE A MAXBARSBACK DE TS

NumWFOCycles = -10;//Hacemos 5 optimizaciones (o ciclos) en Walk Forward

DataSplit = 60; //El 60% de los datos usados en cada ciclo son in-sample (el 40% restante, out-of-sample)

NumCores = -1;//PONER UN VALOR NEGATIVO PARA QUE UTILICE TODOS LOS NÚCLEOS MENOS EL NÚMERO QUE PONGAMOS

int /*BarraSemanalEntrada = optimize(409, 1,480,2)*/ BarraSemanalEntrada=409,
/*BarrasParaSalir = optimize(33, 1,480,2)*/ BarrasParaSalir=33;

int BarrasDentroDeUnDia=1, DiaSemanaEntra=1, NoBarraMinutosEntra=1, HoraEntrada=0;


BarrasDentroDeUnDia= 24*60/BarPeriod;
DiaSemanaEntra= (int)(BarraSemanalEntrada/BarrasDentroDeUnDia) + 1 ;
NoBarraMinutosEntra= BarraSemanalEntrada-BarrasDentroDeUnDia*(DiaSemanaEntra-1);
HoraEntrada= minutesToTime(NoBarraMinutosEntra*BarPeriod);

for(listed_assets)

{
asset(Asset);

Spread = marketVal(0); //marketVal RETORNA EL SPREAD PROMEDIO DE LA BARRA 0

//ENTRADA:
if( tod(0)==HoraEntrada and (TradeIsClosed or TradeIsLong) and dow(0)==DiaSemanaEntra )
{
//LOTES:
Lots = 1;//PARECE SER QUE ZORRO NO DEJA PONER MENOS DE 1 LOTE
If( asset("EUR/CAD") || asset("GBP/USD") ) enterShort();
If( asset("USD/JPY") || asset("GBP/CAD") ) enterLong();
}
//SALIDA POR TIEMPO:
if( TradeIsOpen and TradeIsShort and TradeBars >= BarrasParaSalir ) exitShort();
if( TradeIsOpen and TradeIsLong and TradeBars >= BarrasParaSalir ) exitLong();

}


I know someone can help me, I wish once I get the trigger to buy in some markets and sell in others I get this error

ANTONIO_ESTACIONAL_DIVISAS compiling........
Error in 'line 67:
'If' undeclared identifier
< If( asset("EUR/CAD") || asset("GBP/USD") ) enterShort();
>.


[img]https://lh3.googleusercontent.com/d...rzJtNnoUWT4fCS_M5fr0aCcVp3J5g=w1919-h974[/img]


Last edited by antoniorenar; 01/07/23 23:10.
Re: I know someone can help me, I wish once I get the trigger to buy [Re: antoniorenar] #487066
01/08/23 05:10
01/08/23 05:10
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
Lite-C is case-sensitive. It does not know what “If” is but knows what “if” is.

Re: I know someone can help me, I wish once I get the trigger to buy [Re: antoniorenar] #487087
01/14/23 23:21
01/14/23 23:21
Joined: Mar 2021
Posts: 24
A
antoniorenar Offline OP
Newbie
antoniorenar  Offline OP
Newbie
A

Joined: Mar 2021
Posts: 24
Really true Andrew it works


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1