Hi Leute ich brauche Hilfe und komme gleich zum Punkt,
Schritt1: Kerze 0 Schlusskurs 1euro Hoch 1euro Low 1euro Open 1euro
Schritt2: Kerze 0 Schlusskurs 2euro Hoch 2euro Low 1euro Open 1euro
Schritt3: Kerze 0 Schlusskurs 3euro hoch 3euro Low 1euro Open 1euro
Schritt4: Kerze 0 Schlusskurs 2euro hoch 3euro Low 1euro Open 1euro
Schlusskurs notiert zum ersten mal unter Hoch = Dot
Schlusskurs notiert zum ersten mal über Low = Dot
wenn der Kurs jetzt nach dem rücksetzer nochmal hochzieht und wieder zurücksetzt kein weiterer Dot mehr
wenn der Kurs jetzt nach dem rücksetzer nochmal runterzieht und wieder zurücksetzt kein weiterer Dot mehr
Was habe ich probiert?
Code:
for(int i=0;i<limit;i++){
if(Close[i]<High[i]){
double pullbackHighest_DotPreis=Close[i]<High[i];
pullbackHighest_Dot[i]=pullbackHighest_DotPreis;
}else if(Close[i]>Low[i]){
double pullbackLowest_DotPreis=Close[i]>Low[i];
pullbackLowest_Dot[i]=pullbackLowest_DotPreis;
}
}
warum High[i] und nicht iHigh[i]?, weil ich immer die aktuelle Kerze nehme und den shift nicht brauche
Der ganze Code
Code:
//+------------------------------------------------------------------+
//| sellHigherLow_buyLowerhigh.mq4 |
//| Copyright 2020, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrAqua
#property indicator_color2 clrMagenta
#property indicator_width1 2
#property indicator_width2 2
double pullbackLowest_Dot[];
double pullbackHighest_Dot[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
//pullbackLowest_Dot
SetIndexBuffer(0,pullbackLowest_Dot);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexLabel(0,"Sell Signal");
//pullbackHighest_Dot
SetIndexBuffer(1,pullbackHighest_Dot);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexLabel(1,"Sell Signal");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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[])
{
//---
//counting Bars
int counted_bars, limit;
counted_bars=IndicatorCounted();
limit=Bars-counted_bars;
//Erklärung mit Code
for(int i=0;i<limit;i++){
if(Close[i]<High[i]){
double pullbackHighest_DotPreis=Close[i]<High[i];
pullbackHighest_Dot[i]=pullbackHighest_DotPreis;
}else if(Close[i]>Low[i]){
double pullbackLowest_DotPreis=Close[i]>Low[i];
pullbackLowest_Dot[i]=pullbackLowest_DotPreis;
}
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+