So like this?
double H4_close_price = 0; H4_close_price = iClose(NULL, PERIOD_H4, 1); if(Close[H4_close_price] > Hour4_60);
DomGilberto:
So like this?
So like this?
if(Close[H4_close_price] > Hour4_60);
no, ......... H4_close_price can't used this way it is not integer
I assume Hour4_60 represents a price, correct?
If so, your code would look like:
double H4_close_price = 0; H4_close_price = iClose(NULL, PERIOD_H4, 1); // <---this gives you the close price of the previous 4-hour bar if (H4_close_price > Hour4_60) { // <---this is true when H4_close_price is greater than Hour4_60 // do something }
DomGilberto:
Whats the purpose of "double H4_Close_Price = 0"?
Why could I not just do "double H4_close_price = iClose(NULL, PERIOD_H4, 1);" ?
Some people ( like me ) prefer to declare their variables in one place at the start of the function and in some cases explicitly set the initial value. It's mostly, but not completely, personal preference.
Whats the purpose of "double H4_Close_Price = 0"?
Why could I not just do "double H4_close_price = iClose(NULL, PERIOD_H4, 1);" ?
Ok thanks for your help again guys :)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey All :)
New quicker question this time! How can I tell "Close[1]" to be focusing on the 4 hour time frame, irrespective of the time frame I am currently looking at?
Many thanks as usual!