Gamestudio Links
Zorro Links
Newest Posts
Optimize in a ranked asset portfolio
by danatrader. 10/26/20 15:08
Force chart into a y-axis range?
by Kaga. 10/25/20 23:57
Special Bars Script
by atr. 10/25/20 12:30
Tensorflow and Python 32 bit
by gamadeus. 10/25/20 11:39
Close attempts
by jcl. 10/24/20 10:27
GET_TRADES - TRADE array buffer size?
by jcl. 10/24/20 10:25
AUM Magazine
Latest Screens
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
Who's Online Now
8 registered members (Iglarion, AndrewAMD, danatrader, jenGs, kalmar, Janusz, Dooley, SPIRIT777), 462 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
exshifta, mr_T0ma5, AVL, ruins, speech
18529 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Counting Ticks per hour #481628
10/10/20 21:03
10/10/20 21:03
Joined: Mar 2019
Posts: 296
D
danatrader Online OP
Member
danatrader  Online OP
Member
D

Joined: Mar 2019
Posts: 296
Figured seems not that easy to count upTicks vs. downTicks per Bar and reset counter on every new bar.

Surely, continuesly counting is somewhat easy....

function tick()
{
shift(closeTick, priceClose(), 2); // shift the series

if(closeTick[0] > closeTick[1]){
upTick += 1;
return upTick;
}

if(closeTick[0] < closeTick[1]){
downTick += 1;
return downTick;
}
}


Somebody has an idea to approach that?

Re: Counting Ticks per hour [Re: danatrader] #481636
10/11/20 12:08
10/11/20 12:08
Joined: Oct 2017
Posts: 28
Munich
K
kalmar Online
Newbie
kalmar  Online
Newbie
K

Joined: Oct 2017
Posts: 28
Munich
I'm not sure if it will be useful for you, but marketVol() for FXCM delivers Tick frequency: https://www.zorro-trader.com/manual/en/fxcm.htm

Re: Counting Ticks per hour [Re: danatrader] #481641
10/11/20 15:28
10/11/20 15:28
Joined: Mar 2019
Posts: 296
D
danatrader Online OP
Member
danatrader  Online OP
Member
D

Joined: Mar 2019
Posts: 296
Also MT4 seems to deliver that, problem here, only in live, so I have no option to use it in backtesting or development.

Re: Counting Ticks per hour [Re: danatrader] #481643
10/12/20 06:28
10/12/20 06:28
Joined: May 2015
Posts: 319
Czech Republic
G
Grat Offline
Senior Member
Grat  Offline
Senior Member
G

Joined: May 2015
Posts: 319
Czech Republic
i thinking ( from head )

Code

// global var


int tmpCount=0;
int lastHour=0;
int dnTick = upTick = 0;
var lastPrice;

void tick(){
   tmpCount++;     // increment every ticks
  if (lastPrice > priceClose())
    dnTick++;
  else
    upTick++;
...
}

void run(){
    BarPeriod=60;

   if(is(INITRUN)){
      tmpCount=0;
      lastHour=0;
   }

  if(!is(LOOKBACK)){
    // .... this code run every new H1 candle
    // in the dnTick & upTick is tick info from last hour
    ....
    ....
    // -- now reset for newcandle
    lastHour=tmpCount;
    tmpCount=0;
    upTick=0;
    dnTick=0;
    lastPrice=priceClose();
  }
}


in manual:
Quote
In a TMF or tick function, priceClose() returns the last price quote, updated every tick when new price data becomes available. price() returns the price averaged over all received ticks of the current bar so far; therefore it is more 'jaggy' at the begin of the bar when few ticks were received yet, and more smooth towards the end of the bar period. priceHigh() and priceLow() return the highest and lowest price of the current bar so far, so their distance is small at the begin of the bar and wide towards the end.

Last edited by Grat; 10/12/20 06:36.
Re: Counting Ticks per hour [Re: danatrader] #481644
10/12/20 07:52
10/12/20 07:52
Joined: Oct 2017
Posts: 28
Munich
K
kalmar Online
Newbie
kalmar  Online
Newbie
K

Joined: Oct 2017
Posts: 28
Munich

Re: Counting Ticks per hour [Re: danatrader] #481645
10/12/20 08:09
10/12/20 08:09
Joined: May 2015
Posts: 319
Czech Republic
G
Grat Offline
Senior Member
Grat  Offline
Senior Member
G

Joined: May 2015
Posts: 319
Czech Republic
This python script make candles from ticks CSV file. But this is old way, now is better use the Pandas ( ohlc fce ).

I thinking first question not howto convert tick to candles but how many times tick go up/dn during H1 candle


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