Código:
extern int st = 10;
extern int tf = 10;
extern double lots = 0.01;
extern int period=18;
extern int price=6;
extern int cntLineaMostrar=2;
extern bool Mode_Fast= False;
extern bool Signals= true;
extern bool AlertWindow=false;
extern int MA1period=1, MA2period=1;
extern string Ayudas_TypeMA = “0-SMA, 1-EMA , 2-SMMA, 3-LWMA”;
extern int TypeMA1=0;
extern int TypeMA2=3;
extern int bars_count=1000;//agregado
//+——————————————————————+
//| Expert initialization function |
//+——————————————————————+
int OnInit()
{
//—
double compra = iCustom(Symbol(),0,”Sacupay”,period,price,cntLineaMostrar,Mode_Fast,Signals,AlertWindow,MA1period,MA2period,TypeMA1,TypeMA2,bars_count,0,1);
double neutral = iCustom(Symbol(),0,”Sacupay”,period,price,cntLineaMostrar,Mode_Fast,Signals,AlertWindow,MA1period,MA2period,TypeMA1,TypeMA2,bars_count,2,1);
double venta = iCustom(Symbol(),0,”Sacupay”,period,price,cntLineaMostrar,Mode_Fast,Signals,AlertWindow,MA1period,MA2period,TypeMA1,TypeMA2,bars_count,1,1);
//—
int ticket;
if ( compra > venta)
{
ticket = OrderSend(Symbol(), OP_BUY,lots,Ask,3,Bid-st*Point,Bid+tf*Point,NULL,1,0,Red);
}
if(venta < neutral && venta > compra)
{
ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,3,Ask-st*Point,Ask-tf*Point,NULL,1,0,Red);
}
return(INIT_SUCCEEDED);
}
//+——————————————————————+
//| Expert deinitialization function |
//+——————————————————————+
void OnDeinit(const int reason)
{
//—
}
//+——————————————————————+
//| Expert tick function |
//+——————————————————————+
void OnTick()
{
//—
}
//+——————————————————————+