Download MetaTrader 5

how to specific High[5] in MQL5?

To add comments, please log in or register
LEE Chun Wing
839
LEE Chun Wing  

I want to get the last 5 bar high in MQL5

 how to do it? 

 

THANKS 

Wackena
648
Wackena  
kelly posted  :

I want to get the last 5 bar high in MQL5

 how to do it? 

 

THANKS 

Here are two ways to find previous 5 bar high. Both have not been tested and I hope are correct.

input int PastBars = 5// Number of past bars to find highest bar.
double High[];
double BarHigh=0;       // Highest bar value from PastBars range.

ArraySetAsSeries(High,true);
int copied=CopyHigh(symbol,0,0,PastBars),High);
if(copied>0 && PastBars<copied) BarHigh=High[PastBars];
Print("Highest bar value from previous ",PastBars," bars is ",BarHigh);

Can use following code to find Open, High, Low, Close and Tick_Volume values.

input int PastBars = 5;  // Number of past bars to find highest bar.
double BarHigh = 0;     // Highest bar value from PastBars range.

MqlRates rates[];
ArraySetAsSeries(rates,true);
double copied=0;
copied=CopyRates(Symbol(),0,0,PastBars,rates);
   
if(copied>0)
  {
    double size=fmin(copied,PastBars);
    for(int i=0;i<size;i++)
      {
         If(rates[i].high > BarHigh) BarHigh=rates[i].high;
      }
  }
Print("Highest bar value from previous ",PastBars," bars is ",BarHigh);
LEE Chun Wing
839
LEE Chun Wing  
wackena:

Here are two ways to find previous 5 bar high. Both have not been tested and I hope are correct.

Can use following code to find Open, High, Low, Close and Tick_Volume values.

 

thankyou to wavkena, it seems to be do more in mql5~ ~

Luis Alejandro Diaz Vidal
2897
Luis Alejandro Diaz Vidal  
LEE Chun Wing:

 

thankyou to wavkena, it seems to be do more in mql5~ ~

Absolutly!!!!


this comment was deleting now they are censoring bad comments about MQL5!!

Metaquotes you are just one point to loose client, One minipoint!

The more I learn about MQL5 the more I hate it. And now you are censoring bad comments regarding it. Just started learning the language a week ago and I cant believe how many stupid decisions where made regarding the compatibility and easy access for users of MT4 to the new language.

Horrible!

Learn the lesson and change soon instead of censoring.

Alain Verleyen
Moderator
36733
Alain Verleyen  
Luis Alejandro Diaz Vidal:

Absolutly!!!!


this comment was deleting now they are censoring bad comments about MQL5!!

Metaquotes you are just one point to loose client, One minipoint!

The more I learn about MQL5 the more I hate it. And now you are censoring bad comments regarding it. Just started learning the language a week ago and I cant believe how many stupid decisions where made regarding the compatibility and easy access for users of MT4 to the new language.

Horrible!

Learn the lesson and change soon instead of censoring.

Please stop flooding the forum with your mql5 complaints. Thanks.
Luis Alejandro Diaz Vidal
2897
Luis Alejandro Diaz Vidal  
Alain Verleyen:
Please stop flooding the forum with your mql5 complaints. Thanks.

Alain I have been dealing with MT5 for a week and really its an insult to my eyes, never ever a good replacement for mt4. Are you censoring me? This is the political of the company? Os it agaim the rules to complaint about MT5 now? Dont you see my complaints could open the eyes of someone and save the company? Im not flooding im expressing my opinion, this product is horrible!
Luis Alejandro Diaz Vidal
2897
Luis Alejandro Diaz Vidal  
Do you think Im not interested in a good product for metaquotes? I have been trading with mt4 for a lot is very good program! People love it. MT5 is a failure, I think metaquotes should make a better program than MT4 and is very easily, just have to learn from the errors...
Alain Verleyen
Moderator
36733
Alain Verleyen  
Luis Alejandro Diaz Vidal:

Alain I have been dealing with MT5 for a week and really its an insult to my eyes, never ever a good replacement for mt4. Are you censoring me? This is the political of the company? Os it agaim the rules to complaint about MT5 now? Dont you see my complaints could open the eyes of someone and save the company? Im not flooding im expressing my opinion, this product is horrible!
You should calm down a bit, nobody is censoring you. Are you still able to think logically ? I am asking you to stop digging old topic to post your complaints about mql5/MT5. You have your opinion that's fine, but I will not let you flood the forum with it unless it's on topic.
Luis Alejandro Diaz Vidal
2897
Luis Alejandro Diaz Vidal  
Alain Verleyen:
You should calm down a bit, nobody is censoring you. Are you still able to think logically ? I am asking you to stop digging old topic to post your complaints about mql5/MT5. You have your opinion that's fine, but I will not let you flood the forum with it unless it's on topic.

Yeah i made my point, I thought my comment was deleted, maybe was not I dont know. Anyways my point is very clear by now :p
chukwudi joshua obiekwe
291
chukwudi joshua obiekwe  
Luis Alejandro Diaz Vidal:

Yeah i made my point, I thought my comment was deleted, maybe was not I dont know. Anyways my point is very clear by now :p


@luis they should keep censoring, who have time to learn different language with same old meaning,they keep deleting people post..

I can only improve on my mt4 new code addition,but to learn new language with useless word patches,not me...
To add comments, please log in or register