1 (edited by yonkuro 2018-06-03 14:33:10)

Topic: Different Porfolio Result Between MT4 and EA Studio

Hi Popov,

I got different result on EA Studio Portfolio EA, strangely enough, the individual test on each single EA was okay
https://i.imgur.com/dTMzChN.png

I used same historical data and condition for the test.

The EAs and strategy tester files are attached.

Best Regards

Post's attachments

EAs.zip 65.75 kb, 3 downloads since 2018-06-03 

You don't have the permssions to download the attachments of this post.
Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

I found an interesting thing, I created a strategy then I converted it to EA twice, first from strategy tab, and second from portfolio tab.

Then I tested them on MT4 strategy tester, the first EA gave indentical result, but second EA which created from portfolio tab had completely different result
https://i.imgur.com/kmmRLGd.png
Both EAs are attached.

Best regards.

Post's attachments

Experts.zip 7.7 kb, 6 downloads since 2018-06-03 

You don't have the permssions to download the attachments of this post.
Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

I'll check that. Thank you for the report!

4 (edited by yonkuro 2018-06-03 22:25:12)

Re: Different Porfolio Result Between MT4 and EA Studio

I did another test whic may help, I created another strategy without stop loss, and the result between both EAs were perfectly identical, the previous strategies I created had trailing SL.

So I concluded that the issue probably caused by SL or Trailing SL.

Update: I removed the Trailing SL from the previous strategies and reoptimized it, and the Portfolio EA result become identical to the single EA and also the EA Studio

Post's attachments

Experts 2.zip 7.34 kb, 1 downloads since 2018-06-03 

You don't have the permssions to download the attachments of this post.
Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

what i noticed is that when i have 5 strategies in portfolio and test it with a nice result. but when i put manually all 5 strategies in 1 than i get much differences.

6 (edited by yonkuro 2018-06-04 23:07:14)

Re: Different Porfolio Result Between MT4 and EA Studio

Did you use trailing stop?

I had checked
my backtest journal and based on the first trade opened, I found that the portfolio EA and the single EA handled trailing stop in different way.

I have no problem with strategy that didn't utilize trailing stop.

Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

I can confirm this too, as soon as a trailing stop is being used, the results are wrong if exported via portfolio, even if the portfolio just contains 1 system. This is clearly a bug.

Re: Different Porfolio Result Between MT4 and EA Studio

Good job with the debugging.

I'll check that tomorrow. It must be easy to be fixed.

Re: Different Porfolio Result Between MT4 and EA Studio

portfolio ea makes his own ea. but when i do all manually in one exported ea so it must trade like portfolio i think. but there different results.
This changes done

static input string StrategyProperties__ = "------------"; // ------ Expert Properties ------
static input double Entry_Amount = 0.10; // Entry lots
input bool                 EnableStrategy1 = true; //USE STRATEGY 1
input int                  Stop_Loss   = 245; // Stop Loss Strategy 1 (pips)
input int                  Take_Profit = 11; // Take Profit Strategy 1(pips)
static input string        Settings2 = "------------"; // ------ SETTINGS STRATEGY 2 ------
input bool                 EnableStrategy2 = true; //USE STRATEGY 2
input int                  Stop_Loss2   = 245; // Stop Loss Strategy 2(pips)
input int                  Take_Profit2 = 11; // Take Profit Strategy 2(pips)
static input string        Settings3 = "------------"; // ------ SETTINGS STRATEGY 3 ------
input bool                 EnableStrategy3 = true; //USE STRATEGY 3
input int                  Stop_Loss3   = 212; // Stop Loss Strategy 3(pips)
input int                  Take_Profit3 = 228; // Take Profit Strategy 3(pips)
//Input parameters str1

static input string Ind0 = "------------";// ----- Alligator -----
input int Ind0Param0 = 32; // Jaws period
input int Ind0Param1 = 10; // Jaws shift
input int Ind0Param2 = 10; // Teeth period
input int Ind0Param3 = 6; // Teeth shift
input int Ind0Param4 = 6; // Lips period
input int Ind0Param5 = 5; // Lips shift
static input string Ind1 = "------------";// ----- Bollinger Bands -----
input int Ind1Param0 = 40; // Period
input double Ind1Param1 = 3.54; // Deviation
//Input parameters str2
static input string s2Ind0 = "------------";// ----- Moving Average -----
input int s2Ind0Param0 = 24; // Period
input int s2Ind0Param1 = 0; // Shift
static input string s2Ind1 = "------------";// ----- DeMarker -----
input int s2Ind1Param0 = 38; // Period
input double s2Ind1Param1 = -0.15; // Level
//Input parameters str2
static input string s3Ind0 = "------------";// ----- RVI Signal -----
input int s3Ind0Param0 = 10; // Period
static input string s3Ind1 = "------------";// ----- Moving Average -----
input int s3Ind1Param0 = 37; // Period
input int s3Ind1Param1 = 0; // Shift

in Onbar i add this

void OnBar()
  {
   UpdatePosition();

   if(posType!=OP_FLAT && IsForceSessionClose())
     {
      ClosePosition();
      return;
     }

   if(IsOutOfSession())
      return;

   if(posType!=OP_FLAT)
     {
      ManageClose();
      ManageClose2();
      ManageClose3();            
      UpdatePosition();
     }

   if(posType!=OP_FLAT && isTrailingStop)
     {
      double trailingStop=GetTrailingStop();
      ManageTrailingStop(trailingStop);
      UpdatePosition();
     }

   if(posType==OP_FLAT)
     {
      ManageOpen();
      ManageOpen2();
      ManageOpen3();            
      UpdatePosition();
     }
  }

Than i add all manageopen and manageclose like this

void ManageOpen()
  {
   double ind0val1 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORLIPS,1);
   double ind0val2 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORTEETH,1);
   double ind0val3 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORLIPS,2);
   double ind0val4 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORTEETH,2);
   bool ind0long  = ind0val1 > ind0val2 + sigma && ind0val3 < ind0val4 - sigma;
   bool ind0short = ind0val1 < ind0val2 - sigma && ind0val3 > ind0val4 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose()
  {
   double ind1upBand1 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_UPPER,1);
   double ind1dnBand1 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_LOWER,1);
   double ind1upBand2 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_UPPER,2);
   double ind1dnBand2 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_LOWER,2);
   bool ind1long  = Open[0] < ind1dnBand1 - sigma && Open[1] > ind1dnBand2 + sigma;
   bool ind1short = Open[0] > ind1upBand1 + sigma && Open[1] < ind1upBand2 - sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageOpen2()
  {
   double ind0val1 = iMA(NULL,0,s2Ind0Param0,s2Ind0Param1,MODE_SMA,PRICE_CLOSE,1);
   double ind0val2 = iMA(NULL,0,s2Ind0Param0,s2Ind0Param1,MODE_SMA,PRICE_CLOSE,2);
   bool ind0long  = Open[0] > ind0val1 + sigma && Open[1] < ind0val2 - sigma;
   bool ind0short = Open[0] < ind0val1 - sigma && Open[1] > ind0val2 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose2()
  {
   double ind1val1 = iDeMarker(NULL,0,s2Ind1Param0,1);
   bool ind1long  = ind1val1 < s2Ind1Param1 - sigma;
   bool ind1short = ind1val1 > 1 - s2Ind1Param1 + sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageOpen3()
  {
   double ind0val1 = iRVI(NULL,0,s3Ind0Param0,MODE_MAIN,1) - iRVI(NULL,0,s3Ind0Param0,MODE_SIGNAL,1);
   double ind0val2 = iRVI(NULL,0,s3Ind0Param0,MODE_MAIN,2) - iRVI(NULL,0,s3Ind0Param0,MODE_SIGNAL,2);
   bool ind0long  = ind0val1 > 0 + sigma && ind0val2 < 0 - sigma;
   bool ind0short = ind0val1 < 0 - sigma && ind0val2 > 0 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose3()
  {
   double ind1val1 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,1);
   double ind1val2 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,2);
   double ind1val3 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,3);
   bool ind1long  = ind1val1 > ind1val2 + sigma && ind1val2 < ind1val3 - sigma;
   bool ind1short = ind1val1 < ind1val2 - sigma && ind1val2 > ind1val3 + sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }  

And at last this

double GetStopLoss(int command)
  {
   if(Stop_Loss==0 ||Stop_Loss2==0||Stop_Loss3==0)
      return (0);

if(EnableStrategy1==true)
   {                   
   double delta    = MathMax(pip*Stop_Loss, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   }
   if(EnableStrategy2==true)
   {
      double delta    = MathMax(pip*Stop_Loss2, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   }
   if(EnableStrategy3==true)
   {
      double delta    = MathMax(pip*Stop_Loss3, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   } else return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double GetTakeProfit(int command)
  {
   if(Take_Profit==0||Take_Profit2==0||Take_Profit3==0)
      return (0);
   if(EnableStrategy1==true)
   {
   double delta      = MathMax(pip*Take_Profit, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));
   }
   if(EnableStrategy2==true)
   {
   double delta      = MathMax(pip*Take_Profit2, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));   
   }
   if(EnableStrategy3==true)
   {
   double delta      = MathMax(pip*Take_Profit3, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));   
   }else return(0);
  }   

So now i have 3 strategies in one Its like i have had make a portfolio. But in portfolio i have nice results and when i do it like this above whats the same i get different results.

10 (edited by GD 2018-06-06 01:27:05)

Re: Different Porfolio Result Between MT4 and EA Studio

There are problems with portfolio EAs in FSB pro and EA Studio. It is better to use an EA Loader.
Maybe Popov can make something on that until he will find solutions with portfolio EAs
Brokers games make me tired.

Re: Different Porfolio Result Between MT4 and EA Studio

GD wrote:

There are problems with portfolio EAs in FSB pro and EA Studio. It is better to use an EA Loader.
Maybe Popov can make something on that until he will find solutions with portfolio EAs
Brokers games make me tired.


What loader do you mean?

12 (edited by GD 2018-06-06 17:29:51)

Re: Different Porfolio Result Between MT4 and EA Studio

You need to create with a software .chr file automatically for each EA you select and then just load a Profile made for these chr files from same software. It can be maybe with a script?

Also check this https://www.mql5.com/en/forum/115967

Did Popov fixed problem yet?

13 (edited by GD 2018-06-07 04:22:31)

Re: Different Porfolio Result Between MT4 and EA Studio

ONE MORE BUG

1. I upload a collection to portfolio having collection EMPTY
2. I select one strategy from portfolio>content to see it in editor. Then automatically this strategy is added to collection, which was previously empty!


ANOTHER BUG

1. I upload a collection to Collection with portfolio empty
2. I add one strategyfrom collection to an EMPTY portfolio
3. I delete same sttrategy in collection
4. I select this strategy (which is only one) in portfolio. Then this strategy is added to portfolio!
Is it normal? No?

This bugs can decrease number of different strategies inside a collection. I am afraid to edit!!!

Trade safe

Re: Different Porfolio Result Between MT4 and EA Studio

I found that the portfolio expert doesn't trail the stop correctly. Still cannot find the reason but I will work on that today. I will try to publish an update this afternoon.

When this is ready, I'll go on the other reported cases one by one.

Thank you for your reports! They make the program better.

15

Re: Different Porfolio Result Between MT4 and EA Studio

Dear Popov

I am more than 35 years programmer (not in EAs) and I know how difficult is to make things to work perfect in complicate stuff. Please take your time and bring back a nice result. Just inform us.

Regards

G

Re: Different Porfolio Result Between MT4 and EA Studio

My current problem is that cannot make the MT Tester to show log of the backtests of the single strategy and the Portfolio. I set  starting period from January 1st, it shows log from May 10th !?!?! For 4 hours I cannot reliably compare the deals and the order modifications. Anyway, I'll fix it for sure. 

Thank you for the support!

Re: Different Porfolio Result Between MT4 and EA Studio

The problem with the Trailing Stop Loss in the portfolio Expert is fixed. Now I have a complete match between the MT4 backtest of a single strategy and a Portfolio of the same strategy.

Please test it and report the status. Please be careful with the entry amount of the Portfolio Expert. It is set to 0.01 lots by default, which must be the safest case.

..

I'll examine the other reported problems also.

Re: Different Porfolio Result Between MT4 and EA Studio

1. I upload a collection to portfolio having collection EMPTY
2. I select one strategy from portfolio>content to see it in editor. Then automatically this strategy is added to collection, which was previously empty!

This is correct. The Editor and Optimizer also add strategies to the Collection.

This bugs can decrease number of different strategies inside a collection. I am afraid to edit!!!

This is how EA Studio works. The program is designed to not accept strategies that are already in the Collection. If you have the Correlation Analysis resolution on, it will also take care for the similar strategies.

You may think for the Collection as a "log" or a "cache" of the strategies you are using. It gives you a freedom to create strategies manually, to modify or optimize ones and all they go to the Collection. Then you can sort and filter them. On the other hand, when you use the Generator and want a "clean" Collection, you can empty it first.

The Collection has an one-click download option, which makes it very easy to store all your work. It also gives meaningful names of the exported files.

If you have any ideas of how to make it even better, please post in the 'Wish list". I frequently check it for good ideas and consider the implementation. Whit my current tasks we will have much better app till the end of the year and I also think for a very big improvement after that.

Thank to our partners (more than 20) and to your feedback and ideas the app becomes more and more popular.

Thank you very much for your patience and support.

Trade Safe!

Re: Different Porfolio Result Between MT4 and EA Studio

Thank you very much Popov, I'm gonna try it.

Regards.

Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

The problem is fixed now, thanks again.

Best Forex Software, Best Forex Robot, Best EA Builder, Best EA Generator, Forex Strategy Builder Pro, FSB Pro, EA Studio.
I hope they will be indexed by Google :)

Re: Different Porfolio Result Between MT4 and EA Studio

deadlef wrote:

portfolio ea makes his own ea. but when i do all manually in one exported ea so it must trade like portfolio i think. but there different results.
This changes done

static input string StrategyProperties__ = "------------"; // ------ Expert Properties ------
static input double Entry_Amount = 0.10; // Entry lots
input bool                 EnableStrategy1 = true; //USE STRATEGY 1
input int                  Stop_Loss   = 245; // Stop Loss Strategy 1 (pips)
input int                  Take_Profit = 11; // Take Profit Strategy 1(pips)
static input string        Settings2 = "------------"; // ------ SETTINGS STRATEGY 2 ------
input bool                 EnableStrategy2 = true; //USE STRATEGY 2
input int                  Stop_Loss2   = 245; // Stop Loss Strategy 2(pips)
input int                  Take_Profit2 = 11; // Take Profit Strategy 2(pips)
static input string        Settings3 = "------------"; // ------ SETTINGS STRATEGY 3 ------
input bool                 EnableStrategy3 = true; //USE STRATEGY 3
input int                  Stop_Loss3   = 212; // Stop Loss Strategy 3(pips)
input int                  Take_Profit3 = 228; // Take Profit Strategy 3(pips)
//Input parameters str1

static input string Ind0 = "------------";// ----- Alligator -----
input int Ind0Param0 = 32; // Jaws period
input int Ind0Param1 = 10; // Jaws shift
input int Ind0Param2 = 10; // Teeth period
input int Ind0Param3 = 6; // Teeth shift
input int Ind0Param4 = 6; // Lips period
input int Ind0Param5 = 5; // Lips shift
static input string Ind1 = "------------";// ----- Bollinger Bands -----
input int Ind1Param0 = 40; // Period
input double Ind1Param1 = 3.54; // Deviation
//Input parameters str2
static input string s2Ind0 = "------------";// ----- Moving Average -----
input int s2Ind0Param0 = 24; // Period
input int s2Ind0Param1 = 0; // Shift
static input string s2Ind1 = "------------";// ----- DeMarker -----
input int s2Ind1Param0 = 38; // Period
input double s2Ind1Param1 = -0.15; // Level
//Input parameters str2
static input string s3Ind0 = "------------";// ----- RVI Signal -----
input int s3Ind0Param0 = 10; // Period
static input string s3Ind1 = "------------";// ----- Moving Average -----
input int s3Ind1Param0 = 37; // Period
input int s3Ind1Param1 = 0; // Shift

in Onbar i add this

void OnBar()
  {
   UpdatePosition();

   if(posType!=OP_FLAT && IsForceSessionClose())
     {
      ClosePosition();
      return;
     }

   if(IsOutOfSession())
      return;

   if(posType!=OP_FLAT)
     {
      ManageClose();
      ManageClose2();
      ManageClose3();            
      UpdatePosition();
     }

   if(posType!=OP_FLAT && isTrailingStop)
     {
      double trailingStop=GetTrailingStop();
      ManageTrailingStop(trailingStop);
      UpdatePosition();
     }

   if(posType==OP_FLAT)
     {
      ManageOpen();
      ManageOpen2();
      ManageOpen3();            
      UpdatePosition();
     }
  }

Than i add all manageopen and manageclose like this

void ManageOpen()
  {
   double ind0val1 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORLIPS,1);
   double ind0val2 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORTEETH,1);
   double ind0val3 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORLIPS,2);
   double ind0val4 = iAlligator(NULL,0,Ind0Param0,Ind0Param1,Ind0Param2,Ind0Param3,Ind0Param4,Ind0Param5,MODE_SMMA,PRICE_MEDIAN,MODE_GATORTEETH,2);
   bool ind0long  = ind0val1 > ind0val2 + sigma && ind0val3 < ind0val4 - sigma;
   bool ind0short = ind0val1 < ind0val2 - sigma && ind0val3 > ind0val4 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose()
  {
   double ind1upBand1 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_UPPER,1);
   double ind1dnBand1 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_LOWER,1);
   double ind1upBand2 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_UPPER,2);
   double ind1dnBand2 = iBands(NULL,0,Ind1Param0,Ind1Param1,0,PRICE_CLOSE,MODE_LOWER,2);
   bool ind1long  = Open[0] < ind1dnBand1 - sigma && Open[1] > ind1dnBand2 + sigma;
   bool ind1short = Open[0] > ind1upBand1 + sigma && Open[1] < ind1upBand2 - sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageOpen2()
  {
   double ind0val1 = iMA(NULL,0,s2Ind0Param0,s2Ind0Param1,MODE_SMA,PRICE_CLOSE,1);
   double ind0val2 = iMA(NULL,0,s2Ind0Param0,s2Ind0Param1,MODE_SMA,PRICE_CLOSE,2);
   bool ind0long  = Open[0] > ind0val1 + sigma && Open[1] < ind0val2 - sigma;
   bool ind0short = Open[0] < ind0val1 - sigma && Open[1] > ind0val2 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose2()
  {
   double ind1val1 = iDeMarker(NULL,0,s2Ind1Param0,1);
   bool ind1long  = ind1val1 < s2Ind1Param1 - sigma;
   bool ind1short = ind1val1 > 1 - s2Ind1Param1 + sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }  
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageOpen3()
  {
   double ind0val1 = iRVI(NULL,0,s3Ind0Param0,MODE_MAIN,1) - iRVI(NULL,0,s3Ind0Param0,MODE_SIGNAL,1);
   double ind0val2 = iRVI(NULL,0,s3Ind0Param0,MODE_MAIN,2) - iRVI(NULL,0,s3Ind0Param0,MODE_SIGNAL,2);
   bool ind0long  = ind0val1 > 0 + sigma && ind0val2 < 0 - sigma;
   bool ind0short = ind0val1 < 0 - sigma && ind0val2 > 0 + sigma;

   const bool canOpenLong  = ind0long;
   const bool canOpenShort = ind0short;

   if(canOpenLong && canOpenShort)
      return;

   if(canOpenLong)
      OpenPosition(OP_BUY);
   else if(canOpenShort)
      OpenPosition(OP_SELL);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void ManageClose3()
  {
   double ind1val1 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,1);
   double ind1val2 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,2);
   double ind1val3 = iMA(NULL,0,s3Ind1Param0,s3Ind1Param1,MODE_SMA,PRICE_CLOSE,3);
   bool ind1long  = ind1val1 > ind1val2 + sigma && ind1val2 < ind1val3 - sigma;
   bool ind1short = ind1val1 < ind1val2 - sigma && ind1val2 > ind1val3 + sigma;

   if(posType==OP_BUY && ind1long)
      ClosePosition();
   else if(posType==OP_SELL && ind1short)
      ClosePosition();
  }  

And at last this

double GetStopLoss(int command)
  {
   if(Stop_Loss==0 ||Stop_Loss2==0||Stop_Loss3==0)
      return (0);

if(EnableStrategy1==true)
   {                   
   double delta    = MathMax(pip*Stop_Loss, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   }
   if(EnableStrategy2==true)
   {
      double delta    = MathMax(pip*Stop_Loss2, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   }
   if(EnableStrategy3==true)
   {
      double delta    = MathMax(pip*Stop_Loss3, _Point*stopLevel);
   double price    = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double stopLoss = command==OP_BUY ? price-delta : price+delta;
   return (NormalizeDouble(stopLoss, digits));
   } else return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double GetTakeProfit(int command)
  {
   if(Take_Profit==0||Take_Profit2==0||Take_Profit3==0)
      return (0);
   if(EnableStrategy1==true)
   {
   double delta      = MathMax(pip*Take_Profit, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));
   }
   if(EnableStrategy2==true)
   {
   double delta      = MathMax(pip*Take_Profit2, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));   
   }
   if(EnableStrategy3==true)
   {
   double delta      = MathMax(pip*Take_Profit3, _Point*stopLevel);
   double price      = MarketInfo(_Symbol, command==OP_BUY ? MODE_BID : MODE_ASK);
   double takeProfit = command==OP_BUY ? price+delta : price-delta;
   return (NormalizeDouble(takeProfit, digits));   
   }else return(0);
  }   

So now i have 3 strategies in one Its like i have had make a portfolio. But in portfolio i have nice results and when i do it like this above whats the same i get different results.

@Popov can you explain me this. Why is Portfolio EA making other results as i do it like this. In my opinion this is the same as in Portfolio EA only implemented 3 Strategies in 1. Its like 3 in Portfolio with same open rules and close rules but different results.

Re: Different Porfolio Result Between MT4 and EA Studio

Do you have unique Magic number for each strategy? I don't see it in the changes.

If you purpose is to expose the indicator parameters only, it may be easier to start modifying the Portfolio Expert. There are some special moments that may not be easier to see at the begging.  The MQL codding is more challenging than the regular programming because of the glitches of the MT API.

23 (edited by deadlef 2018-06-09 18:22:44)

Re: Different Porfolio Result Between MT4 and EA Studio

Popov wrote:

Do you have unique Magic number for each strategy? I don't see it in the changes.

If you purpose is to expose the indicator parameters only, it may be easier to start modifying the Portfolio Expert. There are some special moments that may not be easier to see at the begging.  The MQL codding is more challenging than the regular programming because of the glitches of the MT API.

No you must think it should be One EA which is using 3 Strategys in same time. I have implemented an bool variable to enable disable each strategy. So when i use str1 i can enable disable and i get results like i have one normal ea. All strats uses the same magicnumber like one ea with 3 different strategies in it

Re: Different Porfolio Result Between MT4 and EA Studio

it looks like i have to use unique magicnumber..because i think when open a trade than the other strategy can close this trade from his exit parameters. Can someone help me out to code this with unique magicnumber