Results 1 to 3 of 3
 0 Attachment(s)    

Thread: Martingale after X Losses

  1. #1

    Default Martingale after X Losses

    hy
    can somebody help
    how to add value to martingale like this:

    act martingale not after first lose but after X loses ?

    int MartingaleFactor()
    {
    int histotal=OrdersHistoryTotal();
    if (histotal>0)
    {
    for(int cnt=histotal-1;cnt>=0;cnt--)
    {
    if(OrderSelect(cnt,SELECT_BY_POS,MODE_HISTORY))
    {
    if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
    {
    if(OrderProfit()<0)
    {
    LotsFactor=LotsFactor*Multiplier;
    return(LotsFactor);
    }
    else
    {
    LotsFactor=InitialLotsFactor;
    if(LotsFactor<=0)
    {
    LotsFactor=1;
    }
    return(LotsFactor);
    }
    }
    }
    }
    }
    return (LotsFactor);
    }

  2. #2
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Hi przem81621,

    Try this :

    Code:
    int MartingaleFactor()
    {
       int counter=0;
       int histotal=OrdersHistoryTotal();
       if(histotal>0 && OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
       {
          for(int cnt=X;cnt>=1;cnt--)
          {
             if(OrderSelect(histotal-cnt,SELECT_BY_POS,MODE_HISTORY) && OrderProfit()>=0)continue;
             if(OrderSelect(histotal-cnt,SELECT_BY_POS,MODE_HISTORY) && OrderProfit()<0)counter++;
          }
       }
       if(counter==X)LotsFactor=LotsFactor*Multiplier;else LotsFactor=InitialLotsFactor;
       if(LotsFactor<=0)
       {
           LotsFactor=1;
       }
       return(LotsFactor);
    }

  3. #3
    Junior Member
    Join Date
    Jan 2009
    Posts
    18

    Default

    thank you very much needed this

Similar Threads

  1. Insurance Against Trading Losses
    By IVBrokers in forum Brokers
    Replies: 4
    Last Post: 01-30-2016, 14:05
  2. Implementing Stop Losses: a How Guide
    By painofhell in forum Trading discussion
    Replies: 0
    Last Post: 02-20-2015, 19:04
  3. Count all the open profits and losses
    By fxtester in forum MQL programming
    Replies: 0
    Last Post: 08-20-2014, 15:13
  4. Do you accept losses in forex
    By shereali in forum Trading discussion
    Replies: 2
    Last Post: 02-13-2014, 02:35

Tags for this Thread

add, martingale, thank you

Posting Permissions

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