Download MetaTrader 5

MQL4: tick count for each 10 last bars - how to do this using MQL syntax ?

To add comments, please log in or register
Do you have Linux? Find out how to install MetaTrader on it!
Piotr
1249
Piotr 2011.04.09 15:24 

Hi,


I would like to count every tick for each 10 last bars (with the current bar) in PERIOD_M1. How to do it using MQL syntax ?


I would like to get the following results:


bar 0 (ticks counted: for example 25)

bar 1 (ticks counted: 58)

bar 2 (ticks counted: 28)

bar 3 (ticks counted: 37)

bar 4 (ticks counted: 22)

bar 5 (ticks counted: 3)

bar 6 (ticks counted: 13)

bar 7 (ticks counted: 47)

bar 8 (ticks counted: 21)

bar 9 (ticks counted: 18)


Have you any idea ?


Regards,

Ian Venner
2584
Ian Venner 2011.04.10 02:30  

use series array Volume[] to get the volume for each bar.

Piotr
1249
Piotr 2011.04.11 20:00  
SDC:

use series array Volume[] to get the volume for each bar.


Hi SDC,

Can I please any example for my idea using series array Volume[] ?

Rgds,

Puncher

Ickyrus
872
Ickyrus 2011.04.12 13:05  

Number of ticks in a period is recorded as Volume in the internally defined array called Volume[shift]

for(int i=9;i>=0;i--){ TotVol=TotVol+Volume[i] }

Piotr
1249
Piotr 2011.04.12 14:34  
Ickyrus:

Number of ticks in a period is recorded as Volume in the internally defined array called Volume[shift]

for(int i=9;i>=0;i--){ TotVol=TotVol+Volume[i] }



Hi Ickyrus,


Thank you for the answer but ...

What about if I would like to get price of each tick in the current bar?

What mql syntax should I use in order to get history tick prices and current tick's price in the current bar ?

Is it possible under Meta Trader 4 ?

rv
461
rv 2011.04.12 14:48  
puncher:


Hi Ickyrus,


Thank you for the answer but ...

What about if I would like to get price of each tick in the current bar?

What mql syntax should I use in order to get history tick prices and current tick's price in the current bar ?

Is it possible under Meta Trader 4 ?



history tick price you cant get, only the price of the actual tick!

Write to a file or database or stroe them in an array but dint forget, every bar can have a big difference between the count of ticks .. one time only few ticks .. one time hundrets of ticks ...

Ickyrus
872
Ickyrus 2011.04.12 15:54  

Not sure of the truth of what I am about to say, its basically guess work as to how the system works and there are some fine details I am having trouble with.

A broker has a reserve of different currencies that it can sell to you banks etc. Every time a buy or sell of a currency is made the price is adjusted to reflect this action as per the standard supply and demand rules of economics. The tick data reflects that someone somewhere bought or sold currency including yourself. Hence the difference between a Demo account and a real trading account and why EA's if sold in large quantities fail. There some questions as wether a tick is sent only after a full standard lot of 1.00 has been traded or variations on this theme. I have strong evidence that when I trade in very low volume times like just before the weekend close, that the market reacts to the trade. Not sure how keeping the price data of each tick is going to help when what we are studying is human behaviour in general.

Mike Schmitt
47
Mike Schmitt 2011.04.14 14:18  

can someone help me edit sar ohlc to use heiken ashi ohlc

Hi, I have an MTF indicator that uses sar, however I'd like the sar to calculate heiken ashi ohlc, and not the normal type

Can you tell me how I can do this, my mtf indicator calls to the sar indicator to calculate sar formula, I think it is calling to the internal indicator in mt4 that can not edit

you can skype or email if you can assist and like to talk about it

skype sty671

email sty671@gmail.com

I can also supply the original file that I'm trying to use heiken ashi ohlc for

vinoth
4
vinoth 2011.05.12 14:27  
hi.....can any one know how to get the current tick value of a bar?........can any one help me
whroeder1
14489
whroeder1 2011.05.12 16:30  
puncher:
I would like to count every tick for each 10 last bars (with the current bar) in PERIOD_M1. How to do it using MQL syntax ?
I would like to get the following results:
bar 0 (ticks counted: for example 25)
bar 1 (ticks counted: 58)
bar 2 (ticks counted: 28)
bar 3 (ticks counted: 37)
bar 4 (ticks counted: 22)
bar 5 (ticks counted: 3)
bar 6 (ticks counted: 13)
bar 7 (ticks counted: 47)
bar 8 (ticks counted: 21)
bar 9 (ticks counted: 18)
string cmnt="";
for (int shift=0; shift < 10; shift++){
    cmnt=StringConcatenate(cmnt, "bar ",shift," (ticks counted: ", Volume[shift],")\n");
}
Comment(cmnt);
whroeder1
14489
whroeder1 2011.05.12 16:35  
vinstar_05:
hi.....can any one know how to get the current tick value of a bar?........can any one help me
Comment("Current tick Ask=",DoubleToStr(Ask,Digits)," Bid=",DoubleToStr(Bid,Digits));
Don't hijack other peoples threads.
12
To add comments, please log in or register