double ma50=iMA(Symbol(),0,50,0,1,0,0); double ma200=iMA(Symbol(),0,200,0,1,0,0); int pipsMA = (int)MathFloor( MathAbs(ma50-ma200)/_Point );
Thank you! But how many digits will this produce?
double ma50=iMA(Symbol(),0,50,0,1,0,0); double ma200=iMA(Symbol(),0,200,0,1,0,0); int pipsMA = (int)MathFloor( MathAbs(ma50-ma200)/_Point );
I would like to then have an extern int which i could change
so would this be correct
double ma50=iMA(Symbol(),0,50,0,1,0,0); double ma200=iMA(Symbol(),0,200,0,1,0,0); int pipsMA = (int)MathFloor( MathAbs(ma50-ma200)/_Point ); extern int Tradepip = 50
So could i literally put this into my buy order function
if(pipsMA< Tradespip && Close[0]<ma50 && ma50>ma200 && !EPs(Symbol(),-1,Magic,Commentt) && !UseManual)Sig=1;
would this work?
int pipsMA = (int)MathFloor( MathAbs(ma50-ma200)/_Point );Let's parse this line. To understand her.
ma50-ma200
We get the difference of values. And we'll bring it to the right value.
MathAbs
Divide by the value of one pips
_Point
And rounded
MathFloor
We get a simple value for pips. Then we compare with what we need.
Let's parse this line. To understand her.
ma50-ma200
We get the difference of values. And we'll bring it to the right value.
MathAbs
Divide by the value of one pips
_Point
And rounded
MathFloor
We get a simple value for pips. Then we compare with what we need.
Thank you so much this was really helpful!
I fully understand :)
A point is not a PIP.
What is a TICK? - MQL4 and MetaTrader 4 -
MQL4 programming forum
How to manage JPY pairs with parameters? - MQL4 and MetaTrader 4 - MQL4 programming forum
Slippage defined in index points - Currency Pairs - Expert Advisors and Automated Trading - MQL5 programming forum
A point is not a PIP.
The values of iMA are the same as the price. Therefore it is possible to use _Point.
With other indicators. Perhaps you need to apply another.
P.S. Well, you can universally.
double t=1; for(int i=0; i<_Digits; i++) t /= 10; int pipsMA = (int)MathFloor( MathAbs(ma50-ma200)/t );
The values of iMA are the same as the price. Therefore it is possible to use _Point.
With other indicators. Perhaps you need to apply another.
P.S. Well, you can universally.
So this is the correct way?
So this is the correct way?
For iMA, both parameters work. The second option, for example, for MACD. In which digits, less by 1, from the price. With what and the values, it differs from the price.
If I measured a 9 foot distance using a yard stick I would get an answer of 3 yards. If I used a foot ruler, I would get an answer of 9 feet. If I wanted yards, 9 is the wrong answer.
OP wanted an answer in PIPs. using _Point gives the wrong answer. A PIP is not a point.
Numerical value of the Moving Average indicator. Tied to the price of the currency quotes
The _Point variable contains the point size of the current symbol in the quote currency.
- OP stated he wants to compare the distance to 50 PIPs, not to 50 points. A PIP is not a point. Either he has to translate 50 PIPs to points to compare to your delta/_Point, or he has to translate your delta/_Point to PIPs to compare to 50 (PIPs.) Your answer is wrong. Your are missing the point. You can not compare 50 (PIPs) to distance (in points) and get a valid answer.
- True and irrelevant.
- True and irrelevant.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
Would it be possible for someone to help me find a way to tell me EA to only execute trades when there is a specific distance between two moving averages?
For example
I basically want to know which command i can give into the EA so that when the distance between the 50 ema and 200 ema is say 50 pips then its safe to trade. IF the distance between them is say less than 50 pips then it doesn't trade.
Thanks in advance