Gamestudio Links
Zorro Links
Newest Posts
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
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,086 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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,729
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,729
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