STOP & REVERSE Orders

MQL4 Uzmanlar Entegrasyon

İş tamamlandı

Tamamlanma süresi: 17 saat

Şartname

Hi, I am trying to insert STOP & REVERSE Orders into the void UpdateBE() of my EA with the following trial and error self-coding, but seems not right...


I am not sure how to use the proper return function, is it just return or return(0) ? and also where to place the return function correctly.


1. I want my EA to close the current open order and open the new reversed order (buy to sell or sell to buy) at certain price level from the opening price.


2. I want my EA to keep doing it but maximum 3 times (if the STOP & REVERSE has been triggered for 3 times- adjustable to 5 times), 

but just one pending stop & reverse order per 1 time.


I am not a coder so I need a coder to help me with this. Thanks in advance.


Regards,

Joe




void UpdateBE()

{

if(UpdateToBE1 <= 0)

return;


for(int i = OrdersTotal() - 1; i >= 0; i--)

{

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

  {

  if(!IsThisChartOrder())

  continue;

 

  if(OrderType() == OP_BUY && OrderOpenPrice() > OrderStopLoss() && Bid - OrderOpenPrice() >= (UpdateToBE1 * Poin))

  {

  OrderModifySafe(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + (BE_LockPLPip1 * Poin), OrderTakeProfit(), 0);

  }

  else if(OrderType() == OP_SELL && OrderOpenPrice() < OrderStopLoss() && OrderOpenPrice() - Ask >= (UpdateToBE1 * Poin))

  {

  OrderModifySafe(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - (BE_LockPLPip1 * Poin), OrderTakeProfit(), 0);

  }

 

  if(OrderType() == OP_BUY && OrderOpenPrice() > OrderStopLoss() && Bid - OrderOpenPrice() >= (UpdateToBE2 * Poin))

  {

  OrderModifySafe(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + (BE_LockPLPip2 * Poin), OrderTakeProfit(), 0);

  }

  else if(OrderType() == OP_SELL && OrderOpenPrice() < OrderStopLoss() && OrderOpenPrice() - Ask >= (UpdateToBE2 * Poin))

  {

  OrderModifySafe(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - (BE_LockPLPip2 * Poin), OrderTakeProfit(), 0);

  }

 

  if(StopReverse_ON)

  {

  //if(OrdersTotal() > 3)

  //   return;

 

  double lots = CalculateLotSize();

  lastOrderTime = TimeCurrent();

 

  if(OrderType() == OP_BUY && OrderOpenPrice() > OrderStopLoss() && Bid < OrderOpenPrice()

  && NormalizeDouble(Bid - OrderStopLoss(), Digits) <= NormalizeDouble((StopReverse_PreparePip * Poin), Digits))

  {

                        OrderClose(OrderTicket(), OrderLots(), OrderStopLoss() + (StopReverse_PreparePip * Poin), Slippage);

  return;

  //OrderSendSafe(Symbol(), OP_SELL, lots, OrderStopLoss(), Slippage, OrderStopLoss() + (StopLoss * Poin), OrderStopLoss() - (TakeProfit1 * Poin), "Reversed 1 BUY ", EAMagicNo, TimeCurrent() + D'1970.01.01 1' * OrderExpirationHours, Red);

  OrderSendSafe(Symbol(), OP_SELLSTOP, lots, OrderStopLoss() + (StopReverse_PreparePip * Poin), Slippage, OrderStopLoss() + (StopLoss * Poin), OrderStopLoss() - ((TakeProfit1+10) * Poin), "Reversed 2 BUY ", EAMagicNo, TimeCurrent() + D'1970.01.01 1' * OrderExpirationHours, Red);

  return;

  }

  else if(OrderType() == OP_SELL && OrderOpenPrice() < OrderStopLoss() && Ask > OrderOpenPrice()

  && NormalizeDouble(OrderStopLoss() - Ask, Digits) <= NormalizeDouble((StopReverse_PreparePip * Poin), Digits))

  {

                        OrderClose(OrderTicket(), OrderLots(), OrderStopLoss() - (StopReverse_PreparePip * Poin), Slippage);

  return;

  //OrderSendSafe(Symbol(), OP_BUY, lots, OrderStopLoss(), Slippage, OrderStopLoss() - (StopLoss * Poin), OrderStopLoss() + (TakeProfit1 * Poin), "Reversed 1 SELL ", EAMagicNo, TimeCurrent() + D'1970.01.01 1' * OrderExpirationHours, Green);

  OrderSendSafe(Symbol(), OP_BUYSTOP, lots, OrderStopLoss() - (StopReverse_PreparePip * Poin), Slippage, OrderStopLoss() - (StopLoss * Poin), OrderStopLoss() + ((TakeProfit1+10) * Poin), "Reversed 2 SELL ", EAMagicNo, TimeCurrent() + D'1970.01.01 1' * OrderExpirationHours, Green);

  return;

  }

  return; //return(0);

  }

  }

}

}

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(88)
Projeler
143
39%
Arabuluculuk
21
19% / 48%
Süresi dolmuş
30
21%
Serbest
Benzer siparişler
I need an experienced MQL5 developer to build a prototype MT5 Expert Advisor called RiskLock. The software should enforce user-defined trading risk rules before trades are executed. It should support risk percentage or fixed monetary risk, calculate position size using account equity, entry price, stop loss, tick value and contract specifications, block or reduce oversized trades, and include daily loss limits
I need EA Lil-MeProBot for MT5. Phone user, deliver .mq5 + .ex5. Symbols: XAUUSD EURUSD GBPUSD USDJPY BTCUSD, M15, Magic 777001 Strategy 6X Confluence score 4/6: 1. EMA 50/200 trend 2. Break of Structure 3. RSI 14 4. Strong body FVG/Order Block 5. Session 8am-9pm GMT+2 6. ATR filter Money Management LASTING: Lot 0.01 fixed, NO martingale, NO grid, Max 1 per symbol Max 2 total, SL ATR*2 TP ATR*3, Daily loss R40 stop
Project Overview I have an existing MT5 Expert Advisor (EA) written in MQL5. The source code ( .mq5 ) will be provided. The underlying strategy is a trend-following system that performs well during trending market conditions, but requires professional quantitative research to improve its ability to identify and avoid highly sideways/range-bound market conditions. The objective of this project is not to build a new EA
I am looking for an experienced MQL5 Expert Advisor (EA) developer to analyze an existing trading setup and develop a similar automated trading robot. Project Overview I have access to a demo trading account where trades are being executed automatically. The trading results look very promising, but I do not know exactly what strategy, logic, indicators, or trade-management rules are being used. I will provide access
Most of the expert is already coded . Create a panel to show the Ratio for the Range . Trigger is based on ratio . Show Distribution / project starts after we clear Distribution
Modification of existing ea …. Add ema filter, add risk percentage per trade, and modify the pips per day filter. I already have the ea code I just need these things added and modifified
Expert Advisors 300+ USD
double CRiskManager::CalculateLotSize(double slPoints) { double balance = AccountInfoDouble(ACCOUNT_BALANCE); double riskMoney = balance * (m_riskPercent / 100.0); double tickValue = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE); double tickSize = SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_SIZE); double pointValue = tickValue / tickSize; double lot = riskMoney / (slPoints * pointValue);
i share my strategy i need a bot trending bot fo mt5 . i attached the photo with this it help to make bot. it basicly 1 hours time frame base. i try but failed to make it
Title: Simple background trading bot for my Oanda account (v20 REST API) Overview Hi, I need a simple, lightweight event based standalone trading bot that connects directly to my Oanda account using broker’s standard REST API (V20 account) via VPS The bot just needs to look at group of 5 currency pairs (manually selectable and adjustable) in different 4 baskets, do some basic percentage math every period, and place
MQL5 Developer 30+ USD
📄 وثيقة المواصفات الفنية لروبوت التداول (MQL5 EA Specification) 📌 1. ملخص المشروع والهدف * اسم المشروع: Gold Cent Grid-Hedge EA * المنصة: MetaTrader 5 (MQL5) * أداة التداول: الذهب (XAUUSD) * نوع الحساب: حساب سنت (Cent Account) * فكرة الاستراتيجية: تداول شبكة هيدج متوازنة (Grid-Hedging) تفتح صفقات تعزيز كل مسافة محددة، وتغلق الطرف الأكثر ربحاً عند تحقيق هدف مالّي مجمع بالدولار/السنت لإعادة هيكلة التوازن. ⚙️ 2

Proje bilgisi

Bütçe
20- USD
Son teslim tarihi
to 3 gün