
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
mladen & mrtools
I have an EA that blast it self with trades. I need help to build a Void or function that can be added to an existing EA. This function needs to address:
input bool doBasketExit = true; // Check for Basket Exit conditions
input double BasketTP = 250.0; // Basket Take Profit (Account Currency) The chart Pair
input double BasketSL = -100.0; // Basket Stop Loss (Account Currency) The chart Pair
Im running 9 pairs/Charts with aggressive EA on the H1 and I want pair specific basket trading on each of the 9 charts.
Here's what just happened to me. 9 charts running, 3 charts are in trade with, of course, 3 separate pairs, each with 15 trades, yes 45 trades open, 2 are in profit & one is losing badly. I looking for a way to add up each group/pair of the 15 separately and rub each group against a Basket SL & TP boundaries. I found a basket set up but of course it needs refinement. The trick is to get the same pair added up from the Order Profit Trade column. By being on a Chart with a specific pair I thought I come up with a void but its kind of complicated. The function must somehow read the OrderProfit by Pair???
See my code as a poor example;
void closeTrades( CURRENCY* ¤cies[] ) {
// Check for Basket Exit
if ( doBasketExit ) {
double basketProfit = getBasketProfit();
if ( ( ( BasketTP > 0.0 ) && ( basketProfit > BasketTP ) ) ||
( ( BasketSL < 0.0 ) && ( basketProfit < BasketSL ) ) ) {
closeAll();
}
}
double getBasketProfit() {
double basketProfit = 0.0;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SELL) ) {
basketProfit += OrderProfit() + OrderSwap() + OrderCommission();
}
}
}
}
return(basketProfit);
}
void closeAll() {
double closePrice;
string symbolName;
int result;
for (int iOrder=OrdersTotal()-1; iOrder >= 0; iOrder--) {
if (OrderSelect(iOrder,SELECT_BY_POS,M ODE_TRADES)) {
if ( OrderMagicNumber() == MagicNumber ) {
if ( (OrderType() == OP_BUY) || (OrderType() == OP_SELL) ) {
symbolName = OrderSymbol();
closePrice = ( OrderType() == OP_BUY ) ? MarketInfo( symbolName, MODE_BID ) : MarketInfo( symbolName, MODE_ASK );
result = OrderCloseReliable(OrderTicket(), OrderLots(), closePrice, 50 );
}
}
Really appreciate you looking into this
Thanks
Ray
Ray
You need some kind of "mother EA" - that would know all the magic numbers handled by other EAs and then do the "on group" operations that you need to be done
Try doing the following :
Instead of
Ray
You need some kind of "mother EA" - that would know all the magic numbers handled by other EAs and then do the "on group" operations that you need to be done
mladen
thanks for your thoughts on this matter. So NO.
thanks again
Ray
have tried to make the arrow appear after the close of the signal candle in other to avoid repainting but all to no avail.please help me out MR. TOOLS and MLADEN, below is the code.
Hi mladen
I need ITM X-Gen Daily Scalper Indicator.mq4
Heelp me
Thanks
Hi mladen
I need ITM X-Gen Daily Scalper Indicator.mq4
Heelp me
Thanks
alozard
That indicator is a renamed my Centered TMA bands indicator. You can find it here : https://www.mql5.com/en/forum/181241
Mr. Mladen, please look at the below codes , the arrow doesnt come up in live until i switched time frame.
Mr. Mladen, please look at the below codes , the arrow doesnt come up in live until i switched time frame.
kapoo
As I told you already multiple times : that indicator is a bad repainter and that is why it does what it does. My best advice is that you forget about it