Tarea técnica

//+------------------------------------------------------------------+
//| SimpleMA.mq5 |
//| Auto trading bot example |
//+------------------------------------------------------------------+
#property copyright "ChatGPT"
#property link ""
#property version "1.00"
#property strict

input int FastMAPeriod = 10;
input int SlowMAPeriod = 30;
input double Lots = 0.1;

int fastMAHandle;
int slowMAHandle;

double fastMA[];
double slowMA[];

int OnInit()
{
// Create handles for moving averages
fastMAHandle = iMA(_Symbol, PERIOD_CURRENT, FastMAPeriod, 0, MODE_SMA, PRICE_CLOSE);
slowMAHandle = iMA(_Symbol, PERIOD_CURRENT, SlowMAPeriod, 0, MODE_SMA, PRICE_CLOSE);

if(fastMAHandle == INVALID_HANDLE || slowMAHandle == INVALID_HANDLE)
{
Print("Failed to create indicator handles");
return(INIT_FAILED);
}

return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
IndicatorRelease(fastMAHandle);
IndicatorRelease(slowMAHandle);
}

void OnTick()
{
// Copy data for the last 3 bars (to check crossover)
if(CopyBuffer(fastMAHandle, 0, 0, 3, fastMA) <= 0) return;
if(CopyBuffer(slowMAHandle, 0, 0, 3, slowMA) <= 0) return;

double fastPrev = fastMA[1];
double fastCurrent = fastMA[0];
double slowPrev = slowMA[1];
double slowCurrent = slowMA[0];

// Check if there is already an open position
int totalPositions = PositionsTotal();

bool buySignal = (fastPrev < slowPrev) && (fastCurrent > slowCurrent);
bool sellSignal = (fastPrev > slowPrev) && (fastCurrent < slowCurrent);

// Simple logic: if buy signal and no position, buy; if sell signal and no position, sell
if(buySignal)
{
if(!HasOpenPosition(ORDER_TYPE_BUY))
{
CloseOppositePositions(ORDER_TYPE_SELL);
OpenPosition(ORDER_TYPE_BUY);
}
}
else if(sellSignal)
{
if(!HasOpenPosition(ORDER_TYPE_SELL))
{
CloseOppositePositions(ORDER_TYPE_BUY);
OpenPosition(ORDER_TYPE_SELL);
}
}
}

// Check if there is an open position of a certain type
bool HasOpenPosition(ENUM_ORDER_TYPE orderType)
{
for(int i=0; i<PositionsTotal(); i++)
{
ulong ticket = PositionGetTicket(i);
if(PositionSelectByTicket(ticket))
{
if(PositionGetInteger(POSITION_TYPE) == orderType)
return true;
}
}
return false;
}

// Close positions opposite to the current signal
void CloseOppositePositions(ENUM_ORDER_TYPE orderTypeToClose)
{
for(int i=PositionsTotal()-1; i>=0; i--)
{
ulong ticket = PositionGetTicket(i);
if(PositionSelectByTicket(ticket))
{
if(PositionGetInteger(POSITION_TYPE) == orderTypeToClose)
ClosePosition(ticket);
}
}
}

// Open a market position (buy or sell)
void OpenPosition(ENUM_ORDER_TYPE orderType)
{
MqlTradeRequest request;
MqlTradeResult result;

request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = Lots;
request.type = orderType;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
request.deviation = 10;
request.magic = 123456;

if(!OrderSend(request,result))
Print("Trade failed: ", GetLastError());
else
Print("Trade opened: ", orderType == ORDER_TYPE_BUY ? "BUY" : "SELL");
}

// Close position by ticket
void ClosePosition(ulong ticket)
{
MqlTradeRequest request;
MqlTradeResult result;

if(!PositionSelectByTicket(ticket))
{
Print("Position not found: ", ticket);
return;
}

double volume = PositionGetDouble(POSITION_VOLUME);
ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
double price = (type == POSITION_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_BID) : SymbolInfoDouble(_Symbol, SYMBOL_ASK);

request.action = TRADE_ACTION_DEAL;
request.position = ticket;
request.symbol = _Symbol;
request.volume = volume;
request.type = (type == POSITION_TYPE_BUY) ? ORDER_TYPE_SELL : ORDER_TYPE_BUY;
request.price = price;
request.deviation = 10;
request.magic = 123456;

if(!OrderSend(request,result))
Print("Close failed: ", GetLastError());
else
Print("Position closed: ", ticket);
}

Han respondido

1
Desarrollador 1
Evaluación
(254)
Proyectos
341
71%
Arbitraje
12
42% / 25%
Caducado
12
4%
Libre
Ha publicado: 17 ejemplos
2
Desarrollador 2
Evaluación
(50)
Proyectos
73
21%
Arbitraje
11
18% / 27%
Caducado
6
8%
Trabaja
3
Desarrollador 3
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
4
Desarrollador 4
Evaluación
(5)
Proyectos
5
20%
Arbitraje
0
Caducado
0
Trabaja
5
Desarrollador 5
Evaluación
(3)
Proyectos
3
0%
Arbitraje
0
Caducado
0
Ocupado
6
Desarrollador 6
Evaluación
(84)
Proyectos
115
70%
Arbitraje
5
80% / 0%
Caducado
11
10%
Libre
7
Desarrollador 7
Evaluación
(6)
Proyectos
6
17%
Arbitraje
2
0% / 0%
Caducado
1
17%
Trabajando
8
Desarrollador 8
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
Solicitudes similares
I need a profitable trading EA that can maximize a profitable trade for daily uses. An EA that can trade all kinds of of currencies and must be an existing EA with 70-80% guarantee
⸻ I have an Expert Advisor called NeuroTrendX_Pro v7.9 ULTRA (NTX Pro). I need a reliable and experienced MQL5 developer to finalize and correct it without removing or disabling any existing logic. Scope of work (included in the fixed budget): • Fix all existing compile/runtime errors (not just one). • Keep the entire current logic intact (do not remove or change modules). • Implement and confirm the following
Automate my strategy 30 - 70 USD
🚀 Looking for a Trading Bot Coder 🚀 I’m searching for an experienced developer to help automate my trading strategies. Requirements: Strong knowledge in MQL5 / MT5 (or TradingView Pine Script, depending on platform) Experience with price action & strategy automation Ability to integrate custom risk management & alerts 💡 If you’re a skilled coder who can turn trading ideas into a profitable bot, let’s connect
Hey there, I’m looking to get a custom NinjaTrader indicator/plugin/tool developed. It’s very similar to Riley Coleman’s “Candlestick Trader” indicator (you can see a walkthrough of it in this YouTube video at timestamp 6:52: https://www.youtube.com/watch?v=NjCUZveXtLo&amp ;t=303s ). Please take a look at that video for reference, as I’d like most of the core features replicated. To summarize, the key functions I
I am looking for an experience MQL4 developer for making a profitable prop firm compatible MT4 gold scalper EA on a 5 Minute time frame. The EA should have a win rate of not less than 90% on back testing. The EA should be able to pass all prop firm challenges like Funded Next, FTMO, Funding Pips within 1-2 weeks. The EA should also work on live funded account. Any strategy can be used to develop the EA. Proper risk
I’m looking for a profitable Expert Advisor (EA) — the real beast that can deliver strong results on MT4/MT5. If you have a proven EA with good performance and risk management, kindly reach out with details and results
Modify my MT5 EA 30 - 40 USD
I am looking for an MQL5 programmer who can modify and customize my personal MT5 EA. There is problem in placing stop loss but still the EA is profitable on back testing. I also want to add news filter and prop firm compatible. The details will be shared to the developer personally
Hi, I am looking for readymade EA/a developer who can build it one for me. Feel free to contact me if you can fulfill my requirement. But be sure my a developer must have capability to develop complex EA with robust architecture. Especially on sophisticated trading methodology i.e. ICT/SMC etc
Please build me an EA tha can do the following: Normally I when executed buy (0.01)trade, I place sell (0.03) stop order for in case I predicted wrong, and when this sell is triggered, I place buy (0.07) stop on the initial buy, and the circle go on until I Tp is hit, all these trades I set TP and SL on them and they correspond, for sells will have same TP and Same SL, and all buys triggered after initial will have
Breakout and Retest/Supply and Demand Strategies for EA Expert Advisors, on MQL5 1. *Breakout Strategy*: Identify key levels of support/resistance and enter trades upon breakout. 2. *Retest Strategy*: Wait for price to retest previously broken levels before entering trades. 3. *Supply and Demand Strategy*: Identify areas of strong buying/selling interest (supply/demand zones). *Best Practices* 1. Define clear

Información sobre el proyecto

Presupuesto
30 - 1000 USD
Plazo límite de ejecución
de 1 a 7 día(s)

Cliente

Encargos realizados1
Número de arbitrajes0