Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (VoroneTZ, monk12, Quad), 829 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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,977
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,977
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