Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, Ayumi), 773 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Price difference between last tick and previous. #471191
02/22/18 10:47
02/22/18 10:47
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
I want to compute the price difference between two ticks (last and previous), but Tick series donīt work. How can I compute this difference in a fast way (latency purposes)?

Thanks and congrats for this fantastic community.

Re: Price difference between last tick and previous. [Re: JRA] #471206
02/23/18 11:38
02/23/18 11:38
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
vars TickSeries;

void tick()
{
shift(TickSeries,priceClose(),30);
var difference = TickSeries[0] - TickSeries[1];
...
}

void run()
{
...
Tickseries = series(priceClose(),-30);
...
}

Re: Price difference between last tick and previous. [Re: jcl] #471210
02/23/18 14:56
02/23/18 14:56
Joined: Oct 2017
Posts: 17
J
JRA Offline OP
Newbie
JRA  Offline OP
Newbie
J

Joined: Oct 2017
Posts: 17
Every time I tried to get tick series I get the 111 error Crash Tick(). No matters how to:

vars Close = series(priceClose(0,10)); //Crash tick() error

vars Change = series(diff(priceClose())); //Crash tick() error

shift(TickSeries,priceClose(),30); //Crash tick() error

I think this is because I can get the last tick price (or close on 0 bar) and the last bar close (time based).

void tick()
{


var LastTick = priceClose();
var LastClose = priceClose(1);
var Difference = LastTick - LastClose;

printf("nPrice A: %f",Difference);

}


void run()
{

BarPeriod = 1./60; // Test
LookBack = 5;
set(TICKS);


}

This code can works if Iīm able to run in HFT mode, but I have errors when When BarPeriod is under 1 sec. Iīm getting the data from MT5 account with the bridge.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1