iClose - Subtilité ? - page 2

 

Hello, 

Voici les deux méthodes pour identifier des eveningstar / morningstar. 

J'ai testé uniquement sur AUDUSD, leur réussite n'était pas concluante.

//+------------------------------------------------------------------+
//| Checks formation of Evening star candlestick pattern             |
//+------------------------------------------------------------------+
double candlePatternsHelper::isEveningStar() 
{
    MqlRates rates[];
    int copied=CopyRates(NULL,0,0,4,rates);
    ArraySetAsSeries(rates,true);

    if(copied>2)
    {
    double candle1Body = MathAbs(rates[1].open - rates[1].close);
    double candle2Body = MathAbs(rates[2].open - rates[2].close);
    double candle3Body = MathAbs(rates[3].close - rates[3].open);

        if (
        (rates[3].close > rates[3].open)                                                               && // Check if the first candle is bullish
        (rates[1].close < rates[1].open)                                                               && // Check if the third candle is bearish
        (MathAbs(rates[2].close - rates[2].open) < (MathAbs(rates[2].high - rates[2].low) * 0.3))      && // Check if the second candle is a a little candle
        (rates[2].high > rates[1].high) && (rates[2].high > rates[3].high)                             && // Check if the second candle is higher than the others
        (MathAbs(rates[1].close - rates[1].open) > (MathAbs(rates[1].high - rates[1].low) * 0.7))      && // Check if the third candle is a a strong candle
        (MathAbs(rates[3].close - rates[3].open) > (MathAbs(rates[3].high - rates[3].low) * 0.7))      && // Check if the first candle is a a strong candle
        (rates[2].close > rates[1].open)                                                               && // Check if the third candles opens under closure of second candle
        (candle1Body >= candle2Body*2.5 && candle3Body >= candle2Body*2.5))                               // Check if candle 1 et 3 have bigger body than 2
        {
            
            return rates[2].high;
        }
    }
    else {
      return 0;
    }
    // No Evening Star pattern found
    return 0;
}

//+------------------------------------------------------------------+
//| Checks formation of Morning star candlestick pattern             |
//+------------------------------------------------------------------+
double candlePatternsHelper::isMorningStar() 
{
    MqlRates rates[];
    int copied=CopyRates(NULL,0,0,4,rates);
    ArraySetAsSeries(rates,true);

    if(copied>2)
    {
    double candle1Body = MathAbs(rates[1].open - rates[1].close);
    double candle2Body = MathAbs(rates[2].open - rates[2].close);
    double candle3Body = MathAbs(rates[3].close - rates[3].open);

        if (
        (rates[3].close < rates[3].open)                                                               && // Check if the first candle is bearish
        (rates[1].close > rates[1].open)                                                               && // Check if the third candle is bullish
        (MathAbs(rates[2].close - rates[2].open) < (MathAbs(rates[2].high - rates[2].low) * 0.3))      && // Check if the second candle is a a little candle
        (rates[2].low < rates[1].low) && (rates[2].low < rates[3].low)                                 && // Check if the second candle is lower than the others
        (MathAbs(rates[1].close - rates[1].open) > (MathAbs(rates[1].high - rates[1].low) * 0.7))      && // Check if the third candle is a a strong candle
        (MathAbs(rates[3].close - rates[3].open) > (MathAbs(rates[3].high - rates[3].low) * 0.7))      && // Check if the first candle is a a strong candle
        (rates[2].close < rates[1].open)                                                               && // Check if the third candles opens above closure of second candle
        (candle1Body >= candle2Body*2.5 && candle3Body >= candle2Body*2.5))                               // Check if candle 1 et 3 have bigger body than 2
        {

            return rates[2].low;
        }
    }
    else {
      return 0;
    }
    // No Morning Star pattern found
    return 0;
}
 
Merci pour le code. Si j'ai le temps je verrais pour voir si j'arrive à les détecter. 
 

Ca fonctionne. 

Pour l'instant c'est juste que c'est pas rentable :) 

En revanche je suis preneur si vous trouvez une quelconque amélioration ;)


En tout cas merci beaucoup de votre aide !