Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
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