1. 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

Originally Posted by funyoo
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. 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

Originally Posted by funyoo
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 :

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```

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. Originally Posted by ElectricSavant
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. 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. Originally Posted by funyoo
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. Originally Posted by funyoo

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

?

7. Okey, no problem anymore with Balance.

8. ## me2

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

?
I`ll get errors too

9. put int Balance;

10. ## I Can't Understand

plz write complet cod wite balance;
tnx

Originally Posted by funyoo
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 :

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```

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);
}```

#### Posting Permissions

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