Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (1 invisible), 672 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Issue zorro ? #475762
01/07/19 10:54
01/07/19 10:54
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37
Hello
I have a code that works only with function tick(open/close trades) but when i change the barperiod the results are different.
I don.t understand the reason if i only use the tick function.

I have the flag TICKS


The code:
int timezone = WET;



int profit(){
if(TradeIsOpen and (TradeProfit/TradeUnits/PIP < -50)){exitTrade();}
if(TradeIsOpen and (TradeProfit/TradeUnits/PIP >4)){exitTrade();}
return 0;
}

function tick(){
if(lhour(timezone) == 7 && minute(timezone)==0) { enterShort(profit);}
if(lhour(timezone) == 13 && minute(timezone)==0){ exitShort(); }
// printf("ntick %f",priceClose());
}

function run() {
set(PLOTNOW+PARAMETERS+TICKS);
StartDate = 20180101;
EndDate = 20180301;
BarPeriod = 60;




Any idea?

Thank in advance

Last edited by sdelatorre; 01/07/19 14:29.
Re: Issue zorro ? [Re: sdelatorre] #475763
01/07/19 11:34
01/07/19 11:34
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
Post code

Re: Issue zorro ? [Re: Dalla] #475765
01/07/19 14:29
01/07/19 14:29
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37


The code, if you change f.i barperiod=30, same entries different values:

int timezone = WET;
int profit(){
if(TradeIsOpen and (TradeProfit/TradeUnits/PIP < -50)){exitTrade();}
if(TradeIsOpen and (TradeProfit/TradeUnits/PIP >4)){exitTrade();}
return 0;
}

function tick(){
if(lhour(timezone) == 7 && minute(timezone)==0) { enterShort(profit);}
if(lhour(timezone) == 13 && minute(timezone)==0){ exitShort(); }
// printf("ntick %f",priceClose());
}

function run() {
set(PLOTNOW+PARAMETERS+TICKS);
StartDate = 20180101;
EndDate = 20180301;
BarPeriod = 60;

Re: Issue zorro ? [Re: sdelatorre] #475771
01/07/19 17:03
01/07/19 17:03
Joined: Feb 2017
Posts: 369
D
Dalla Offline
Senior Member
Dalla  Offline
Senior Member
D

Joined: Feb 2017
Posts: 369
Why did you put your entry/exit inside tick() instead of just run?

Re: Issue zorro ? [Re: Dalla] #475804
01/08/19 15:09
01/08/19 15:09
Joined: Apr 2018
Posts: 37
S
sdelatorre Offline OP
Newbie
sdelatorre  Offline OP
Newbie
S

Joined: Apr 2018
Posts: 37

Hello Dalla,

because i want to check every tick....i did test inside run, but the result is different if I change the barperiod too.....


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1