extern int EA_magic = 2008112102;
extern double POS_tp = 5;
extern double POS_sl = 30;
extern double POS_slippage = 3;
extern int POS_num_max = 1;
extern double minLots = 0.1;
extern double maxLots = 15;
extern int Risk_percent = 57;
#define DEF_MA_TYP 5
#define DEF_MA_NUM 4
double Buf_MA[DEF_MA_TYP][DEF_MA_NUM];
int MA_prm_1 = 8;
int MA_prm_2 = 17;
int MA_prm_3 = 20;
int MA_prm_4 = 29;
int MA_prm_5 = 37;
int RSI_period5 = 11;
int RSI_period1 = 38;
double RSI_upper = 51;
double RSI_lower = 50;
double Lots;
int POS_n_BUY;
int POS_n_SELL;
int POS_n_total;
#define SIG_Buy 0
#define SIG_Sell 1
#define SIG_MAX 2
bool TradeSign[SIG_MAX];
void count_position()
{
POS_n_BUY = 0;
POS_n_SELL = 0;
for( int i = 0 ; i < OrdersTotal() ; i++ ){
if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) == false ){
break;
}
if( OrderMagicNumber() != EA_magic ){
continue;
}
if( OrderSymbol() != Symbol() ){
continue;
}
if( OrderType() == OP_BUY ){
POS_n_BUY++;
}
else if( OrderType() == OP_SELL ){
POS_n_SELL++;
}
}
POS_n_total = POS_n_BUY + POS_n_SELL;
}
int start()
{
// код доступен только после оплаты
}
double pos_tp = 0.0;
double pos_sl = 0.0;
int spread = MarketInfo(Symbol(),MODE_SPREAD);
int ticket;
int signal = 0;
if( IsTradeAllowed() != true ){
return(0);
}
if( Hour()<21 && Hour()>6)
return(0);
if( get_signal() == true ){
count_position();
Call_MM();
if( POS_n_total < POS_num_max ){
if( TradeSign[SIG_Buy]== true ){
pos_tp = Ask + (POS_tp * Point);
pos_sl = Ask - (POS_sl * Point);
ticket = OrderSend( Symbol(), OP_BUY, Lots, Ask, POS_slippage, pos_sl, pos_tp, " ", EA_magic, 0, Blue );
Print("ticket ",GetLastError());
if( ticket < 0 ){
Sleep(5000);
}
}
if( TradeSign[SIG_Sell] == true ){
Показано первые 50% кода (символов: 2933)
Введите ваш email и нажмите кнопку, чтобы перейти к оплате.