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
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();
}
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.