Está perdiendo oportunidades comerciales:
- Aplicaciones de trading gratuitas
- 8 000+ señales para copiar
- Noticias económicas para analizar los mercados financieros
Registro
Entrada
Usted acepta la política del sitio web y las condiciones de uso
Si no tiene cuenta de usuario, regístrese
I have this code and it won't run, I would like someone to help me to correct the errors.
// define inputs
input int ma_period = 50;
input int rsi_period = 14;
input double rsi_level = 70;
input double profit_target = 100;
input double stop_loss = 50;
// define variables
double ma_current, ma_previous;
double rsi_value;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// initialize indicators
ma_current = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 0);
ma_previous = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 1);
rsi_value = iRSI(_Symbol, _Period, rsi_period, PRICE_CLOSE, 0);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// update indicators
ma_current = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 0);
ma_previous = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 1);
rsi_value = iRSI(_Symbol, _Period, rsi_period, PRICE_CLOSE, 0);
// check for buy signal
if (ma_current > ma_previous && rsi_value > rsi_level) {
// place buy order
double stop_loss_price = Bid - stop_loss * _Point;
double take_profit_price = Bid + profit_target * _Point;
int ticket = OrderSend(_Symbol, OP_BUY, lot_size, Ask, 3, stop_loss_price, take_profit_price, "Buy", MagicNumber, 0, Green);
if (ticket > 0) {
Print("Buy order placed successfully with ticket #", ticket);
} else {
Print("Error placing buy order: ", GetLastError());
}
}
// check for sell signal
if (ma_current < ma_previous && rsi_value < (100 - rsi_level)) {
// place sell order
double stop_loss_price = Ask + stop_loss * _Point;
double take_profit_price = Ask - profit_target * _Point;
int ticket = OrderSend(_Symbol, OP_SELL, lot_size, Bid, 3, stop_loss_price, take_profit_price, "Sell", MagicNumber, 0, Red);
if (ticket > 0) {
Print("Sell order placed successfully with ticket #", ticket);
} else {
Print("Error placing sell order: ", GetLastError());
}
}
}
I have this code and it won't run, I would like someone to help me to correct the errors.
// define inputs
input int ma_period = 50;
input int rsi_period = 14;
input double rsi_level = 70;
input double profit_target = 100;
input double stop_loss = 50;
// define variables
double ma_current, ma_previous;
double rsi_value;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
// initialize indicators
ma_current = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 0);
ma_previous = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 1);
rsi_value = iRSI(_Symbol, _Period, rsi_period, PRICE_CLOSE, 0);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// update indicators
ma_current = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 0);
ma_previous = iMA(_Symbol, _Period, ma_period, 0, MODE_SMA, PRICE_CLOSE, 1);
rsi_value = iRSI(_Symbol, _Period, rsi_period, PRICE_CLOSE, 0);
// check for buy signal
if (ma_current > ma_previous && rsi_value > rsi_level) {
// place buy order
double stop_loss_price = Bid - stop_loss * _Point;
double take_profit_price = Bid + profit_target * _Point;
int ticket = OrderSend(_Symbol, OP_BUY, lot_size, Ask, 3, stop_loss_price, take_profit_price, "Buy", MagicNumber, 0, Green);
if (ticket > 0) {
Print("Buy order placed successfully with ticket #", ticket);
} else {
Print("Error placing buy order: ", GetLastError());
}
}
// check for sell signal
if (ma_current < ma_previous && rsi_value < (100 - rsi_level)) {
// place sell order
double stop_loss_price = Ask + stop_loss * _Point;
double take_profit_price = Ask - profit_target * _Point;
int ticket = OrderSend(_Symbol, OP_SELL, lot_size, Bid, 3, stop_loss_price, take_profit_price, "Sell", MagicNumber, 0, Red);
if (ticket > 0) {
Print("Sell order placed successfully with ticket #", ticket);
} else {
Print("Error placing sell order: ", GetLastError());
}
}
}
Mi cuenta no aparece en la lista de señales, es pública. Abrí otra cuenta para suscribirme y practicar copytrading pero no aparece.
Aunque dice: " Su Señal ha sido publicada y ya está disponible al público". Ayuda porfa, gracias.