Trabajo finalizado
Tarea técnica
i need a basket EA which monitors (and trades, of course) the prices of pairs; no chart needed to watch, only numbers.
The EA has to pick the ASK price of the selected pairs, multiply them, and compare the result with the BID price of the main pair choosed. Simple!
Here’s an example:
main pair EURAUD
sub pairs EURGBP,CHFJPY
EURAUD BID 1.08781
EURGBP ASK 0.87439
NZDUSD ASK 0.72655
the result of multiplication is 0.63529
So,
(EURAUD)1.08781-(result)0.63529 = 0.38281*100000 = 45252 points
The calculation is always MAIN - SUB!
This calculation must be on EVERY TICK! That could mean over 500 calculation a minute!
If the difference between main and subs is over X points or under Y points (points are discretionary in settings inputs) you can choose what to do: buy both main and subs; sell both main and subs; sell main and buy subs and viceversa.
The menu will be:
fixed lots: true/false
fixed lotsize: If above is true, the EA will use this fixed lot size (0.01…..0.1….10 and so on)
percent lotmulti: If above is false, the EA will trade in the percent given (1 meaning 1% of balance, same for equity with no running positions)
******KEEP ATTENTION: lot size, fixed or percent, is relative to each subs pair. If i set a fixed lot size to 0.1 and i select 10 subs, then each orders will have 0.1, in total 1 std lot. The lot size of main pair is automatically set to 0.1*n° of pairs (10 in example). So the main pair will trade with 1 std lot, while each sub with 0.1. The same calculation for the percent lots.
main pair: no need this voice. Is the pair where i attach the EA, which automatically set that cross as main. Obviously the timeframe is useless.
sub pairs: a comma-separated list of symbols to include in basket calculation (example: AUDUSD,NZDUSD,USDCAD,EURAUD,EURNZD,EURCAD,GBPAUD,GBPNZD,GBPCAD). Allowed multiple voices.
coeff sub_pairs: Directional Weights of basket instruments seperated by commas (+1 , +1 , -1 , -1 , -1 , -1 , -1 , -1 , -1). If a subpair is EURUSD with its coeff +1 and i choose sell/buy (see below) it will buy EURUSD. But, If EURUSD has -1 it will buy USDEUR (means sell USDEUR). So if the EURUSD ask value is 1.10123, the multiplication will be 1/1.10123*other ask pairs
entry _diff: (in points: 1 or 2 or 10…100…) if non zero, the EA will open the positions in the direction of the below voice WHEN A POSITIVE/NEGATIVE GAP BETWEEN MAIN AND SUBS, GREATER OR EQUAL THAN THE VALUE, IS MET. FOR EXAMPLE 10 MEANS BOTH +10 AND -10! If zero it won’t trade when a positive/negative difference occur. So it never trades
direction positive_main: is a choosing menu buy or sell for positive diff on main cross. If is on buy, then the negative automatically would be sell.
direction positive_subs: is a choosing menu buy or sell for positive diff on each sub cross. If is on buy, then the negative automatically would be sell. (always keep an eye on coeff sub_pairs voice)
max sum spread: Blocks new orders if the current sum of basket spreads on the SUB symbols is wider than the specified number of points. A value of zero disables this check on the spread.
magic: magic for whole basket
Position Minimal Time: in seconds for some brokers scalping restrictions. If non zero the EA leaves the positions opened at least for the seconds input. Zero turns off the setting
max SL_points: ignored if below voice is non zero. If non-zero, a fixed number of pips to use for the stop-loss on all basket (not applied to any singular trade, but for the whole basket)
max SL_money: ignored if below voice is non zero. If non-zero, a fixed number of money to use for the stop-loss on all basket (not applied to any singular trade, but for the whole basket.)
basket money: (1° exit method: considering the commissions if any…the EA must watch for this and is very easy since MT4 gives the total profit itself. Zero disables this function);
percentage of balance: (2° exit method: i intend balance as the money before opening position, and not the equity! When there are no opened position the equity=balance. Zero disables this function)
basket difference: (3° exit method: in points. If non zero then the EA exits the positions when the difference is equal or less of this value. Zero disables this function
All exit ways can coexist together. The EA will stop once the first occurs.
Once any of selected exit method is reached, and the Position Minimal Time (if non zero) is already expired, then the EA can close. Position Minimal Time is stronger than any exits method.
Lastly, when i attach the EA to the main pair chart, then it should give me the informations on the screen such as:
-main pair, with its BID value and the direction of trade chosen
-sub pairs chosen with their ASK values and each direction of trade chosen
-current real time diff MAIN - SUBS
-current real time SUBS sum of spread