You are on page 1of 3

//+------------------------------------------------------------------+

//| EA MA RSI CCI STC.mq4 |


//| Copyright 2022, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property strict

#define __STRATEGY_MAGIC 1001000000


#define __SLEEP_AFTER_EXECUTION_FAIL 400

extern int _PeriodSlowMA = 20;


extern int _PeriodFastMA = 14;
extern int _ShiftSlowMA = 0;
extern ENUM_MA_METHOD _MAMethod = MODE_SMA;
extern ENUM_APPLIED_PRICE _PriceMA = PRICE_CLOSE;

extern int _PeriodRSI = 14;


extern ENUM_APPLIED_PRICE _PriceRSI = PRICE_CLOSE;
extern int _OverSoldRSI = 30;

extern int _PeriodCCI = 14;


extern ENUM_APPLIED_PRICE _PriceCCI = PRICE_CLOSE;
extern int _OverSoldCCI = 30;

extern int _K_PeriodSTC = 5;


extern int _D_PeriodSTC = 3;
extern int _Slowing_PeriodSTC = 3;
extern ENUM_MA_METHOD _STCMethod = MODE_SMA;
extern ENUM_STO_PRICE _PriceSTC = 0;
extern int _OverSoldSTC = 20;

extern int _Magic = 123;


extern double _Lot = 0.01;
extern double _StopLoss = 300;
extern double _TakeProfit = 300;
extern int _Slipage = 10;

//Global Deklarasi
double _mySlowMA;
double _myFastMA;
double _myRSI;
double _myCCI;
double _myStc;

int init () { return(0) ; }


int start() {

bool _Buy = false;


bool _Sell = false;
//Local Deklarasi
_myFastMA = iMA ("",0,_PeriodFastMA, _ShiftSlowMA, _MAMethod, _PriceMA,0);
_mySlowMA = iMA ("",0,_PeriodSlowMA, _ShiftSlowMA, _MAMethod, _PriceMA,0);
_myRSI = iRSI ("",0,_PeriodRSI,_PriceRSI,0);
_myCCI = iCCI ("",0,_PeriodCCI,_PriceCCI,0);
_myStc = iStochastic
("",0,_K_PeriodSTC,_D_PeriodSTC,_Slowing_PeriodSTC,_STCMethod,_PriceSTC,MODE_SIGNAL
,0);

//+------------------------------------------------------------------+
//|------------------------------------------------------------------|
//+------------------------------------------------------------------+

if ( _myFastMA > _mySlowMA && _myRSI < _OverSoldRSI && _myCCI < _OverSoldCCI &&
_myStc < _OverSoldSTC ) _Buy = Buy
(_Magic,_Lot,0,_StopLoss,0,_TakeProfit,_Slipage,1,0,"") ;

return(0);
}

//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---

//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---

}
//+------------------------------------------------------------------+
//| Tester function |
//+------------------------------------------------------------------+
double OnTester()
{
//---
double ret=0.0;
//---
//---
return(ret);
}
//+------------------------------------------------------------------+
//| ChartEvent function |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
//---

}
//+------------------------------------------------------------------+

You might also like