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

Re: EA should work on fix Lot or dynamic lot

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.

Re: EA should work on fix Lot or dynamic lot

Popov wrote:

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?

Re: EA should work on fix Lot or dynamic lot

It will be in EA Studio first.

Re: EA should work on fix Lot or dynamic lot

when will it gonna be available. or have someone a good ready function code?

Re: EA should work on fix Lot or dynamic lot

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

Re: EA should work on fix Lot or dynamic lot

shalem2014 wrote:

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;