Add a martingale

Page 2 of 5 FirstFirst 1234 ... LastLast
Results 11 to 20 of 46
 8 Attachment(s)    

Thread: Add a martingale

  1. #11

    Default

    TY...now I understand...truly is as simple as explained... it starts over after its first win....I am going to the gym now and "Think" ☺

    ES


    Quote Originally Posted by funyoo View Post
    enter with 0.01
    loss > enter with 0.02
    loss > enter with 0.04
    loss > enter with 0.08
    win > enter with 0.01
    loss > enter with 0.02
    ...

    enter with 0.01
    loss > enter with 0.02
    loss > enter with 0.04
    loss > enter with 0.08
    win > enter with 0.01
    win > enter with 0.01
    loss > enter with 0.02
    ...

  2. #12

    Default

    so what is a conventional martingale.....? This one is supposed to decrease by one level (like going up and down a ladder while half way up) where a conventional keeps doubling until win..

    ES


    Quote Originally Posted by funyoo View Post
    Note that this martingale is not conventionnal. The lots size is increased when there is a loss, and decreased when the is a profit. While it should start again at initial lots when the last serie of consecutive loss finishes on a win.

    If you have a function for a basic martingale, don't hesitate to post :

    After extern parameters, add :

    Code:
    extern double Lots=0.01;//|----------------------lots
    extern bool Martingale=false;//|-----------------martingale
    extern double Multiplier=2.0;//|-----------------multiplier martingale
    extern double MinProfit=50;//--------------------minimum profit to apply the martingale
    After start(){, add :

    Code:
       if(Martingale)CalculateMartingale();Balance=AccountBalance();
    At the end of the code, add :

    Code:
    void CalculateMartingale()
    {
       double InitalLots=0.01;
       double MinLots=MarketInfo(Symbol(),MODE_MINLOT);
       double MaxLots=MarketInfo(Symbol(),MODE_MAXLOT);
       if(Balance!=0.0)
       {
          if(Balance>AccountBalance())Lots=Multiplier*Lots;
          else if((Balance+MinProfit)<AccountBalance())Lots=InitalLots;
          else if((Balance+MinProfit)>=AccountBalance())Lots=Lots;
          if(Lots<MinLots)Lots=MinLots;
          if(Lots>MaxLots)Lots=MaxLots;
       }
       return(0);
    }

  3. #13
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,011

    Default

    Quote Originally Posted by ElectricSavant View Post
    so what is a conventional martingale.....? This one is supposed to decrease by one level (like going up and down a ladder while half way up) where a conventional keeps doubling until win..

    ES
    Since then, I have added the InitialLots, it should work now.

    But I don't know how to use the extern Lots parameter as InitialLots.

    It will only begin from 0.01 with the current code.

    We can't change it except on MetaEditor.

  4. #14

    Default

    Hi Funyoo,
    A simple solution may be to just have another program running that would automatically add/modify the Stop Loss to a set value on "every" order, after it's been created. Doing it this way wouldn't require any modification to the EA. Is this a possibility? Thanks Bill

  5. #15
    Member
    Join Date
    Jan 2009
    Location
    Austria
    Posts
    324

    Default

    Quote Originally Posted by funyoo View Post
    Since then, I have added the InitialLots, it should work now.

    But I don't know how to use the extern Lots parameter as InitialLots.

    It will only begin from 0.01 with the current code.

    We can't change it except on MetaEditor.

    Hi funyoo,

    maybe a solution:

    check the market if ranging or trending
    - if trending- set lot size to 0.1
    - if ranging- set lot size to 0.01

    how to check the market?
    calculate the 1H, 4H, 1 day, 5 days, 10 days, 20 days average
    - if the 1H+4H is higher as the 1/5/10/20 days average - market is trending
    - if the 1H+4H is lower as the 1/5/10/20 days average - market is ranging

    well, i think, 15,30 min are not suited for decisions if a market is trending or ranging

    As a 4H trader i use 1day and up calculation

    regards

    IX

  6. #16
    Junior Member
    Join Date
    Jan 2009
    Posts
    10

    Default

    Quote Originally Posted by funyoo View Post


    After extern parameters, add :

    I`ll get errors-> Balance - variable is not defined

    ?

  7. #17
    Junior Member
    Join Date
    Jan 2009
    Posts
    10

    Default

    Okey, no problem anymore with Balance.

  8. #18
    Junior Member
    Join Date
    May 2009
    Posts
    4

    Default me2

    Quote Originally Posted by juhanimi View Post
    I`ll get errors-> Balance - variable is not defined

    ?
    I`ll get errors too

    PLEASE HELP ME
    Last edited by sadeghdota; 08-25-2009 at 12:04. Reason: PLEASE HELP ME

  9. #19
    Junior Member
    Join Date
    Jan 2009
    Posts
    18

    Default

    put int Balance;

  10. #20
    Junior Member
    Join Date
    May 2009
    Posts
    4

    Default I Can't Understand



    plz write complet cod wite balance;
    tnx


    Quote Originally Posted by funyoo View Post
    Note that this martingale is not conventionnal. The lots size is increased when there is a loss, and decreased when the is a profit. While it should start again at initial lots when the last serie of consecutive loss finishes on a win.

    If you have a function for a basic martingale, don't hesitate to post :

    After extern parameters, add :

    Code:
    extern double Lots=0.01;//|----------------------lots
    extern bool Martingale=false;//|-----------------martingale
    extern double Multiplier=2.0;//|-----------------multiplier martingale
    extern double MinProfit=50;//--------------------minimum profit to apply the martingale
    After start(){, add :

    Code:
       if(Martingale)CalculateMartingale();Balance=AccountBalance();
    At the end of the code, add :

    Code:
    void CalculateMartingale()
    {
       double InitalLots=0.01;
       double MinLots=MarketInfo(Symbol(),MODE_MINLOT);
       double MaxLots=MarketInfo(Symbol(),MODE_MAXLOT);
       if(Balance!=0.0)
       {
          if(Balance>AccountBalance())Lots=Multiplier*Lots;
          else if((Balance+MinProfit)<AccountBalance())Lots=InitalLots;
          else if((Balance+MinProfit)>=AccountBalance())Lots=Lots;
          if(Lots<MinLots)Lots=MinLots;
          if(Lots>MaxLots)Lots=MaxLots;
       }
       return(0);
    }

Similar Threads

  1. RSI + martingale
    By noiahei in forum Ideas for expert advisors
    Replies: 1
    Last Post: 06-21-2010, 16:01
  2. (REQ) Martingale
    By 626mx in forum Ideas for expert advisors
    Replies: 2
    Last Post: 05-05-2010, 00:40
  3. New Martingale EA
    By shaya in forum Scripts and other tools
    Replies: 0
    Last Post: 06-24-2009, 05:50
  4. ATR MA Martingale EA
    By funyoo in forum Expert advisors live statements
    Replies: 0
    Last Post: 02-19-2009, 21:40

Posting Permissions

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


Add a martingale


GadgetVersus GadgetVersus France W3Ask W3Ask Brasil W3Ask Deutschland W3Ask Espaņa W3Ask France W3Ask Italia W3Ask Nederland