Topic: EA should work on fix Lot or dynamic lot
Hi,
if i want to change an EA that i can decide in settings if it work with fixed lot size or dynamic percentage lot
How can i solve that
Create and Test Forex Strategies
You are not logged in. Please login or register.
Forex Software → Expert Advisor Modifications → EA should work on fix Lot or dynamic lot
Hi,
if i want to change an EA that i can decide in settings if it work with fixed lot size or dynamic percentage lot
How can i solve that
I have such option in my ToDo list. However, now I'm overloaded with other tasks, so it will take some time to to add it.
I'm currently working on Walk - Forward analysis module and hope to release it within next two weeks.
I have such option in my ToDo list. However, now I'm overloaded with other tasks, so it will take some time to to add it.
I'm currently working on Walk - Forward analysis module and hope to release it within next two weeks.
Hi, Popov
Walk - Forward Analysis module that you mention to, where the module is in EA Studio or FSB Pro or both of them?
when will it gonna be available. or have someone a good ready function code?
It's pretty easy to modify the EA yourself to use variable lots.
In the public declarations section at the top, add the following line right below the declaration for Entry_Amount:
static input bool Auto_Lot = false; // Auto lot size
Scroll down to the OpenPosition function, and add this code at the bottom of the declarations section (where it says "color arrowColor ="):
double Order_Size = Entry_Amount * (AccountBalance() / 10000);
if (Auto_Lot == false) Order_Size = Entry_Amount;
And then go through the rest of that function, replacing every instance of Entry_Amount with Order_Size (should be three instances).
It's pretty easy to modify the EA yourself to use variable lots.
In the public declarations section at the top, add the following line right below the declaration for Entry_Amount:
static input bool Auto_Lot = false; // Auto lot size
Scroll down to the OpenPosition function, and add this code at the bottom of the declarations section (where it says "color arrowColor ="):
double Order_Size = Entry_Amount * (AccountBalance() / 10000); if (Auto_Lot == false) Order_Size = Entry_Amount;
And then go through the rest of that function, replacing every instance of Entry_Amount with Order_Size (should be three instances).
i have done it now like this.
//+------------------------------------------------------------------+
//|LOTCALCULATION |
//+------------------------------------------------------------------+
double NormalizeEntrySize(double size) {
double minlot = MarketInfo(_Symbol, MODE_MINLOT);
double lotstep = MarketInfo(_Symbol, MODE_LOTSTEP);
if (size <= minlot)
return (minlot);
int steps = (int) MathRound((size - minlot) / lotstep);
size = minlot + steps * lotstep;
if (size >= Maximum_Lots)
size = Maximum_Lots;
size = NormalizeDouble(size, digits);
return (size);
}
and in OpenPosition
added this
int margin=(int) MarketInfo(_Symbol,MODE_MARGINREQUIRED);
double Entry_Amount=(Entry_Percent/100)*AccountEquity()/margin;
Entry_Amount = NormalizeEntrySize(Entry_Amount);
if(useFixedLot==true)
Entry_Amount = Entry_Lots;
Forex Software → Expert Advisor Modifications → EA should work on fix Lot or dynamic lot
Powered by PunBB, supported by Informer Technologies, Inc.