Hilfe bei der Codierung - Seite 513

 
mladen:
Probieren Sie es aus (es zeigt jetzt so viele Kerzen, wie ich möchte, auf meinem Terminal): candlebreaker_1.mq4

Bei mir funktioniert es jetzt gut.

Grüße.

 

Hallo an alle, ich habe das Problem, dass mein mt4 nicht mehr ma, rsi, wpr Kerzen auf dem Diagramm anzeigen kann. Es ist passiert, nachdem ich vor einigen Tagen mt-Plattformen wieder installiert habe? kann jemand helfen

 
tfi_markets:
Hallo ProCoders,

Ich arbeite derzeit mit dem Autotrend Forecaster Indikator.

Ich habe den folgenden Code geschrieben, aber der EA öffnet keine Trades.

Könnte jemand einen Blick darauf werfen?

vielen Dank im Voraus!

MT4 zeigt nur Alerts im Journal an:

Dateien:
journal.jpg  74 kb
 
tfi_markets:
MT4 zeigt nur Alarme im Journal an:

Dann liegt das Problem in den Bedingungen, die in den EA geschrieben werden

Prüfen Sie, ob die Bedingungen jemals zu true ausgewertet werden

 

Hallo Programmierer,

ich schäme mich wirklich, denn dies ist das dritte Mal, dass ich nach einer Warnfunktion frage.

Ich möchte eine Warnung erhalten, wenn sich die Farbe des Histogramms von der Farbe ändert.

Wie üblich vergleiche ich die Indikatorpuffer mit einander. Aber dieses Mal funktioniert es nicht.

Die Puffer funktionieren einwandfrei und meine Vergleichsfunktion ist auch korrekt (in meinen Augen).

Ich denke also, dass es an einer Kleinigkeit liegen muss und hoffe, dass mir jemand weiterhelfen kann.

Vielen Dank im Voraus,

#property indicator_separate_window#property indicator_buffers 5

#property indicator_color1 clrGreen

#property indicator_width1 4

#property indicator_color2 clrRed

#property indicator_width2 4

#property indicator_color3 Teal

#property indicator_color4 Teal

#property indicator_color5 Black

#property indicator_minimum 0

#property indicator_maximum 0.1

extern int Amplitude = 2;

extern bool alertsOn = true;

extern bool alertsMessage = true;

extern bool alertsSound = true;

extern bool alertsNotify = true;

extern bool alertsEmail = true;

extern string soundfile = "alert2.wav";

bool nexttrend;

double minh, maxl, up[], down[], trend[], atrlo[], atrhi[];

int init () {

SetIndexBuffer(0, up);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexLabel(0, "up");

SetIndexBuffer(1, down);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexLabel(1, "down");

SetIndexBuffer (2, atrlo);

SetIndexStyle (2, DRAW_NONE);

SetIndexBuffer (3, atrhi);

SetIndexStyle (3, DRAW_NONE);

SetIndexBuffer (4, trend);

//---

SetIndexEmptyValue (0, 0.0);

SetIndexEmptyValue (1, 0.0);

SetIndexEmptyValue (4, 0.0);

nexttrend = 0;

minh = High;

maxl = Low;

return (0);

}

int start () {

double atr, ll, hh, lma, hma;

int workbar = 1;

int c = IndicatorCounted ();

if (c < 0) {

return (- 1);

}

for (int i = Bars - 1 - c; i >= workbar; i --) {

ll = iLow (Symbol (), Period (),

iLowest (Symbol (), Period (), MODE_LOW, Amplitude, i));

hh = iHigh (Symbol (), Period (),

iHighest (Symbol (), Period (), MODE_HIGH, Amplitude, i));

lma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_LOW, i);

hma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_HIGH, i);

trend = trend;

atr = iATR (Symbol (), 0, 100, i) / 2;

if (nexttrend == 1) {

maxl = MathMax (ll, maxl);

if (hma < maxl && Close < Low) {

trend = 1;

nexttrend = 0;

minh = hh;

}

}

if (nexttrend == 0) {

minh = MathMin (hh, minh);

if (lma > minh && Close > High) {

trend = 0;

nexttrend = 1;

maxl = ll;

}

}

if (trend == 0.0) { //-------------------------------------------------------------------------------------------

if (trend != 0.0) {

up = down;

up = up;

} else {

up = MathMax (maxl, up);

}

atrhi = up + atr;

atrlo = up - atr;

down = 0.0;

} else {

if (trend != 1.0) {

down = up;//-------------------------------------------------------------------------------------------

down = down;

} else {

down = MathMin (minh, down);

}

atrhi = down + atr;

atrlo = down - atr;

up = 0.0; //-------------------------------------------------------------------------------------------

}

if(alertsOn){

if((up[2]!=EMPTY_VALUE) && (down[2]!=EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]==EMPTY_VALUE))lcheckalert();

if((up[2]!=EMPTY_VALUE) && (down[2]==EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]!=EMPTY_VALUE))scheckalert();

}

}

return (0);

}

void lcheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string lmessage = "ZOXY is green on, this means a buy signal! Pair:"+_Symbol +" Price: "+Ask;

if (alertsMessage) Alert(lmessage);

if (alertsNotify) SendNotification(lmessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Buy signal "),lmessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

void scheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string smessage = "ZOXY is Red, this means a sell signal! Pair: "+_Symbol +" Price: "+Bid;

if (alertsMessage) Alert(smessage);

if (alertsNotify) SendNotification(smessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Sell signal "),smessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

zoxy.mq4

Dateien:
zoxy.mq4  5 kb
 
mladen:
Dann liegt das Problem in Ihren Bedingungen, die in den EA geschrieben sind. Prüfen Sie, ob die Bedingungen jemals als wahr ausgewertet werden

Hallo Mladen,

danke für deinen Vorschlag. Ich habe den Code ein wenig umgeschrieben, um die Bedingungen auf true / false zu "zwingen". Jetzt wird verkauft, aber nicht gekauft. Bitte sehen Sie sich den Code unten an:

if(openOrders<=0)

{

// AutoTrendForecaster

double AutoTrendup=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensität,SL_distance_pips,0,bar);

double AutoTrendup_prev=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,0,bar+1);

double AutoTrenddown=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensität,SL_distance_pips,1,bar);

double AutoTrenddown_prev=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,1,bar+1);

//+------------------------------------------------------------------+

//| KAUFEN

//+------------------------------------------------------------------+

bool buyCondition = false;

if(AutoTrendup>0 && AutoTrendup!=EMPTY_VALUE)

{

buyCondition = true;

}

if (buyCondition)

{

OpenBuy();

return(0);

}

//+------------------------------------------------------------------+

//| SELL

//+------------------------------------------------------------------+

bool sellCondition = false;

if (AutoTrenddown>0 && AutoTrenddown!=EMPTY_VALUE)

{

sellCondition = true;

}

if (sellCondition)

{

OpenSell();

return(0);

}

}

Vielen Dank im Voraus!

Dateien:
buysell.jpg  65 kb
 
xtractalpha:
Hallo Programmierer,

Ich schäme mich wirklich, denn dies ist das dritte Mal, dass ich nach einer Warnfunktion frage.

Ich möchte eine Warnung erhalten, wenn die Farbe des Histogramms von der Farbe abweicht.

Wie üblich vergleiche ich die Indikatorpuffer mit einander. Aber dieses Mal funktioniert es nicht.

Die Puffer funktionieren einwandfrei und meine Vergleichsfunktion ist auch korrekt (in meinen Augen).

Ich denke also, dass es an einer Kleinigkeit liegen muss und hoffe, dass mir jemand weiterhelfen kann.

Vielen Dank im Voraus,

#property indicator_separate_window#property indicator_buffers 5

#property indicator_color1 clrGreen

#property indicator_width1 4

#property indicator_color2 clrRed

#property indicator_width2 4

#property indicator_color3 Teal

#property indicator_color4 Teal

#property indicator_color5 Black

#property indicator_minimum 0

#property indicator_maximum 0.1

extern int Amplitude = 2;

extern bool alertsOn = true;

extern bool alertsMessage = true;

extern bool alertsSound = true;

extern bool alertsNotify = true;

extern bool alertsEmail = true;

extern string soundfile = "alert2.wav";

bool nexttrend;

double minh, maxl, up[], down[], trend[], atrlo[], atrhi[];

int init () {

SetIndexBuffer(0, up);

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexLabel(0, "up");

SetIndexBuffer(1, down);

SetIndexStyle(1,DRAW_HISTOGRAM);

SetIndexLabel(1, "down");

SetIndexBuffer (2, atrlo);

SetIndexStyle (2, DRAW_NONE);

SetIndexBuffer (3, atrhi);

SetIndexStyle (3, DRAW_NONE);

SetIndexBuffer (4, trend);

//---

SetIndexEmptyValue (0, 0.0);

SetIndexEmptyValue (1, 0.0);

SetIndexEmptyValue (4, 0.0);

nexttrend = 0;

minh = High;

maxl = Low;

return (0);

}

int start () {

double atr, ll, hh, lma, hma;

int workbar = 1;

int c = IndicatorCounted ();

if (c < 0) {

return (- 1);

}

for (int i = Bars - 1 - c; i >= workbar; i --) {

ll = iLow (Symbol (), Period (),

iLowest (Symbol (), Period (), MODE_LOW, Amplitude, i));

hh = iHigh (Symbol (), Period (),

iHighest (Symbol (), Period (), MODE_HIGH, Amplitude, i));

lma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_LOW, i);

hma = iMA (NULL, 0, Amplitude, 0, MODE_SMA, PRICE_HIGH, i);

trend = trend;

atr = iATR (Symbol (), 0, 100, i) / 2;

if (nexttrend == 1) {

maxl = MathMax (ll, maxl);

if (hma < maxl && Close < Low) {

trend = 1;

nexttrend = 0;

minh = hh;

}

}

if (nexttrend == 0) {

minh = MathMin (hh, minh);

if (lma > minh && Close > High) {

trend = 0;

nexttrend = 1;

maxl = ll;

}

}

if (trend == 0.0) { //-------------------------------------------------------------------------------------------

if (trend != 0.0) {

up = down;

up = up;

} else {

up = MathMax (maxl, up);

}

atrhi = up + atr;

atrlo = up - atr;

down = 0.0;

} else {

if (trend != 1.0) {

down = up;//-------------------------------------------------------------------------------------------

down = down;

} else {

down = MathMin (minh, down);

}

atrhi = down + atr;

atrlo = down - atr;

up = 0.0; //-------------------------------------------------------------------------------------------

}

if(alertsOn){

if((up[2]!=EMPTY_VALUE) && (down[2]!=EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]==EMPTY_VALUE))lcheckalert();

if((up[2]!=EMPTY_VALUE) && (down[2]==EMPTY_VALUE) &&(up[1]!=EMPTY_VALUE)&&(down[1]!=EMPTY_VALUE))scheckalert();

}

}

return (0);

}

void lcheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string lmessage = "ZOXY is green on, this means a buy signal! Pair:"+_Symbol +" Price: "+Ask;

if (alertsMessage) Alert(lmessage);

if (alertsNotify) SendNotification(lmessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Buy signal "),lmessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

void scheckalert()

{

static datetime candletime=0;

if(candletime!=Time[0])

{

string smessage = "ZOXY is Red, this means a sell signal! Pair: "+_Symbol +" Price: "+Bid;

if (alertsMessage) Alert(smessage);

if (alertsNotify) SendNotification(smessage);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," Sell signal "),smessage);

if (alertsSound) PlaySound("alert2.wav");

candletime=Time[0];

}

}

zoxy.mq4

xtractalpha

Unabhängig von der SetIndexEmptyValue() ist EMPTY_VALUE nicht == 0, sondern 2147483647. Außerdem gibt es in diesem Code Probleme mit dem Repainting, die Sie zuerst bereinigen müssen

 

Bitte, könnte jemand diesen Indikator zu beheben, so dass es zeigt Alarm (ist bereits in) Pfeile auf dem Chart und auch sollte es nur Alarm auf die erste Kerze, die über/unter einem EMA schließt.

Kerze_schließen_über_ma_alert1.mq4

 
triip:
Könnte bitte jemand diesen Indikator so korrigieren, dass er Warnpfeile auf dem Chart anzeigt und dass er nur bei der ersten Kerze warnt, die über/unter einem EMA schließt.candle_close_cross_ma_alert1.mq4

triip

Sehen Sie sich das hier an: https: //www.mql5.com/en/forum/general

Setzen Sie die Fast-Ma-Periode auf 1 und dann wird es dasselbe sein, wie wenn der Preis den gleitenden Durchschnitt (die Slo-Ma) kreuzt

 

Vielen Dank, ohne Ihre Hilfe konnte ich das Problem nicht lösen.

(ps. der Code funktioniert).

Einen schönen Tag noch!

Grund der Beschwerde: