Code to count lot size of the same currency across orders on both buy and sell

MQL4 Experts Scripts

Job finished

Execution time 3 days
Feedback from employee
Excellent client. Was helpful with testing and not afraid to ask questions.

Specification

I need a developer with very good English skills to provide me the code for a function that I want to insert into my own code and which should do the following:

-          Count how many open orders a currency (or an index, etc) is involved in, separately on buy and sell.

-          Count the total lot size on buy and the total lot size on sell that the currency (or index) is involved in.


For example, if I have the following trades open:

2 lots of SELL GBPUSD

0.5 lot of SELL EURGBP

0.5 lot of BUY EURUSD

 

Then the results provided by the function will be:

Total number of open orders BUY on GBP: 1

Total lot size BUY on GBP: 0.5

Total number of open orders SELL on GBP: 1

Total lot size SELL on GBP: 2

Net lot size on GBP (BUY-SELL): -1.5


The function will return the same type of results for EUR, USD and all other currencies, indices, etc that are involved in open orders.

Important: you have to be careful to identify when the currency is the first or the second in the currency pair in order to get the result right. For example, a SELL order on EURGBP counts as a SELL on EUR, but as a BUY on GBP.

The code should also work for symbols composed of only one element, like US30.

Exception: I need an exception to be introduced in the case of instruments XTIUSD and XAUUSD, in the sense that in these cases the function will NOT add these to the count of number of orders and size of lots on USD, BUT it will add them to the count of the number of orders and the size of lots on XTI and XAU respectively.

Use of the function:

I should be able to call this function in the main program something like this: get_lot_count(Symbol), where symbol can be GBPUSD, XTIUSD, US30, etc. When called, the function will calculate and provide (in separate variables) all the information mentioned above in relation to the instrument(s) present in the symbol, regardless of whether there are 2 currencies  in the Symbol (like in EURUSD, in which case the information will be, of course, separate for EUR and USD) or a stand-alone instrument in the symbol (like in US30).

I am flexible to suggestions on how to best organise the information.

Note: when applying for this job please let me know if you have experience in doing something similar or other information that would help me understand that you actually looked carefully at the specs and that you are not just sending an “automated” application.


Responded

1
Developer 1
Rating
(19)
Projects
35
26%
Arbitration
10
30% / 70%
Overdue
5
14%
Free
2
Developer 2
Rating
(378)
Projects
401
31%
Arbitration
63
19% / 70%
Overdue
51
13%
Loaded
3
Developer 3
Rating
(50)
Projects
70
29%
Arbitration
8
50% / 13%
Overdue
14
20%
Working
4
Developer 4
Rating
(130)
Projects
184
32%
Arbitration
16
31% / 63%
Overdue
27
15%
Free
5
Developer 5
Rating
(88)
Projects
143
39%
Arbitration
21
19% / 48%
Overdue
30
21%
Free
6
Developer 6
Rating
(36)
Projects
50
28%
Arbitration
2
0% / 100%
Overdue
6
12%
Free
7
Developer 7
Rating
(27)
Projects
43
7%
Arbitration
18
6% / 78%
Overdue
26
60%
Free
8
Developer 8
Rating
(84)
Projects
149
31%
Arbitration
32
34% / 41%
Overdue
43
29%
Free
9
Developer 9
Rating
(4)
Projects
4
25%
Arbitration
1
0% / 0%
Overdue
0
Free
10
Developer 10
Rating
(62)
Projects
140
46%
Arbitration
19
42% / 16%
Overdue
32
23%
Free
Similar orders
I need an expert to decrypt my itf file using on prorealtime. I forgot my password, so I need to generate the source code. I need someone that can help me to derive source code from the itf file I have
I’m looking for someone experienced with Think or Swim to create a backtesting script for an in-the-money Iron Condor strategy using options on the SPX. The strategy involves setting up 10 contracts of an Iron Condor with a 10-point spread width and a net credit requirement of $11 per contract. The goal is to backtest the performance over the last three years, focusing on trades where the SPX closes outside a
I currently have a license code that connects to my web server, and I add the account number, client name, and expiration date. I’d like something more automated. Currently I allow clients 10 licenses, but adding for them on my side can get exhausting. I’d like a better solution for myself and clients

Project information

Budget
30 - 50 USD
VAT (21%): 6.3 - 10.5 USD
Total: 36.3 - 60.5 USD
For the developer
27 - 45 USD
Deadline
from 2 to 3 day(s)