Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 953 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
Page 2 of 4 1 2 3 4
Re: history data for spy not work ? [Re: faustf] #487593
06/12/23 19:23
06/12/23 19:23
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
but if i remove this how can controll if is monday at 23:58 ???? i want execute this not always

Re: history data for spy not work ? [Re: faustf] #487594
06/12/23 20:46
06/12/23 20:46
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
i modify my script i this mode now return me this error

spx compiling........
Error in 'line 15:
Syntax error: Wrong type NOT:DOUBLE::LONG
< if(RSI2[0] < 30 && !isPositionOpen)
>

var isPositionOpen = 0; // Variabile per tenere traccia dello stato della posizione

function run()
{
set(PARAMETERS+LOGFILE);
//BarPeriod = 1440; // Periodo giornaliero

if(day() == MONDAY && hour() == 23 )
{
// Calcola l'RSI a 2 periodi
vars Price = series(price());
vars RSI2 = series(RSI(Price, 2));

if(RSI2[0] < 30 && !isPositionOpen)
{
enterLong(1);
isPositionOpen = 1; // Imposta lo stato della posizione su aperta
printf("Entered long position");
}
}

if(day() == WEDNESDAY && hour() == 0 && isPositionOpen)
{
exitLong(1);
isPositionOpen = 0; // Imposta lo stato della posizione su chiusa
printf("Exited long position");
}
}

Re: history data for spy not work ? [Re: faustf] #487595
06/12/23 21:21
06/12/23 21:21
Joined: Feb 2017
Posts: 1,726
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,726
Chicago
That’s because isPositionOpen is the wrong type in Lite C. It is a var. Change it to int.

Re: history data for spy not work ? [Re: faustf] #487598
06/13/23 11:38
06/13/23 11:38
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
I think we have a language barrier. You should use 'BarPeriod = 1;' to make your trading rule valid.

Re: history data for spy not work ? [Re: faustf] #487602
06/13/23 19:15
06/13/23 19:15
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
but why not close the first WEDNESDAY after open monday ??? look the result https://ibb.co/w7DHF2k

Re: history data for spy not work ? [Re: faustf] #487603
06/13/23 21:54
06/13/23 21:54
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
My bad, I just saw that you removed 'minute() == 58' from your trading rule in your latest version.

Last edited by Grant; 06/13/23 21:55.
Re: history data for spy not work ? [Re: faustf] #487605
06/14/23 19:24
06/14/23 19:24
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
i insert a minuts , but never operate o_O

int isPositionOpen = 0; // Variabile per tenere traccia dello stato della posizione

function run()
{
set(PARAMETERS+LOGFILE);
//BarPeriod = 1440; // Periodo giornaliero

if(day() == MONDAY && hour() == 23 && minute() == 58)
{
// Calcola l'RSI a 2 periodi
vars Price = series(price());
vars RSI2 = series(RSI(Price, 2));

if(RSI2[0] < 30 && !isPositionOpen)
{
enterLong(1);
isPositionOpen = 1; // Imposta lo stato della posizione su aperta
printf("Entered long position");
}
}

if(day() == WEDNESDAY && hour() == 0 && minute() == 5 && isPositionOpen)
{
exitLong(1);
isPositionOpen = 0; // Imposta lo stato della posizione su chiusa
printf("Exited long position");
}
}

Re: history data for spy not work ? [Re: faustf] #487606
06/15/23 00:07
06/15/23 00:07
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Both Andrew and I already explained you why this is. Please READ those posts again.

Re: history data for spy not work ? [Re: faustf] #487614
06/15/23 19:17
06/15/23 19:17
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
i modify the script in this mode barperiod=1

int isPositionOpen = 0; // Variabile per tenere traccia dello stato della posizione

function run()
{
set(PARAMETERS+LOGFILE);
BarPeriod = 1;

if(day() == MONDAY && hour() == 23 && minute() == 58)
{
// Calcola l'RSI a 2 periodi
vars Price = series(price());
vars RSI2 = series(RSI(Price, 2));

if(RSI2[0] < 30 && !isPositionOpen)
{
enterLong(1);
isPositionOpen = 1; // Imposta lo stato della posizione su aperta
printf("Entered long position");
}
}

if(day() == WEDNESDAY && hour() == 0 && minute() == 5 && isPositionOpen)
{
exitLong(1);
isPositionOpen = 0; // Imposta lo stato della posizione su chiusa
printf("Exited long position");
}
}

but not close in wednesday https://ibb.co/cJcgn0R

Re: history data for spy not work ? [Re: faustf] #487617
06/16/23 20:20
06/16/23 20:20
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
i try to modify the script in this mode
int isPositionOpen = 0; // Variabile per tenere traccia dello stato della posizione

function run()
{
set(PARAMETERS+LOGFILE);
BarPeriod = 60;


if(day() == MONDAY && hour() == 23 )

{
// Calcola l'RSI a 2 periodi
vars Price = series(price());
vars RSI2 = series(RSI(Price, 2));

if(RSI2[0] < 30 && !isPositionOpen)
{
enterLong(1);
isPositionOpen = 1; // Imposta lo stato della posizione su aperta
printf("Entered long position");
}
}

if(day() == WEDNESDAY && hour() == 0 && isPositionOpen)
{
exitLong(1);
isPositionOpen = 0; // Imposta lo stato della posizione su chiusa
printf("Exited long position");
}
}

but nothing not close in WEDNESDAY :(((

Page 2 of 4 1 2 3 4

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1