100% profitable EA need slightly adjustment.

 

Hi all programmer;

I have a EA need adjustment, hope anyone can lend me a hand and i will appreaciate.

Ok the EA below are using martingaling system (as i know), the EA open BUY & SELL in some time from start,

so what i try to do is to change the LOT order setting,

eg: from the EA, the lot size start with 0.10; 0.20; 0.40; 0.80;........double up.......

it possible make it to start with 0.10; 0.10; 0.10; 0.30;......den double up (perfertly have muyltiply function)

Thank You very much. :-)

int g_magic_76;
int gi_unused_80;
extern int TakeProfit = 10;
extern int Step = 30;
extern int Slippage = 3;
extern string Comm = "Auto Robot 30/10";
bool gi_104 = TRUE;

int init() {
gi_unused_80 = 0;
g_magic_76 = StringGetChar(Symbol(), 0) + 77703 + StringGetChar(Symbol(), 1) * 2 + 3 * StringGetChar(Symbol(), 3) + StringGetChar(Symbol(), 4) << 2 + 10000 * Period();
HideTestIndicators(TRUE);
return (0);
}

int start() {
string ls_0;
double l_lots_8;
double l_ord_open_price_16;
double l_ord_open_price_24;
double l_ord_profit_32;
double l_ord_profit_40;
if (gi_104) {
ls_0 = "ProfitStream Advisor";
Comment(ls_0);
}
int l_count_48 = 0;
int l_count_52 = 0;
if (!IsTradeAllowed()) {
Comment("Error: This currency pair is not allowed or connection failed");
return (0);
}
Comment("");
if (Bars < 100) return (0);
double l_ord_lots_56 = 0;
double l_ord_lots_64 = 0;
for (int l_pos_72 = 0; l_pos_72 < OrdersTotal(); l_pos_72++) {
OrderSelect(l_pos_72, SELECT_BY_POS);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_76) continue;
if (OrderType() == OP_BUY) {
if (OrderLots() > l_ord_lots_56) {
l_ord_lots_56 = OrderLots();
l_ord_open_price_16 = OrderOpenPrice();
l_ord_profit_32 = OrderProfit();
}
l_count_48++;
} else {
if (OrderType() == OP_SELL) {
if (OrderLots() > l_ord_lots_64) {
l_ord_lots_64 = OrderLots();
l_ord_open_price_24 = OrderOpenPrice();
l_ord_profit_40 = OrderProfit();
}
l_count_52++;
}
}
}
bool l_bool_76 = FALSE;
bool l_bool_80 = FALSE;
bool li_84 = FALSE;
bool li_88 = FALSE;
l_bool_76 = l_count_48 < 1 || l_ord_open_price_16 - Step * Point > Ask && AccountFreeMargin() > AccountBalance() / 2.0;
l_bool_80 = l_count_52 < 1 || l_ord_open_price_24 + Step * Point < Bid && AccountFreeMargin() > AccountBalance() / 2.0;
if (l_ord_lots_56 > 0.0) li_84 = l_ord_profit_32 / (10.0 * l_ord_lots_56) > TakeProfit;
if (l_ord_lots_64 > 0.0) li_88 = l_ord_profit_40 / (10.0 * l_ord_lots_64) > TakeProfit;
if (li_84) {
for (l_pos_72 = OrdersTotal() - 1; l_pos_72 >= 0; l_pos_72--) {
OrderSelect(l_pos_72, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_76 && OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, White);
}
} else {
if (li_88) {
for (l_pos_72 = OrdersTotal() - 1; l_pos_72 >= 0; l_pos_72--) {
OrderSelect(l_pos_72, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_76 && OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, White);
}
} else {
RefreshRates();
if (l_bool_76) {
if (l_ord_lots_56 == 0.0) l_lots_8 = 0.1;
else l_lots_8 = 2.0 * l_ord_lots_56;
OrderSend(Symbol(), OP_BUY, l_lots_8, Ask, Slippage, 0, Ask + (TakeProfit + 25) * Point, Comm, g_magic_76, 0, Yellow);
} else {
if (l_bool_80) {
if (l_ord_lots_64 == 0.0) l_lots_8 = 0.1;
else l_lots_8 = 2.0 * l_ord_lots_64;
OrderSend(Symbol(), OP_SELL, l_lots_8, Bid, Slippage, 0, Bid - (TakeProfit + 25) * Point, Comm, g_magic_76, 0, Red);
}
}
}
}
return (0);
}

 

I edited your code to make it readable. Using the src button next time will make things easier. Also comments. Comments are good. I might work on your problem later, but I wanted to post the cleaned code for others who want to help you. I'm pretty sure everything matches up. I didn't actually make changes by the way; I just hit the tab button a lot.

int g_magic_76;
int gi_unused_80;
extern int TakeProfit = 10;
extern int Step = 30;
extern int Slippage = 3;
extern string Comm = "Auto Robot 30/10";
bool gi_104 = TRUE;
int init() {
        gi_unused_80 = 0;
        g_magic_76 = StringGetChar(Symbol(), 0) + 77703 + StringGetChar(Symbol(), 1) * 2 + 3 * StringGetChar(Symbol(), 3) + StringGetChar(Symbol(), 4) << 2 + 10000 * Period();
        HideTestIndicators(TRUE);
        return (0);
}
int start() {
        string ls_0;
        double l_lots_8;
        double l_ord_open_price_16;
        double l_ord_open_price_24;
        double l_ord_profit_32;
        double l_ord_profit_40;
        if (gi_104) {
                ls_0 = "ProfitStream Advisor";
                Comment(ls_0);
        }
        int l_count_48 = 0;
        int l_count_52 = 0;
        if (!IsTradeAllowed()) {
                Comment("Error: This currency pair is not allowed or connection failed");
                return (0);
        }
        Comment("");
        if (Bars < 100) return (0);
        double l_ord_lots_56 = 0;
        double l_ord_lots_64 = 0;
        for (int l_pos_72 = 0; l_pos_72 < OrdersTotal(); l_pos_72++) {
                OrderSelect(l_pos_72, SELECT_BY_POS);
                if (OrderSymbol() != Symbol() || OrderMagicNumber() != g_magic_76) continue;
                if (OrderType() == OP_BUY) {
                        if (OrderLots() > l_ord_lots_56) {
                                l_ord_lots_56 = OrderLots();
                                l_ord_open_price_16 = OrderOpenPrice();
                                l_ord_profit_32 = OrderProfit();
                        }
                        l_count_48++;
                } else {
                        if (OrderType() == OP_SELL) {
                                if (OrderLots() > l_ord_lots_64) {
                                        l_ord_lots_64 = OrderLots();
                                        l_ord_open_price_24 = OrderOpenPrice();
                                        l_ord_profit_40 = OrderProfit();
                                }
                                l_count_52++;
                        }
                }
        }

        bool l_bool_76 = FALSE;
        bool l_bool_80 = FALSE;
        bool li_84 = FALSE;
        bool li_88 = FALSE;
        l_bool_76 = l_count_48 < 1 || l_ord_open_price_16 - Step * Point > Ask && AccountFreeMargin() > AccountBalance() / 2.0;
        l_bool_80 = l_count_52 < 1 || l_ord_open_price_24 + Step * Point < Bid && AccountFreeMargin() > AccountBalance() / 2.0;
        if (l_ord_lots_56 > 0.0) li_84 = l_ord_profit_32 / (10.0 * l_ord_lots_56) > TakeProfit;
        if (l_ord_lots_64 > 0.0) li_88 = l_ord_profit_40 / (10.0 * l_ord_lots_64) > TakeProfit;
        if (li_84) {
                for (l_pos_72 = OrdersTotal() - 1; l_pos_72 >= 0; l_pos_72--) {
                        OrderSelect(l_pos_72, SELECT_BY_POS);
                        if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_76 && OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, White);
                }
        } else {
                if (li_88) {
                        for (l_pos_72 = OrdersTotal() - 1; l_pos_72 >= 0; l_pos_72--) {
                                OrderSelect(l_pos_72, SELECT_BY_POS);
                                if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_76 && OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, White);
                        }
                } else {
                        RefreshRates();
                        if (l_bool_76) {
                                if (l_ord_lots_56 == 0.0) l_lots_8 = 0.1;
                                else l_lots_8 = 2.0 * l_ord_lots_56;
                                OrderSend(Symbol(), OP_BUY, l_lots_8, Ask, Slippage, 0, Ask + (TakeProfit + 25) * Point, Comm, g_magic_76, 0, Yellow);
                        } else {
                                if (l_bool_80) {
                                        if (l_ord_lots_64 == 0.0) l_lots_8 = 0.1;
                                        else l_lots_8 = 2.0 * l_ord_lots_64;
                                        OrderSend(Symbol(), OP_SELL, l_lots_8, Bid, Slippage, 0, Bid - (TakeProfit + 25) * Point, Comm, g_magic_76, 0, Red);
                                }
                        }
                }
        }
        return (0);
}
 
ubuntuboy:

I edited your code to make it readable. Using the src button next time will make things easier. Also comments. Comments are good. I might work on your problem later, but I wanted to post the cleaned code for others who want to help you. I'm pretty sure everything matches up. I didn't actually make changes by the way; I just hit the tab button a lot.


Thanks ubuntuboy,

Sorry this are all i have, actually the EA is forward by one of my friend. i didn't have any 'clean code'. by the way what is the clean code is? effective without it?

if not do you make one? ;-)

Thank you, cheersss.............

 

  1. Sorry this are all i have, actually the EA is forward by one of my friend. i didn't have any 'clean code'.
    The code you have was stolen from someone. The EX4 was decompiled back to code. That's why you have weird variable names, no comments, etc.
  2. so what i try to do is to change the LOT order setting,

    eg: from the EA, the lot size start with 0.10; 0.20; 0.40; 0.80;........double up.......

    it possible make it to start with 0.10; 0.10; 0.10; 0.30;......den double up (perfertly have muyltiply function)

    The code that calculates lot size is:
    if (l_ord_lots_56 == 0.0) l_lots_8 = 0.1;
    else l_lots_8 = 2.0 * l_ord_lots_56;
    OrderSend(Symbol(), OP_BUY...
    Your description isn't clear but I think you want:
    // 0.10 0.10 0.10 0.30 0.60...
         if (l_count_48 <= 2) l_lots_8 = 0.1;
    else if (l_count_48 == 2) l_lots_8 = 0.3;
    else                      l_lots_8 = 2.0 * l_ord_lots_56;
    OrderSend(Symbol(), OP_BUY...
    Like wise for the sell code with l_count_52 and l_ord_lots_64.
 

Seems to be a relative of that fellow known as Martingale.

Normally friendly people, but have the occasional bad habit of wiping out your account. :)

 
WHRoeder:

  1. Sorry this are all i have, actually the EA is forward by one of my friend. i didn't have any 'clean code'.
    The code you have was stolen from someone. The EX4 was decompiled back to code. That's why you have weird variable names, no comments, etc.
  2. so what i try to do is to change the LOT order setting,

    eg: from the EA, the lot size start with 0.10; 0.20; 0.40; 0.80;........double up.......

    it possible make it to start with 0.10; 0.10; 0.10; 0.30;......den double up (perfertly have muyltiply function)

    The code that calculates lot size is:Your description isn't clear but I think you want:Like wise for the sell code with l_count_52 and l_ord_lots_64.


Thank you very much WHRoeder, but i have 0 knowledge of the programming.

so which part to apply on of the description?

and you look like to know how to code EA, right?

can you hepl me to code full EA using this method pleasesssssssss.............

 
SexyJC:


Thank you very much WHRoeder, but i have 0 knowledge of the programming.

so which part to apply on of the description?

and you look like to know how to code EA, right?

can you hepl me to code full EA using this method pleasesssssssss.............

https://book.mql4.com//

https://docs.mql4.com//

http://www.google.com

going to a forum for developer with stolen code and still wanting something for free is maybe not the best idea.

you know others put hours/days/weeks in developing indicators/systems. knowledge sharing is a good thing as long its not unidirectional

Reason: