Please use the SRC-button - beside the camera!
current_ask = MarketInfo(OrderSymbol(),MODE_ASK);
if(current_ask == startprice + NormalizeDouble(100*Point,Digits))
Play videoPlease edit your post.
For large amounts of code, attach it.
- Why are you using a function call in stead of the predefined variable Ask?
- Your if statement will never/randomally work. Learn why.
WHRoeder:
WHRoeder you picture is out of date, the SRC-button has moved ;)
Play videoPlease edit your post.
For large amounts of code, attach it.
- Why are you using a function call in stead of the predefined variable Ask?
- Your if statement will never/randomally work. Learn why.
if(current_ask == startprice + NormalizeDouble(100*Point,Digits))
What if the the Asks did not hit exactly:
startprice + NormalizeDouble(100*Point,Digits)
?
You won't get your print(..)
if(current_ask >= startprice + NormalizeDouble(100*Point,Digits)) { Print("Price has moved up 10 pips to ",current_ask," from ", startprice); startprice+=100*Point; //OR startprice=current_ask; }you didn't update the new value for startprice
Thanks to everyone who replied ! To anyone reading this in the future - always try to find a way to avoid comparing for price equality and redefine your expressions with > or < :)
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
Hello everyone I've been hard at work developing an EA these last few days that price movement be synthesized into 10 pip steps. I believe Ive narrowed down the cause of my troubles to this :
double current_ask;
double startprice = MarketInfo(OrderSymbol(),MODE_ASK);
This code only print this in the log :
2014.10.21 05:24 m4 EURUSD,H1: Price has moved up 10 pips to 1.28061 from 1.27961
0 19:11:26 2014.10.21 05:24 m4 EURUSD,H1: Price has moved up 10 pips to 1.28061 from 1.27961
0 19:11:26 2014.10.21 05:24 m4 EURUSD,H1: Price has moved up 10 pips to 1.28061 from 1.27961
0 19:11:26 2014.10.21 05:26 m4 EURUSD,H1: Price has moved up 10 pips to 1.28061 from 1.27961
0 19:11:26 2014.10.21 05:46 m4 EURUSD,H1: Price has moved up 10 pips to 1.28061 from 1.27961
... and so on. I.e. when it gets to the +10 pip level it spams for a bit until price moves away from that level. The problem is that the EA only print messages for the first up/down level it reaches and then ignores the other one even if it is reached. No "Price has moved down 10 pips" message gets printed if a "Price has moved up 10 pips" one has already been printed.
Now I am no pro mql4 coder but shouldnt the OnTick function run both if statement on every tick. Could anyone please explain why this code produces this result ?