You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Try it out (it shows now as many candles I wish on my terminal) : candlebreaker_1.mq4
It is working well for me now.
Regards.
hi everyone, i have problem my mt4 cannot show on the chart anymore ma, rsi, wpr candles its happened after when i installed some days ago mt platforms again? can anyone help
Hi ProCoders,
I am currently working with the Autotrend Forecaster indicator.
I wrote the code below, but the EA is not opening trades.
Could someone kindly have a look?
Thank you in advance!MT4 shows just alerts in the journal:
MT4 shows just alerts in the journal:
Then the problem is in your conditions that are written in the EA
Check if the conditions ever evaluate to true
Hi coders,
I feel really ashamed, because this is the third time I'm asking about an alert function.
I would like to get an alert when the histogram color changes from color.
Just like normal I'm comparing the indicator buffers with each other. But this time it doesn't work.
The buffers are working perfectly and my compare function is also correct (in my eyes).
So I think it has to be something small, I hope someone could help me out.
Thanks in advance,
#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
Then the problem is in your conditions that are written in the EA Check if the conditions ever evaluate to true
Hi Mladen,
thank you for your suggestion. I rewrote the code a bit to "force" the conditions to true / false. Now it is selling, but not buying. Please see the code below:
if(openedOrders<=0)
{
// AutoTrendForecaster
double AutoTrendup=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,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,Intensity,SL_distance_pips,1,bar);
double AutoTrenddown_prev=iCustom(Symbol(),0,"AutoTrendForecaster",TMperiod,Intensity,SL_distance_pips,1,bar+1);
//+------------------------------------------------------------------+
//| BUY
//+------------------------------------------------------------------+
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);
}
}
Thank you in advance!
Hi coders,
I feel really ashamed, because this is the third time I'm asking about an alert function.
I would like to get an alert when the histogram color changes from color.
Just like normal I'm comparing the indicator buffers with each other. But this time it doesn't work.
The buffers are working perfectly and my compare function is also correct (in my eyes).
So I think it has to be something small, I hope someone could help me out.
Thanks in advance,
#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
Regardless of the SetIndexEmptyValue() EMPTY_VALUE is not == 0, but 2147483647. Also you have repainting issues in that code which you have to clean up first
Please, could someone fix this indicator so that it shows alert(is already in) arrows on the chart and also it should only alert on the first candle what is closing above/below an ema.
candle_close_cross_ma_alert1.mq4
Please, could someone fix this indicator so that it shows alert(is already in) arrows on the chart and also it should only alert on the first candle what is closing above/below an ema. candle_close_cross_ma_alert1.mq4
triip
Check out this one : https://www.mql5.com/en/forum/general
Set the fast ma period to 1 and then it will be the same as if the price crosses the moving average (the slo ma)
Thank you very much, without your help I couldn't fix it.
(ps. code is working).
Have a nice day!