forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Forum

Forex Software, Forex Strategies, Expert Advisors Generator

You are not logged in. Please login or register.


Forex Forum → Expert Advisor Modifications → How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 5

Topic: How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

Dear EA Studio Users,

I'd like to share an easy method to add a simple money management to your portfolio expert. I'm not a mql expert, I just want to share something I know and personally use.

By applying this money managament the EA will increase the lot size by 0.01 lot per 1000 balance.

You need to open your mq4 files via metaeditor first.

Okay, here are the steps

1. Replace this code

static input double Entry_Amount      = 0.01; // Entry lots

with this

extern bool Auto_Lot=1;
extern double Risk_Multiplier=1;
static input double Entry_Amount      = 0.01; // Entry lots

2. Replace this code

      double stopLoss   = signal.StopLossPips>0 ? GetStopLoss(command, signal.StopLossPips) : 0;
      double takeProfit = signal.TakeProfitPips>0 ? GetTakeProfit(command, signal.TakeProfitPips) : 0;
      string comment    = IntegerToString(signal.MagicNumber);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

with this

      if(!Auto_Lot){amount=Entry_Amount;}else
      if(Auto_Lot){
      amount=((AccountBalance()*Risk_Multiplier)/100)/1000;
      } 
      double stopLoss   = signal.StopLossPips>0 ? GetStopLoss(command, signal.StopLossPips) : 0;
      double takeProfit = signal.TakeProfitPips>0 ? GetTakeProfit(command, signal.TakeProfitPips) : 0;
      string comment    = IntegerToString(signal.MagicNumber);
      color  arrowColor = command==OP_BUY ? clrGreen : clrRed;

if(amount<=MarketInfo(_Symbol,MODE_MINLOT)){amount=MarketInfo(_Symbol,MODE_MINLOT);Comment("______ Use MIN LOT ______");}else
if(amount>=MarketInfo(_Symbol,MODE_MAXLOT)){amount=MarketInfo(_Symbol,MODE_MAXLOT);Comment("______ Use MAX LOT ______");}else
Comment("");

Done, now you can compile and backtest your EA to see if it works. Risk_Multiplier=1 means 0.01 lot per 1000, Risk_Multiplier=2 means 0.02 lot per 1000, and so on.

I hope you'll find it useful.

Best regards.

do or do not there is no try

Re: How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

nice work.

is there an opportunity to add also autlotcalculation only on account balance..i mean your way and if i say autolotcalculation true than ea do autolot with from accountbalance in percent.

i mean from with thread https://forexsb.com/forum/topic/6251/au … lculation/ with min max lot detection.

Re: How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

Hi guys,

I want to put a money management code in my EA but can't find any of those lines you are referring to. Can you help me?

Re: How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

zaphod72 wrote:

Hi guys,

I want to put a money management code in my EA but can't find any of those lines you are referring to. Can you help me?

This trick is for portfolio expert mq4 files generated by EA Studio, did you open the correct file?

do or do not there is no try

5 (edited by zaphod72 2018-11-18 05:11:43)

Re: How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

This trick is for portfolio expert mq4 files generated by EA Studio, did you open the correct file?


Yeah, I found them but I want to add another code for MM and I don't think I can do it... Can you help me with that?

Posts: 5

Pages 1

You must login or register to post a reply

Forex Forum → Expert Advisor Modifications → How to Add a Simple Money Management for Portfolio EA in 2 Easy Steps

Similar topics in this forum


Generated in 0.011 seconds (79% PHP - 21% DB) with 11 queries