Tâche terminée
Temps d'exécution 3 jours
Commentaires du client
Super genius and super fast
Commentaires de l'employé
5 star client!
Happy to have worked with Naresh.
Spécifications
I need to modify my script to create a loop to check the buy and sell orders profit separately. close when 1st buy order and last buy order's average is profit.
Currently, my code closes all the buy/sell order's average is in profit. I would like to modify that for buy and sell orders.
//+------------------------------------------------------------------+ //| CloseOnAverage.mq4 | //| Copyright 2021, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict extern int Choose_stragegy=1; // 1-hedging 2-trend input int InpMaxTrades = 10; // Max number of trades input double InpTradeGap = 0.005; // Distance between trades //input ENUM_ORDER_TYPE InpType = ORDER_TYPE_BUY; // Order type;// input double InpMinProfit = 1.00; // Profit point input int InpMagicNumber = 1111; // Magic number input double Multiplier = 2; input string InpTradeComment = __FILE__; // Trade comment input double InpVolume = 0.01; // Volume per order double pips; //double multi= (InpVolume*Multiplier); struct STradeSum { int buycount; int sellcount; double buyprofit; double sellprofit; double buytrailPrice; double selltrailPrice; }; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ void OnTick() { STradeSum sum; GetSum(sum); if (sum.buyprofit>InpMinProfit) { // target reached CloseAll(ORDER_TYPE_BUY); } if (OrdersTotal()>=3) { drawdownreduction(); } else if (sum.sellprofit>InpMinProfit) { // target reached CloseAll(ORDER_TYPE_SELL); } else if (sum.buycount==0) { // no buy trades OpenTrade(ORDER_TYPE_BUY); } else if (sum.sellcount==0) { // no sell trades OpenTrade(ORDER_TYPE_SELL); } else if ((sum.buycount<InpMaxTrades)) { if ( OrderType()==ORDER_TYPE_BUY && SymbolInfoDouble(Symbol(), SYMBOL_ASK)<=(sum.buytrailPrice-InpTradeGap)) { // Far enough below OpenmultiTrade(ORDER_TYPE_BUY); } else if ((sum.sellcount<InpMaxTrades)) { if ( OrderType() ==ORDER_TYPE_SELL && SymbolInfoDouble(Symbol(), SYMBOL_BID)>=(sum.selltrailPrice+InpTradeGap)) { // Far enough above OpenmultiTrade(ORDER_TYPE_SELL); } } } //else if (sum.sellcount<InpMaxTrades) } //+------------------------------------------------------------------+ void OpenTrade(ENUM_ORDER_TYPE InpType) { double price = (InpType==ORDER_TYPE_BUY) ? SymbolInfoDouble(Symbol(), SYMBOL_ASK) : SymbolInfoDouble(Symbol(), SYMBOL_BID); OrderSend(Symbol(), InpType, InpVolume, price, 0, 0, 0, InpTradeComment, InpMagicNumber); } //+------------------------------------------------------------------+ void OpenmultiTrade(ENUM_ORDER_TYPE InppType) { double price = (InppType==ORDER_TYPE_BUY) ? SymbolInfoDouble(Symbol(), SYMBOL_ASK) : SymbolInfoDouble(Symbol(), SYMBOL_BID); double multi = (InpVolume*Multiplier); OrderSend(Symbol(), InppType, multi, price, 0, 0, 0, InpTradeComment, InpMagicNumber); } //+------------------------------------------------------------------+ void CloseAll(ENUM_ORDER_TYPE orderType) { int count = OrdersTotal(); for (int i = count-1; i>=0; i--) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if ( OrderSymbol()==Symbol() && OrderMagicNumber()==InpMagicNumber && OrderType()==orderType ) { OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0); } } } } //+------------------------------------------------------------------+ void GetSum(STradeSum &sum) { sum.buycount = 0; sum.buyprofit = 0.0; sum.buytrailPrice = 0.0; sum.sellcount = 0; sum.sellprofit = 0.0; sum.selltrailPrice = 0.0; int count = OrdersTotal(); for (int i = count-1; i>=0; i--) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { //Buy orders if (OrderSymbol()==Symbol() && OrderMagicNumber()==InpMagicNumber && OrderType()== ORDER_TYPE_BUY) { sum.buycount++; sum.buyprofit += OrderProfit()+OrderSwap()+OrderCommission(); if (sum.buytrailPrice==0 || OrderOpenPrice()<sum.buytrailPrice) { sum.buytrailPrice = OrderOpenPrice(); } } //sellorders if (OrderSymbol()==Symbol()&& OrderMagicNumber()==InpMagicNumber && OrderType()==ORDER_TYPE_SELL) { sum.sellcount++; sum.sellprofit += OrderProfit()+OrderSwap()+OrderCommission(); if (sum.selltrailPrice==0 || OrderOpenPrice()>sum.selltrailPrice) { sum.selltrailPrice = OrderOpenPrice(); } } } } return; } //+------------------------------------------------------------------+ //found this code online. The below code compares and closes the last two orders void drawdownreduction() { int slippage=10; double minimum_profit=InpMinProfit; int x; double trades[][4]; int total=OrdersTotal(); if(total>1) { ArrayResize(trades,total); for(x=total-1;x>=0;x--) { if(OrderSelect(x,SELECT_BY_POS,MODE_TRADES)) { trades[x][0]=OrderTicket(); trades[x][1]=OrderProfit()+OrderCommission()+OrderSwap(); trades[x][2]=OrderLots(); trades[x][3]=OrderType(); } } ArraySort(trades,WHOLE_ARRAY,0,MODE_ASCEND); x=0; while(x<total-1) { double profit=trades[x][1]+trades[total-1][1]; if(profit>=minimum_profit) { RefreshRates(); double close_price=Ask; if(trades[x][3]==OP_BUY) close_price=Bid; if(!OrderClose((int)trades[x][0],trades[x][2],close_price,slippage,clrNONE)) Print("Error closing #",DoubleToStr(trades[x][0],0)," Error code ",GetLastError()); RefreshRates(); close_price=Ask; if(trades[x+1][3]==OP_BUY) close_price=Bid; if(!OrderClose((int)trades[x+1][0],trades[x+1][2],close_price,slippage,clrNONE)) Print("Error closing #",DoubleToStr(trades[x][0],0)," Error code ",GetLastError()); } x+=2; } } }
Répondu
1
Évaluation
Projets
23
0%
Arbitrage
6
17%
/
83%
En retard
2
9%
Gratuit
2
Évaluation
Projets
66
41%
Arbitrage
1
0%
/
100%
En retard
7
11%
Gratuit
3
Évaluation
Projets
286
47%
Arbitrage
27
59%
/
37%
En retard
36
13%
Gratuit
4
Évaluation
Projets
181
24%
Arbitrage
23
22%
/
39%
En retard
13
7%
Gratuit
5
Évaluation
Projets
133
35%
Arbitrage
13
38%
/
31%
En retard
32
24%
Gratuit
6
Évaluation
Projets
1
0%
Arbitrage
2
0%
/
100%
En retard
0
Gratuit
Publié : 7 codes
7
Évaluation
Projets
873
48%
Arbitrage
29
38%
/
17%
En retard
63
7%
Gratuit
8
Évaluation
Projets
28
32%
Arbitrage
1
0%
/
0%
En retard
0
Gratuit
Publié : 1 code
9
Évaluation
Projets
239
70%
Arbitrage
3
67%
/
33%
En retard
20
8%
Gratuit
Commandes similaires
Need an MQL5 Expert Advisor for MT5 that automates my manual trading strategy. Entry logic: Enter only when trend direction, support/resistance level, and RSI all align (Triple Confirmation). Extra confluence from Smart Money Concepts (order blocks, Fair Value Gaps, BOS/CHoCH). Risk rules: 1% risk per trade, minimum 1:2 risk-reward, stop-loss at structure levels (not fixed pips). Must-haves: Works on Islamic
I am looking for a developer experienced in EAs, MT5 and trade management optimization to help me add an intelligent early-exit system to my existing XAUUSD trading robot. The EA is already fully functional and performs best on the M15 timeframe. The entry strategy, BUY/SELL logic, sessions and core structure are already implemented. The work should focus exclusively on adding early exits for trades that are
PHANTOM PROTOCOL V1
35 - 150 USD
PHANTOM PROTOCOL V1 – MT5 EXPERT ADVISOR SPECIFICATION Develop a professional MetaTrader 5 (MT5) Expert Advisor named “PHANTOM PROTOCOL V1”. PRIMARY MARKET: - XAUUSD (Gold) - Designed primarily for M15 and H1 timeframes. - The EA must work with both 3-digit and 2-digit gold pricing where applicable. TRADING LOGIC: Use pure price-action and market-structure analysis rather than relying on a single indicator. The EA
Wanna Create A Trading Robot That Uses Liquidity Sweep And Smart Money Concept EA That Works On PC. I want A Developer Who Can Program Exactly My Strategy That Will Be Shared on A Video Upon The Selection. it Should Follow My Rules .It has To be able To Read Price Action, followed By Liquidity Sweep Areas And Combine with Smart Money Concept Knowledge. We Will Talk about Parameters later on . The robot should be able
1. Overview: I need an Expert Advisor (EA) for MT5 called "Gold Sniper" specifically optimized for XAUUSD (Gold). The EA should be a sniper scalper that takes high-probability trades on M5 and M15. It must work on any broker with low spread. 2. Strategy Logic: The EA should combine 3 confirmations: a) Trend Filter: EMA 50 & EMA 200. Only Buy if EMA 50 > EMA 200, only Sell if EMA 50 < EMA 200. Sniper Entry: Use RSI
I need an experienced trading-data specialist who can help me obtain 3–4 years of historical market data compatible with NinjaTrader 8 . The data will be used for trading strategy development, backtesting, and analysis
LOOKING FOR THE BEST EA
30 - 500 USD
I would look for an EA with: ✅ Verified MT4/MT5 live account ✅ At least 6–12 months of live results ✅ Low/moderate drawdown ✅ No dangerous martingale/grid unless you specifically want that ✅ Realistic scalping performance with your broker ✅ Spread & slippage filters ✅ Stop Loss + Take Profit ✅ Break-even and trailing stop ✅ News filter ✅ Adjustable lot size/risk ✅ Source code ( .mq4/.mq5 ) if you're purchasing the EA
Шукаю спеціаліста для розширення діючого функціоналу MT5 "New order" або створення окремого робота. Суть проекта - можливість створення відкладеного ордеру BuyStop або SellStop після досягнення ринковою ціною певного значення. Схема руху ціни - хибний пробій рівня (ціна X) та розворот тренду. Ручне встановлення SL та TP. Опція схожа діючого функціоналу BuyStopLimit або SellStopLimit, але відкладений ордер
Need aggressive M1 gold scalper rewrite of Dev3 + 8 strategies. INPUTS: RiskPercent=3, TP=400, SL=300, MaxTrades=6, Mode=BOTH, DailyProfit 15%, DailyLoss -10% LOT = Balance * RiskPercent / 1000 - works for Cent R350 and $1000. 8 STRATEGIES any true = open instantly, check 1 sec: 1 EMA8/21 cross 2 RSI14 30/70 + engulf 3 Engulfing candle 4 BB 20,2 breakout 5 FVG grab M1 6 M5 trend + M1 entry 7 Wick rejection >2 8
Development of custom SMC Trading EA for MT5
80 - 100 USD
Hi, I want to develop a custom SMC (Smart Money Concepts) EA for MT5. My budget is $100. Here are the strategy requirements: 1. Auto identification of BOS, CHoCH, Order Blocks (OB), and FVG. 2. Auto entry when price returns to OB/FVG. 3. Auto SL above/below OB and TP based on Risk-to-Reward ratio (1:2, 1:3). 4. Risk Management (Risk % per trade or fixed lot size), Trailing Stop, Break-Even, and Max Spread filter. 5
Informations sur le projet
Budget
30+ USD
Délais
à 2 jour(s)