+ Reply to Thread
Page 5 of 5 FirstFirst ... 3 4 5
Results 41 to 44 of 44
 8 Attachment(s)    

Thread: Add a martingale

  1. #41
    Junior Member
    Join Date
    Jul 2010
    Posts
    1

    Default Help pls

    Hello FUNYOO i have these WRONGS:
    57:1;'history' - expression on global scope not allowed
    58:7;'history' - expression on global scope not allowed
    58:17;'{' - expression on global scope not allowed
    67:4;'mlots' - expression on global scope not allowed
    68:7;'martingale' - expression on global scope not allowed
    68:21;'lastprofit' - expression on global scope not allowed
    68:34;'mlots' - expression on global scope not allowed
    68:56;'lastlot' - expression on global scope not allowed
    68:64;'multiplier' - expression on global scope not allowed
    68:75;'lotdigits' - expression on global scope not allowed
    68:91;'mlots' - expression on global scope not allowed
    68:97;'lots' - expression on global scope not allowed
    68:63;'*' - both operands are to be numeric
    Please help me, thank you.


    Quote Originally Posted by funyoo View Post
    A new guide, an easier one :

    At the beginning of the code, in the extern parameters add :

    Code:
    extern bool martingale=false;          // enable the martingale
    extern double multiplier=2.0;          // multiplier used for the martingale
    extern double lotdigits=2;             // 1 for minilot, 2 for microlot
    After the extern parameters add :

    Code:
    double mlots,ilots,lastprofit,lastlot;
    
    int i,history;
    In the start body add :

    Code:
       history=OrdersHistoryTotal();
       if(history>0){
          for(i=0;i<history;i++){
             OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
             if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic){
                lastprofit=OrderProfit();
                lastlot=OrderLots();
             }
          }
       }
       mlots=0;
       if(martingale && lastprofit<0)mlots=NormalizeDouble(lastlot*multiplier,lotdigits);else mlots=lots;
    In the mm function (if you have one), add :

    Code:
     && (martingale==false || (martingale && lastprofit>=0))
    Before each ordersend function, add :

    Code:
    if(martingale)ilots=mlots;else ilots=lots;
    Finally, replace lots in the ordersend function by ilots.

  2. #42
    Junior Member
    Join Date
    Jan 2010
    Posts
    14

    Exclamation Error happened to lot size when connection error appear in journal

    Any improvement on the Martingale code ?

    As when connection error and re-login many times, the Martingale Lot size will quantum leap to future as present lot size has loss in the bad connection.

    It seem like the history lot calculation re-stack and re-stack when re-login ?

  3. #43
    Junior Member
    Join Date
    Apr 2012
    Posts
    1

    Default Can somebody add a lot doubling martingale to this EA? pleaaas :)

    Hi

    I read about martingale in this thread.
    Can somebody add a martingale to the attached EA

    (Martingale that does lot doubling after a loss keeps doubling the lots till one winner, then starts over)

    Thanks bub bye
    Last edited by zarathustra1983; 04-22-2012 at 18:02.

  4. #44
    Member
    Join Date
    Feb 2009
    Posts
    317

    Default

    Nothing Attached...

+ Reply to Thread
Page 5 of 5 FirstFirst ... 3 4 5

Similar Threads

  1. Ilan 1,43a martingale
    By funyoo in forum Expert advisors demo statements
    Replies: 8
    Last Post: 09-29-2010, 04:04
  2. Martingale system
    By funyoo in forum General discussion
    Replies: 11
    Last Post: 05-12-2009, 17:20
  3. Tweaking Martingale....
    By BillR in forum MQL programming
    Replies: 2
    Last Post: 03-05-2009, 15:27
  4. ATR MA Martingale EA
    By funyoo in forum Expert advisors demo statements
    Replies: 0
    Last Post: 02-19-2009, 21:40
  5. New martingale expert
    By daceterito in forum Ideas for expert advisors
    Replies: 2
    Last Post: 02-19-2009, 19:20

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts