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
4 registered members (dr_panther, Quad, AndrewAMD, 7th_zorro), 945 guests, and 2 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 3 of 4 1 2 3 4
Re: history data for spy not work ? [Re: faustf] #487618
06/17/23 23:50
06/17/23 23:50
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
All of your script proposals contain many bugs, but right now I'm referring to your versions with the minute() rules:

- When using series(), always use them in the beginning of your run() function, NOT after an if-statement.
- day() refers to day of the month, see https://zorro-project.com/manual/en/month.htm. In your case you should use dow().
- isPositionOpen is declared as integer, but you're using it as a boolean in your if-statements.
- When printing something to the console, use a new line, so this means starting with '\n'.
- When closing a postion, simply use 'exitLong()'

Remark: there's no need to define the value 'isPositionOpen = 0' in the beginning, since '0' is already the default value.

Here's the fixed code:

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

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

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

if(dow() == 1 && hour() == 23 && minute() == 58)
{

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

if(dow() == 3 && hour() == 0 && minute() == 5 && isPositionOpen == 1)
{
exitLong();
isPositionOpen = 0; // Imposta lo stato della posizione su chiusa
printf("\nExited long position");
}
}

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

Joined: Jun 2016
Posts: 49
thanks so much now is clear thanks you so much

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

Joined: Jun 2016
Posts: 49
why if i chabge if(dow() == 5 && hour() == 0 && minute() == 5 && isPositionOpen == 1) choice (dow() == 5 but close a operation many month after

https://ibb.co/BjXqhKr

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

Joined: Aug 2017
Posts: 294
Netherlands
So as a closing rule, right? Simply because it can take some time before all criteria are met.

I've tested your rule on the EUR/USD and I see plenty of trades

Quote
Name,Type,Asset,ID,Lots,Open,Close,Entry,Exit,Profit,Roll,ExitType
faust,Long,EUR/USD,1927593,1,2019-01-21 23:58,2019-01-25 00:05,1.136950,1.130732,-6.40,-0.20,Sold
faust,Long,EUR/USD,3329733,1,2019-02-04 23:58,2019-02-08 00:05,1.143615,1.133903,-9.88,-0.20,Sold
faust,Long,EUR/USD,4028803,1,2019-02-11 23:58,2019-02-15 00:05,1.127930,1.129540,+1.40,-0.20,Sold
faust,Long,EUR/USD,7531954,1,2019-03-18 23:58,2019-03-22 00:05,1.133663,1.137298,+3.42,-0.20,Sold
faust,Long,EUR/USD,8233324,1,2019-03-25 23:58,2019-03-29 00:05,1.131596,1.122957,-8.81,-0.20,Sold
faust,Long,EUR/USD,8935194,1,2019-04-01 23:58,2019-04-05 00:05,1.120600,1.122365,+1.56,-0.20,Sold
faust,Long,EUR/USD,9634964,1,2019-04-08 23:58,2019-04-12 00:05,1.125646,1.125946,+0.0969,-0.20,Sold
faust,Long,EUR/USD,10335434,1,2019-04-15 23:58,2019-04-26 00:05,1.130482,1.113237,-17.87,-0.67,Sold
faust,Long,EUR/USD,13822483,1,2019-05-20 23:58,2019-05-24 00:05,1.116894,1.118284,+1.18,-0.20,Sold
...

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

Joined: Jun 2016
Posts: 49
yes but the condition is wendsday at morning must close not is like time

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

Joined: Aug 2017
Posts: 294
Netherlands
You keep changing your training rules. You wrote 'dow() == 5' in your last post, so that means on a Friday. Simply use 'dow() == 3' for Wednesday.

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

Joined: Jun 2016
Posts: 49
i chenged but not close in Wednesday

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

Joined: Aug 2017
Posts: 294
Netherlands
Not sure what you've exactly changed, but I see plenty of closings on Wednesday:

Quote
Name,Type,Asset,ID,Lots,Open,Close,Entry,Exit,Profit,Roll,ExitType
faust,Long,EUR/USD,1927593,1,2019-01-21 23:58,2019-01-23 00:05,1.136950,1.136316,-0.70,-0.07,Sold
faust,Long,EUR/USD,3329733,1,2019-02-04 23:58,2019-02-06 00:05,1.143615,1.140600,-3.07,-0.07,Sold
faust,Long,EUR/USD,4028803,1,2019-02-11 23:58,2019-02-13 00:05,1.127930,1.133254,+5.24,-0.07,Sold
faust,Long,EUR/USD,7531954,1,2019-03-18 23:58,2019-03-20 00:05,1.133663,1.135462,+1.73,-0.07,Sold
faust,Long,EUR/USD,8233324,1,2019-03-25 23:58,2019-03-27 00:05,1.131596,1.127346,-4.30,-0.07,Sold
faust,Long,EUR/USD,8935194,1,2019-04-01 23:58,2019-04-03 00:05,1.120600,1.120275,-0.39,-0.07,Sold
faust,Long,EUR/USD,9634964,1,2019-04-08 23:58,2019-04-10 00:05,1.125646,1.126610,+0.89,-0.07,Sold
faust,Long,EUR/USD,10335434,1,2019-04-15 23:58,2019-04-17 00:05,1.130482,1.128434,-2.11,-0.07,Sold
faust,Long,EUR/USD,11028003,1,2019-04-22 23:58,2019-04-24 00:05,1.125931,1.122101,-3.89,-0.07,Sold


Code
if(dow() == 3 && hour() == 0 && minute() == 5 && isPositionOpen == 1)
...

Re: history data for spy not work ? [Re: faustf] #487650
06/27/23 18:55
06/27/23 18:55
Joined: Jun 2016
Posts: 49
F
faustf Offline OP
Newbie
faustf  Offline OP
Newbie
F

Joined: Jun 2016
Posts: 49
but not close if i look a chart look image https://ibb.co/Q6f7YK9

Re: history data for spy not work ? [Re: faustf] #487651
06/27/23 20:42
06/27/23 20:42
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Different data sets, different outcomes. We're talking in circles here.

Page 3 of 4 1 2 3 4

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1