Überprüfe das mit dem Debugger, so lernst Du, das zu verstehen!
Carl Schreiber:
Überprüfe das mit dem Debugger, so lernst Du, das zu verstehen
Überprüfe das mit dem Debugger, so lernst Du, das zu verstehen
Das habe ich jetzt versucht un das Ganze so geändert:
if(rates_total < 5 || IsStopped()) return 0; int limit; if(prev_calculated<7) { limit=3; //--- clean up arrays ArrayInitialize(ExtUpperBuffer,EMPTY_VALUE); ArrayInitialize(ExtLowerBuffer,EMPTY_VALUE); } else limit=rates_total-4; for(int i=limit;i<rates_total-2 && !IsStopped();i++) { }
Die Signale werden mir auch schön eingezeichnet, allerdings werden vom EA nicht alle übernommen, was ich nicht verstehe. Dafür mal die gesamte onCalculate:
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- if(rates_total < 5 || IsStopped()) return 0; int limit; if(prev_calculated<7) { limit=3; //--- clean up arrays ArrayInitialize(ExtUpperBuffer,EMPTY_VALUE); ArrayInitialize(ExtLowerBuffer,EMPTY_VALUE); } else limit=rates_total-4; for(int i=limit;i<rates_total-2 && !IsStopped();i++) { //---- Three Inside Down if(close[i-1] > open[i-1] && // grüne Kerze close[i] < open[i] && // rote Kerze close[i+1] < open [i+1] && // rote Kerze close[i+1] < open[i-1] && // dritte Kerze schließt unterhalb des Öffnungskurs der ersten Kerze MathAbs(close[i-1]-open[i-1]) > MathAbs(close[i]-open[i]) && high[i] <= high[i-1] && // mittlere Kerze ist innerhalb der ersten Kerze low[i] >= low[i-1]) // " ExtUpperBuffer[i]=high[i]; else ExtUpperBuffer[i]=EMPTY_VALUE; //---- Three Inside Up if(close[i-1] < open[i-1] && // rote Kerze close[i] > open[i] && // grüne Kerze close[i+1] > open [i+1] && // grüne Kerze MathAbs(close[i-1]-open[i-1]) > MathAbs(close[i]-open[i]) && close[i+1] > open[i-1] && // dritte Kerze schließt oberhalb des Öffnungskurs der ersten Kerze high[i] <= high[i-1] && // mittlere Kerze ist innerhalb der ersten Kerze low[i] >= low[i-1]) // ") ExtLowerBuffer[i]=low[i]; else ExtLowerBuffer[i]=EMPTY_VALUE; } //--- return value of prev_calculated for next call return(rates_total); }
Und der Teil im EA:
void entryThreeInside(double ask, double bid, double &lower[], double &upper[], double &ema[]) { //EMA = 50 // Short if(upper[2] != EMPTY_VALUE && upper[2] != 0 && rates[1].close < ema[1] && checkCandlesBeforeFormation("sell",ema,4,10)) { double sl = upper[2]; double abstand = MathAbs(bid-sl); double lotSize = RisikoProzent(_Symbol,inpRisiko,sl,abstand,inpKapital); trade.Sell(lotSize,_Symbol,bid,sl,(bid - (abstand * 1)),"fraktal"); } // Long if(lower[2] != EMPTY_VALUE && lower[2] != 0 && rates[1].close > ema[1] && checkCandlesBeforeFormation("buy",ema,4,10)) { double sl = lower[2]; double abstand = MathAbs(ask - sl); double lotSize = RisikoProzent(_Symbol,inpRisiko,sl,abstand,inpKapital); trade.Buy(lotSize,_Symbol,ask,sl,(ask + (abstand * 1.6)),"fraktal"); } } bool checkCandlesBeforeFormation(string direction, double &slowEMA[], int start, int stop) { if(direction == "buy" && ArraySize(rates) >= 15) { for(int i = start; i < stop; i++) { if(rates[i].close <= slowEMA[i]) return false; } } else if(direction == "sell" && ArraySize(rates) >= 15) { for(int i = start; i < stop; i++) { if(rates[i].close >= slowEMA[i]) return false; } } else return false; return true; }
Und dann habe ich noch ein Bild im Anhang
Wieso wird beim ersten Pfeil eine Long-Position geöffnet und beim dritten nicht?
Dateien:
Unbenannt.PNG
15 kb
UnknownInnocent:
Wieso wird beim ersten Pfeil eine Long-Position geöffnet und beim dritten nicht?
Weil du wichtige Hinweise ignorierst.
Nutze den Debugger.
Sie verpassen Handelsmöglichkeiten:
- Freie Handelsapplikationen
- Über 8.000 Signale zum Kopieren
- Wirtschaftsnachrichten für die Lage an den Finanzmärkte
Registrierung
Einloggen
Sie stimmen der Website-Richtlinie und den Nutzungsbedingungen zu.
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Hallo, im Fraktal-Indikator sieht die Limit-Berechnung folgendermaßen aus:
Das sorgt dafür, dass mein i die mittlere Kerze ist. Wie würde ich das jetzt so umschrieben, dass mein i die vierte Kerze ist, die Range also nicht mehr von i-2 bis i+2 ist, sondern i-3 bis i+1?