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
This will never be true. The pip value has to be converted to a double.
Only have to alter four lines of the second example I provided.
Hi, thanks for your input, I did consider this problem however at this early stage I am only testing the code on the UK100 & NASDAQ both are trading around the 7500 mark.
So if Close[i+1] was 7483.8 and Close[i] was 7481.2
Would result in (2.6) or integer 2 which confirms the direction the market is moving and by how much?
Your revision would allow the code to run on any index, which would eventually be needed.
The problem I am trying to resolve is so simple everyone assumes 'it goes without saying...'
If the above IF statement is correct I need to move on to another IF statement and then to another etc. What I dont need is all IF statements completing every tick regardless of any logic path!
For multiple if statements either nest them or use && instead of ||. To only check for a condition on a new bar and not on every tick, add a flag before the loop.(I'm not sure if that is what you meant with the last sentence.)
What do you mean by flag? Are you referring to a boolean "bool"?
"add a flag before the loop." was a suggestion from Ernst.
I have been trying to find a full explanation for the function of { } type brackets as there is literally nothing in MQL4 Resource about them. I dont know if the have a specific name but its difficult to Google "{ }"
"add a flag before the loop." was a suggestion from Ernst.
I have been trying to find a full explanation for the function of { } type brackets as there is literally nothing in MQL4 Resource about them. I dont know if the have a specific name but its difficult to Google "{ }"
It's called the compound operator. https://www.mql5.com/en/docs/basis/operators/compound
The flag (bool) is this part:
if(rates_total!=prev_calculated)
It will only look for signals on the second and third bars once a new bar is formed, and not on every tick.
Unfortunately the 'compound operator' description only tells me that an 'if' statement is followed by a function in brackets, which I already knew.
I can see how the (rates_total!=prev_calculated) would work I will look to incorporate it, if I ever find a way to add a (true, false) logic path beyond one question.