Lavoro terminato
Specifiche
I need a multi-currency EA.mq5 that handle +50 assets (currencies, commodities and indices) at a time. This is very important because of the 242-character MQL5 restriction.
The EA will be based on an indicator and an existing EA.
Logic to enter market:
EA: Grid.mq5
Indicator: i-Regr.ex5
Timeframes: H4 and M15
At New Bar (M15) and Magic Number:
(*) Long position: if (rates [0]. close < rates [1]. open && rates [1]. close > rates [1]. open)
(*) Short position: if (rates [0]. close > rates [1]. open && rates [1]. close < rates [1]. open)
And, based on the attached iReg indicator, when prices break above the upper band (upper and lower timeframe), open short position(*) at market price or pending short order in the upper band price and reopen, positions or orders, at a minimum distance between orders or positions equal to {0, 5* (upper band[] – lower band[])}, and vice versa;
Orders and positions should be open at Time Distance=60 minutes;
Pending orders should have an expiration time.
Logic to close:
Trailing () function as yes/No option, if only one short or long position is open;
Profit should be calculated at 20 days iATR;
Minimal Profit should be calculated at 5 days iATR;
Trailing only after the position is in profit. (trailing_profit)
Stop Loss should not be used;
At Average or Part Close coded in the EA annexed;
The average function and the Part Close function must be able to work at the same time; that is, if there are conditions for closing extreme orders, the close part must override the average function.
If the price meets the line for calculating the average of open orders, all orders will be closed at average price.
Logic to calculate Lots and CheckMoneyForTrade:
The Lots Size should be automat or manual calculated.
if(margin>free_margin)
{
ATR=iATR(NULL, PERIOD D1, 20);
//----
if(BuyPriceMin>0 && tick.ask<BuyPriceMin)
longGrid=NormalizeDouble((BuyPriceMax-tick.ask)/ATR), digits);
if(SelPriceMax>0 && tick.bid>SelPriceMax)
shortGrid=NormalizeDouble((tick.bid-SelPriceMin)/ATR),digits);
//---
buyGrid=MathCeil(longGrid);
sellGrid=MathCeil(shortGrid);
//---+++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if(LotMulti)
{
if(OpenBuy>0 && tick.ask<BuyPriceMin)
bLot=MathAbs(NormalizeDouble(AutoLot()*buyGrid,2));
else bLot=AutoLot();
//-----
if(OpenSell>0 && tick.bid>SelPriceMax)
sLot=MathAbs(NormalizeDouble(AutoLot()*sellGrid,2));
else sLot=AutoLot();
//---
}
}
The EA should comment in the chart all outputs;
The EA should only be submitted for review after the programmer has tested it and after all corrections have been made.