Select last 30 orders in history with magic number 999999 MQL4

MQL4 Experts Scripts

Job finished

Execution time 3 minutes
Feedback from customer
Compliments to Ivand for his work. His work was quick, accurate for a reasonable price. He also helped me with the running of the script. Would definitely recommend him as a EA programmer to others.

Specification

Hallo,

I want to select the last 30 orders form my EA with the magicnumber 999999  in MQL4. Currently my code is like this which doesnt account for the MagicNumber:

OrderSelect(OrdersHistoryTotal()-30,SELECT_BY_POS,MODE_HISTORY);  
   double G30 = OrderProfit();                                       if(G30 > 0) W ++;  
   if(G30 == 0) G30 = 0.0001; 
   if(G30 > 0) Wins = Wins + G30; 
   if(G30 < 0) Loss = Loss + G30;
   OrderSelect(OrdersHistoryTotal()-29,SELECT_BY_POS,MODE_HISTORY);  
   double G29 = OrderProfit();                                       if(G29 > 0) W ++; 
   if(G29 == 0) G29 = 0.0001; 
   if(G29 > 0) Wins = Wins + G29; 
   if(G29 < 0) Loss = Loss + G29;               
   OrderSelect(OrdersHistoryTotal()-28,SELECT_BY_POS,MODE_HISTORY);  
   double G28 = OrderProfit();                                       if(G28 > 0) W ++;        
   if(G28 == 0) G28 = 0.0001; 
   if(G28 > 0) Wins = Wins + G28; 
   if(G28 < 0) Loss = Loss + G28;     

 I want to select the last 30 orders from the ea with the magicnumber 999999 and than calculate the average winn and  average loss amount of the last 30 trades.

Can anybody help me?

Kind Regards

 

Rene  

Responded

1
Developer 1
Rating
(647)
Projects
1295
67%
Arbitration
84
26% / 49%
Overdue
338
26%
Free
2
Developer 2
Rating
(182)
Projects
342
42%
Arbitration
118
12% / 73%
Overdue
104
30%
Free
Published: 4 codes
3
Developer 3
Rating
(2630)
Projects
3345
67%
Arbitration
77
48% / 14%
Overdue
342
10%
Free
Published: 1 code
4
Developer 4
Rating
(14)
Projects
27
22%
Arbitration
18
6% / 89%
Overdue
8
30%
Free
Published: 1 code
5
Developer 5
Rating
(618)
Projects
1428
59%
Arbitration
31
81% / 0%
Overdue
10
1%
Free
6
Developer 6
Rating
(88)
Projects
143
39%
Arbitration
21
19% / 48%
Overdue
30
21%
Free
7
Developer 7
Rating
(1928)
Projects
3548
88%
Arbitration
73
40% / 15%
Overdue
268
8%
Free
8
Developer 8
Rating
(16)
Projects
39
69%
Arbitration
2
0% / 50%
Overdue
1
3%
Free
9
Developer 9
Rating
(452)
Projects
565
26%
Arbitration
24
42% / 38%
Overdue
85
15%
Free
Published: 6 codes
10
Developer 10
Rating
(171)
Projects
229
60%
Arbitration
3
33% / 33%
Overdue
6
3%
Working
Published: 1 code
11
Developer 11
Rating
(70)
Projects
86
31%
Arbitration
1
100% / 0%
Overdue
1
1%
Free
12
Developer 12
Rating
(12)
Projects
13
31%
Arbitration
1
0% / 100%
Overdue
1
8%
Free
Published: 1 code
13
Developer 13
Rating
(47)
Projects
140
49%
Arbitration
9
56% / 0%
Overdue
27
19%
Free
14
Developer 14
Rating
(14)
Projects
22
27%
Arbitration
24
13% / 79%
Overdue
6
27%
Free
15
Developer 15
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
16
Developer 16
Rating
(64)
Projects
144
46%
Arbitration
19
42% / 16%
Overdue
32
22%
Working
Similar orders
True 30+ USD
Hello, I would like to commission the development of a trading robot (EA) designed specifically to pass a prop firm challenge within one week, with a maximum allowable drawdown of 2%. Key requirements: Strict risk management with drawdown hard-limits Controlled lot sizing and position management Strategy focused on high-probability, low-risk entries Full compliance with prop firm rules (daily drawdown, max drawdown
I want you to help me and create a sniper entry robot and with proper risk management that follow trend and when is not going to the direction it exit
I need an MQL5 Expert Advisor fixed and compiled. Symbol: XAUUSD Timeframe: M1 Strategy: - Pending order breakout using last 3 candles - Buy Stop +4 points above range - Sell Stop -4 points below range - Lot size: 0.01 fixed - No martingale, no grid, no trailing stop Exits: - Take Profit: 8–10 points - Stop Loss: 10–12 points - Time-based exit: ~75 seconds Risk rules: - Trade only between 09:00 and 17:00 - Max spread
I have been trading manually for years by disciplining myself to follow a rigorous risk management system and using entry and exit strategies crafted from Implied Volatility(IV), Real Volume ,RSI and Moving Average ,but never had I automated the entire system until now . I have just completed the automation of the gold Expert Advisor and the results are astonishing .Below you'll see the graph and a statistics file
Hello budget 30$ I have range breakout expert advisor with pending orders, when the range is complete, the expert sends pending orders, I need to add an option so that when the range is complete, the expert advisor doesn't send pending orders, when the price exceeds the range, the position is opened, executive Orders. I need to make new option True/False True = Executive Orders. False = Pending orders I want the
Wealth Ascent 30 - 50 USD
MASTER PROMPT: Advanced Multi-Strategy Trading Robot Role: You are a senior quantitative trader, algorithmic trading engineer, and risk manager with 10+ years of experience in crypto, forex, and indices markets. Goal: Design a robust, automated trading robot that integrates multiple proven trading strategies and focuses on long-term, risk-adjusted profitability, capital preservation, and adaptive market behavior. ---
I got access to a trial mt5 EA(only ex5 and not mql5 file) which is an ultra fast scalper on gold that operates only using pending orders which is working absolutely insane when backtesting or live trading using demo account but when you try to back test it on a live/real account the results are horrible !...both demo and real accounts belong to the same broker both same leverage and same type spread wise but the EA
Hi , I need an MT4 EA with the following requirements (BUY only): BUY only: The EA must open BUY trades only . No sell orders at all. Pending orders on objects (Touch trigger, no candle close): I draw objects on the chart: Trendline / Rectangle (Box) / Horizontal Line . The EA places a BUY pending order exactly at the object price so it triggers when price touches the object. For a trendline, the EA must continuously
Hello everyone, I am looking for a highly experienced MQL5 developer to build a fully automated Expert Advisor (EA) based strictly on Smart Money Concepts (SMC) 🔍 Core Strategy Requirements (SMC Only) The EA must be based on Advanced Smart Money Concepts , including: ✅ Market Structure (BOS & CHOCH) ✅ Liquidity concepts (equal highs/lows, stop hunts)✅ Trap Blocks / Fake Order Blocks detection ✅ Valid Order
EMA Triple-Cross Trading EA Constitution 1. Instruments Bot operates ONLY on: • UK100 (FTSE 100 Cash) • CASH30 (Dow Jones / DJI30) • GOLD (XAUUSD) Developer Note: Please ensure proper handling of contract sizes and point values for indices vs gold when calculating lot size . 2. Chart & Timeframes Primary Execution Timeframe: ➡ M15 Higher Timeframe Bias: ➡ H1 Trades are allowed ONLY in the direction of H1 EMA200: •

Project information

Budget
10 - 25 USD