Topic: Entry Size Relative to SL-Account Balance for Porfolio Experts

Hye guys,

So with the help of other users I got my strategies working with a entry size relative to account balance and stop loss ie risk 1% of account balance by calculating the $ amount of the SL

Replace EntryAmount with:

double Entry_Amount;
input double MaxRiskPerTrade = 1;
input int Maximum_Lots = 5; 
input double Minimum_Lots = 0.01;

Replace void OnTick() with:

void OnTick()
  int margin=(int) MarketInfo(_Symbol,MODE_MARGINREQUIRED);
      Entry_Amount = NormalizeEntrySize(Entry_Amount);
  double NormalizeEntrySize(double size) {
   double minlot  = MarketInfo(_Symbol, MODE_MINLOT);
   double maxlot  = MarketInfo(_Symbol, MODE_MAXLOT);
   double lotstep = MarketInfo(_Symbol, MODE_LOTSTEP);

   if  (size <= minlot)
        size = minlot;
    if   (size <=Minimum_Lots)
        size = Minimum_Lots;


   if (size >= maxlot)
       size = maxlot;
   if (size >=Maximum_Lots)
       size = Maximum_Lots;
   size = NormalizeDouble(size, digits);   

   return (size);

Now the next probelm im hoping someone can help me with is intergrating this code with a portfolio expert.
I can get it to work with a using the same StopLoss amount for all strategies however that isnt very practical. I feel the code is almost there however I just need to somehow call up the StopLoss of each strategy and insert it in the calculation for Entry_Amount. I am very new to coding so Im finding it quite difficult