Forum on trading, automated trading systems and testing trading strategies
When you post code please use the CODE button (Alt-S)!
Thank you.
Sergey Golubev:
will do sorry
Ok looks like I got it figured out. Just had to declare the values with different shifts. currenthigh, previoushigh.
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
Hi,
So I am a newbie and just learning MQL4 and I am hoping someone might be able to help me out. I am trying to set a function to look at the last 2 candles of the 5min TF inside my indicator. Basically I am looking for a couple of conditions to be met on the 15m chart and then on the 5m chart. And once those conditions are met I want to populate a value for a parameter so that I can use it for my EA to tell me when to buy/sell. In this case I want to populate either a 1 or a -1 for the BS_Signal parameter whenever I get an engulfing bar on the 5min TF. So I have created a function that looks for the engulfing bar on the 5 min chart. But I cannot get it to work properly.
I have tried to use iOpen[1] or iClose[2] but this will give me whatever open/close to the TF the indicator is running in if I don't specify a period. So if I am on the 1h chart it will be wrong. So if you look at the code below I tried to set the period but I get the errors below each iteration I tried. What am I doing wrong? How can I set the function to tell me the candles 1 and 2 of the 5min TF (regardless of the TF of the indicator) so that I can calculate if it is an engulfing bar or not? Any help would be greatly appreciated.
Then I get Error- '[' - array required