Distance between MA is like distance between prices. If MA_1=1.54321 and MA_2=1.54320 then the distance between MA is 1_Point.
A Large DISTANCE is a definition you can make yourself
You can call 5 large but for someone else it has not be that way
In the code above the definition for large is when the VERTICALE difference between the lines is atleast Rastvor*Point
Rastvor has a value (28) and Point is also a value
- Note that the meaning of Rastvor*Point is broker dependent. On a 4 digit broker it's 28 pips but on a 5 digit broker it's 2.8 pips. EA's must adjust PIP values.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.015 0.0150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
Thank you very much for your explanation. I feel very supported in this forum.
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
Dear All,
Can anyone explain to me about the following trading criteria (MQL4 Book - Simple Programs in MQL4 - Simple Expert Advisor), especially what is the meaning of "Distance between MAs "(double Rastvor = 28.0 / / Distance the between MAs),
Thank you.
//--------------------------------------------------------------- 5 --
// Trading criteria
MA_1_t=iMA(NULL,0,Period_MA_1,0,MODE_LWMA,PRICE_TYPICAL,0); // МА_1
MA_2_t=iMA(NULL,0,Period_MA_2,0,MODE_LWMA,PRICE_TYPICAL,0); // МА_2
if (MA_1_t > MA_2_t + Rastvor*Point) // If difference between
{ // ..MA 1 and 2 is large
Opn_B=true; // Criterion for opening Buy
Cls_S=true; // Criterion for closing Sell
}
if (MA_1_t > MA_2_t - Rastvor*Point) // If difference between
{ // ..MA 1 and 2 is large
Opn_S=true; // Criterion for opening Sell
Cls_B=true; // Criterion for closing Buy
}
//--------------------------------------------------------------- 6 --