
Một loại chỉ báo khác là bộ dao động. Các chỉ báo dao động được vẽ trong các cửa sổ riêng biệt và chúng dao động giữa mức giá cao nhất và mức giá thấp nhất. Chúng tập trung vào trục trung hòa (thường là 0) hoặc bị giới hạn bởi giới hạn trên hoặc dưới (chẳng hạn như 0 và 100).
Các ví dụ về bộ dao động bao gồm động lượng, ngẫu nhiên và RSI. Tìm hiểu cách lập trình Expert Advisor để giao dịch với các bộ dao động phổ biến nhất trong bài viết EA Chỉ báo dao động MQL4 này.
Chỉ báo dao động cho biết mức quá mua và quá bán. Mặc dù chúng có thể được sử dụng làm chỉ báo xu hướng nhưng chúng thường được sử dụng để xác định các khu vực sẽ bị đảo chiều. Chúng được sử dụng để tạo ra tín hiệu ngược xu hướng.
| MACD(1) | |
|---|---|
| < strong>Ghi chú | //Mua: MACD tăng trên đường tín hiệu //Bán: MACD giảm xuống dưới đường tín hiệu |
| Extern | int fastmacd=12; //Averaging period for calculation of a quick MA extern int slowmacd=26; //Averaging period for calculation of a slow MA extern int signalmacd=9; //Averaging period for calculation of a signal line |
| Indicator Calling | macdmaincurr=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_MAIN,0); macdmainprev=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_MAIN,1); macdsigcurr=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_SIGNAL,0); macdsigprev=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_SIGNAL,1); |
| BuyCond | if (macdmainprev < <macdsignalprevious&&macdmaincurrent>macdsignalprev && macdmaincurr >= macdsignalcurr) </macdsignalprevious&&macdmaincurrent> |
| SellCond | if (macdmainprev > macdsignalprev && macdmaincurr <=macdsignalcurr) |
| MACD(2) | |
|---|---|
| Note | //Buy: crossing 0 upwards //Sell: crossing 0 downwards |
| Extern | int fastmacd=12; //Averaging period for calculation of a quick MA extern int slowmacd=26; //Averaging period for calculation of a slow MA extern int signalmacd=9; //Averaging period for calculation of a signal line |
| Indicator Calling | macdmaincurr=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_MAIN,0); macdmainprev=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_MAIN,1); macdsigcurr=iMACD(NULL,0,fastmacd,slowmacd,signalmacd,0,MODE_SIGNAL,0); macdsigprev=iMACD(NULL,0,fastmacd,slowmacd,signalmacd0,MODE_SIGNAL,1); |
| BuyCond | if (macdmainprev < 0<macdsignalprevious&&macdmaincurrent> && macdmaincurr >= 0) </macdsignalprevious&&macdmaincurrent> |
| SellCond | if (macdmainprev > 0 && macdmaincurr <= 0) |
| RSI | |
|---|---|
| Note | //Buy: crossing 30 upwards //Sell: crossing 70 downwards |
| Extern | rsiu = 14; // averaging period lowerband = 30; upperband = 70; |
| Indicator Calling | rsicurrent=iRSI(NULL,0,rsiu,PRICE_CLOSE,0); rsiprevious=iRSI(NULL,0,rsiu,PRICE_CLOSE,1); |
| BuyCond | if (rsiprevious<lowerband&&rsicurrent>=lowerband) |
| SellCond | if (rsiprevious>upperband&&rsicurrent<=upperband) |
| Stochastics Occilator(1) | |
|---|---|
| Note | //Buy: main line rises above 20 after it fell below this point //Sell: main line falls lower than 80 after it rose above this point |
| Extern | stok = 5; // Period(amount of bars) for the calculation of %K line stod = 3; //Averaging period for the calculation of %D line stslow =3; // Value of slowdown mamode = 1; lowerband = 20; upperband = 80; |
| Indicator Calling | stocurrent=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_MAIN,0); stoprevious=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_MAIN,1); |
| BuyCond | if (stoprevious<lowerband&&stocurrent>=lowerband) |
| SellCond | if (stoprevious>upperband&&stocurrent<=upperband) |
| Stochastics Occilator(2) | |
|---|---|
| Note | //Buy: main line goes above the signal line //Sell: signal line goes above the main line |
| Extern | stok = 5; // Period(amount of bars) for the calculation of %K line stod = 3; //Averaging period for the calculation of %D line stslow =3; // Value of slowdown mamode = 1; lowerband = 20; upperband = 80; |
| Indicator Calling | stomaincurr=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_MAIN,0); stomainprev=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_MAIN,1); stosignalcurr=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_SIGNAL,0); stosignalprev=iStochastic(NULL,0,stok,stod,stslow,mamode,0,MODE_SIGNAL,1); |
| BuyCond | if (stomainprev<stosignalprev&&stomaincurr>=stosignalcurr) |
| SellCond | if (stomainprev>stosignalprev&&stomaincurr<=stosignalcurr) |
| Williams % Range | |
|---|---|
| Note | //Buy: crossing -80 upwards //Sell: crossing -20 downwards |
| Extern | willperiod = 14; // averaging period lowerband = -20; upperband = -80; |
| Indicator Calling | willcurrent=iWPR(NULL,0,willperiod,0); willprevious=iWPR(NULL,0,willperiod,1); |
| BuyCond | if (willprevious<upperband>willcurrent>= upperband) |
| SellCond | if (willprevious>lowerband&&willcurrent<=lowerband) |
| Force Index | |
|---|---|
| Note | /Flag 14 is 1, when FI recommends to buy (i.e. FI<0) //Flag 14 is -1, when FI recommends to sell (i.e. FI>0) |
| Extern | forceu = 2; // averaging period |
| Indicator Calling | forcecurrent=iForce(NULL,0,forceu,MODE_SMA,PRICE_CLOSE,0); |
| BuyCond | if (forcecurrent<0) |
| SellCond | if (forcecurrent>0) |