Stochastik sieht trotz gleicher Einstellungen unterschiedlich aus

 

Hallo, ich habe 2 EAs die jeweils einen Stochastik-Osccilator benutzen, sie zeigen aber etwas unterschiedliches an:

Einstellungen:

14,3,3

EURUSD M5

22.06.2020

Im Anhang sind zwei Bilder.

Wieso sehen die bei gleichen Einstellungen unterschiedlich aus?

Dateien:
stoch1.PNG  11 kb
stoch2.PNG  11 kb
 
UnknownInnocent:

Hallo, ich habe 2 EAs die jeweils einen Stochastik-Osccilator benutzen, sie zeigen aber etwas unterschiedliches an:

Einstellungen:

14,3,3

EURUSD M5

22.06.2020

Im Anhang sind zwei Bilder.

Wieso sehen die bei gleichen Einstellungen unterschiedlich aus?

Der Unterschied scheint hierher zu kommen:

zum einen:

stochasticHandle = iStochastic(_Symbol,_Period,14,3,3,MODE_SMA,STO_LOWHIGH);

zum anderen:

input group                "Stochastik"
input ENUM_TIMEFRAMES      inpTimeframe               =   PERIOD_CURRENT;    
input int                  inpStochastikKPeriod       =               14;
input int                  inpStochastikDPeriod       =                3;
input int                  inpStochastikSlowing       =                3;
input ENUM_MA_METHOD       inpSochastikMAMode         =         MODE_SMA;
input ENUM_STO_PRICE       inpSochastikStoPRice       =      STO_LOWHIGH;
....
stochasticHandle = iStochastic(_Symbol,inpTimeframe,inpStochastikKPeriod,inpStochastikDPeriod,inpStochastikSlowing,inpSochastikMAMode,inpSochastikStoPRice);

Wieso ist das nicht identisch?

 
Ich sehe da so schnell keinen Unterschied. Sind die Werte denn unterschiedlich?
 
Carl Schreiber:
Ich sehe da so schnell keinen Unterschied. Sind die Werte denn unterschiedlich?

Also ich habe diesen kleinen EA:

//+------------------------------------------------------------------+
//| Includes                                                         |
//+------------------------------------------------------------------+
#include <Trade\Trade.mqh>                   CTrade _trade;             // wird verwendet für die Positionsöffnungen
#include <Trade\SymbolInfo.mqh>              CSymbolInfo _symbol;       // wird verwendet für die Symbol Information Funktionen
#include <Expert\Money\MoneyFixedRisk.mqh>   CMoneyFixedRisk _money;    // wird verwendet für die Lot-Größen-Berechnung
//+------------------------------------------------------------------+
//| Input Variablen                                                  |
//+------------------------------------------------------------------+
input group                "GENERAL"
input ENUM_TIMEFRAMES      inpTimeframe               =   PERIOD_CURRENT;    // timeframe
input ENUM_APPLIED_PRICE   inpAppliedPrice            =      PRICE_CLOSE;    // type of price

input group                "Risiko";
input double               inpRisiko                  =                2;     // Risiko in Prozent vom Kapital
input double               inpKapital                 =                0;     // Kapital, 0 = full account Balance

input group                "Stochastik"
input int                  inpStochastikKPeriod       =               14;
input int                  inpStochastikDPeriod       =                3;
input int                  inpStochastikSlowing       =                3;
input ENUM_MA_METHOD       inpSochastikMAMode         =         MODE_SMA;
input ENUM_STO_PRICE       inpSochastikStoPRice       =      STO_LOWHIGH;

input group                "EMA"
input int                  inpEMAPeriod               =              200;
input ENUM_MA_METHOD       inpMAMethod                =         MODE_EMA;
//+------------------------------------------------------------------+
//| Variablen                                                        |
//+------------------------------------------------------------------+
double KArray[], DArray[];
int stochasticHandle;

double buEMA[];
int emaHandle;

MqlRates rates[];

//-- Variablen, um neue Kerze zu erkennen
static datetime ZeitstempelLetzterCheck;
datetime ZeitstempelAktuelleKerze;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit() {
   
   //stochasticHandle = iStochastic(_Symbol,inpTimeframe,inpStochastikKPeriod,inpStochastikDPeriod,inpStochastikSlowing,inpSochastikMAMode,inpSochastikStoPRice);
   stochasticHandle = iStochastic(_Symbol,_Period,14,3,3,MODE_SMA,STO_LOWHIGH);
   emaHandle = iMA(_Symbol,_Period,200,0,MODE_EMA,PRICE_CLOSE);
   
   ArraySetAsSeries(KArray,true);
   ArraySetAsSeries(DArray,true);
   ArraySetAsSeries(rates,true);
   ArraySetAsSeries(buEMA,true);
   
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick() {
   
   double ask = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   double bid = SymbolInfoDouble(_Symbol,SYMBOL_BID);
   
   CopyBuffer(stochasticHandle,0,0,3,KArray);
   CopyBuffer(stochasticHandle,1,0,3,DArray);
   CopyBuffer(emaHandle,0,0,20,buEMA);
   CopyRates(_Symbol,_Period,0,20,rates);
   
   ZeitstempelAktuelleKerze = rates[0].time;
   
   checkPositions(ask,bid);
   
   if(ZeitstempelLetzterCheck != ZeitstempelAktuelleKerze) 
   {  
      
      ZeitstempelLetzterCheck = ZeitstempelAktuelleKerze;
      if(checkCandlesBeforeFormation("buy",buEMA) &&
         KArray[1] < 25 && DArray[1] < 25 &&
         KArray[1] > DArray[1] && KArray[2] < DArray[2])
            _trade.Buy(1,NULL,ask,(ask-150*_Point),(ask+250*_Point),NULL);
            
      if(checkCandlesBeforeFormation("sell",buEMA) &&
         KArray[1] > 80 && DArray[1] > 80 &&
         KArray[1] < DArray[1] && KArray[2] > DArray[2])
            _trade.Sell(1,NULL,bid,(bid+150*_Point),(bid-250*_Point),NULL);
   }
}
//+------------------------------------------------------------------+

void checkPositions(double ask, double bid) {

   if(PositionsTotal() < 1)
      return;
      
   for(int i = 0; i < PositionsTotal(); i++) {
      
      string symbol = PositionGetSymbol(i); //Symbol der Position i
      if(_Symbol == symbol) {
         ulong  posTicket     =  PositionGetInteger(POSITION_TICKET);    // Positionsticket
         int    posDirection  =  (int)PositionGetInteger(POSITION_TYPE); // Positionsrichtung          
         double posOpen       =  PositionGetDouble(POSITION_PRICE_OPEN); // Öffnungspreis der Position
         double posSL         =  PositionGetDouble(POSITION_SL);         // SL der Position
         double posVolume     =  PositionGetDouble(POSITION_VOLUME);     // Volumen der Position
         string comment       =  PositionGetString(POSITION_COMMENT);    // Comment der Position
         double posTP         =  PositionGetDouble(POSITION_TP);
         
//------- Short Position         
         if(posDirection == POSITION_TYPE_SELL) {
            double abstand = MathAbs(bid-posOpen);
            double pips = MathAbs(MathRound(abstand * MathPow(10,_Digits)));
            if(pips >= 100 && posSL > posOpen && bid < posOpen) {
               _trade.PositionClosePartial(posTicket,(posVolume*0.2),-1);
               _trade.PositionModify(posTicket,rates[4].high,posTP);
            } else if(posSL <= posOpen) {
               _trade.PositionModify(posTicket,rates[4].high,posTP);
            }
         }
//------- Long Position 
         if(posDirection == POSITION_TYPE_BUY) {
            double abstand = MathAbs(ask-posOpen);
            double pips = MathAbs(MathRound(abstand * MathPow(10,_Digits)));
            if(pips >= 100 && posSL < posOpen && ask > posOpen) {
               _trade.PositionClosePartial(posTicket,(posVolume*0.2),-1);
               _trade.PositionModify(posTicket,rates[4].low,posTP);
            } else if(posSL >= posOpen) {
               _trade.PositionModify(posTicket,rates[4].low,posTP);
            }
         } 
      }

   }
}

//+------------------------------------------------------------------+
//| überprüfe ob vorherige 15 Kerzen über bzw. unter EMA waren       |
//+------------------------------------------------------------------+
bool checkCandlesBeforeFormation(string direction, double &ema[]) {
   
   if(direction == "buy" && ArraySize(rates) >= 17) 
   {
      for(int i = 1; i < 17; i++) {
         if(rates[i].close <= ema[i])
            return false;
      }
      return true;
   }
   else if(direction == "sell" && ArraySize(rates) >= 17)
   {
      for(int i = 1; i < 17; i++) {
         if(rates[i].close >= ema[i])
            return false;
      }
      return true;
   }
   else
      return false;
}

den ich gerade versuche etwas schöner zu programmieren. Wenn ich das verwende:

stochasticHandle = iStochastic(_Symbol,_Period,14,3,3,MODE_SMA,STO_LOWHIGH);

macht er 715€ plus, bei dem hier:

stochasticHandle = iStochastic(_Symbol,inpTimeframe,inpStochastikKPeriod,inpStochastikDPeriod,inpStochastikSlowing,inpSochastikMAMode,inpSochastikStoPRice);

186€ minus...

 

Der Unterschied kommt vom MODE_SMA.. Wieso da aber ein Unterschied zwischen

dem input und dem normalen ist kann ich nicht sagen...

Grund der Beschwerde: