![MQL5 - Linguaggio delle strategie di trading integrato nel client terminal MetaTrader 5](https://c.mql5.com/i/registerlandings/logo-2.png)
Ti stai perdendo delle opportunità di trading:
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Registrazione
Accedi
Accetti la politica del sito e le condizioni d’uso
Se non hai un account, registrati
Provatelo (ora mostra tutte le candele che voglio sul mio terminale): candlebreaker_1.mq4
Ora funziona bene per me.
Saluti.
Ciao a tutti, ho un problema che il mio mt4 non può più mostrare sul grafico ma, rsi, wpr candele è successo dopo che ho installato alcuni giorni fa mt platforms di nuovo? qualcuno può aiutare
Ciao ProCoders,
Attualmente sto lavorando con l'indicatore Autotrend Forecaster.
Ho scritto il codice qui sotto, ma l'EA non apre i trade.
Qualcuno potrebbe gentilmente dare un'occhiata?
![](https://c.mql5.com/forextsd/forum/157/autotrend.jpg)
Grazie in anticipo!MT4 mostra solo avvisi nel giornale:
MT4 mostra solo avvisi nel giornale:
Allora il problema è nelle tue condizioni che sono scritte nell'EA
Controlla se le condizioni valutano mai a true
Ciao codificatori,
Mi vergogno molto, perché questa è la terza volta che chiedo informazioni su una funzione di avviso.
Vorrei ottenere un avviso quando il colore dell'istogramma cambia da colore.
Come al solito sto confrontando i buffer degli indicatori tra loro. Ma questa volta non funziona.
I buffer funzionano perfettamente e anche la mia funzione di confronto è corretta (ai miei occhi).
Quindi penso che debba essere qualcosa di piccolo, spero che qualcuno possa aiutarmi.
Grazie in anticipo,
#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
Allora il problema è nelle tue condizioni che sono scritte nell'EA Controlla se le condizioni valutano mai a true
Ciao Mladen,
grazie per il tuo suggerimento. Ho riscritto un po' il codice per "forzare" le condizioni a vero / falso. Ora vende, ma non compra. Si prega di vedere il codice qui sotto:
if(openedOrders<=0)
{
// AutoTrendForecaster
double AutoTrendup=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,0,bar);
double AutoTrenddup_prev=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,0,bar+1);
double AutoTrenddown=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,1,bar);
double AutoTrenddown_prev=iCustom(Symbol(),0, "AutoTrendForecaster",TMperiodo,Intensità,SL_distance_pips,1,barra+1);
//+------------------------------------------------------------------+
//| BUY
//+------------------------------------------------------------------+
bool buyCondition = false;
if(AutoTrendup>0 && AutoTrendup!=EMPTY_VALUE){
buyCondition = true;
}
if (buyCondition)
{
OpenBuy();
return(0);
}
//+------------------------------------------------------------------+
//| VENDERE
//+------------------------------------------------------------------+
bool sellCondition = false;
se (AutoTrenddown>0 && AutoTrenddown!=EMPTY_VALUE)
{
sellCondition = true;
}
if (sellCondition)
{
OpenSell();
return(0);
}
}
Grazie in anticipo!
Ciao codificatori,
Mi vergogno molto, perché questa è la terza volta che chiedo informazioni su una funzione di avviso.
Vorrei ottenere un avviso quando il colore dell'istogramma cambia da colore.
Come al solito sto confrontando i buffer degli indicatori tra loro. Ma questa volta non funziona.
I buffer funzionano perfettamente e anche la mia funzione di confronto è corretta (ai miei occhi).
Quindi penso che debba essere qualcosa di piccolo, spero che qualcuno possa aiutarmi.
Grazie in anticipo,
#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];
}
}
xtractalpha
Indipendentemente dal SetIndexEmptyValue() EMPTY_VALUE non è == 0, ma 2147483647. Inoltre hai problemi di riverniciatura in quel codice che devi prima pulire
Per favore, qualcuno potrebbe correggere questo indicatore in modo che mostri le frecce di allarme (è già in) sul grafico e inoltre dovrebbe avvisare solo sulla prima candela che si chiude sopra/sotto una ema.
candle_close_cross_ma_alert1.mq4
Per favore, qualcuno potrebbe sistemare questo indicatore in modo che mostri le frecce di allerta (è già in) sul grafico e inoltre dovrebbe allertare solo sulla prima candela che chiude sopra/sotto una ema.candle_close_cross_ma_alert1.mq4
triip
Guarda questo: https: //www.mql5.com/en/forum/general
Imposta il periodo della ma veloce a 1 e poi sarà lo stesso come se il prezzo incrociasse la media mobile (la slo ma)
Grazie mille, senza il vostro aiuto non potrei risolvere il problema.
(ps. il codice funziona).
Buona giornata!