Indicators with alerts/signal - page 304

 
mrtools:
Hi DW, A lot of times in code have noticed a lot of programmers using a 1 period ma to represent price, not sure how to fix your indicator to reflect this but have this ma cross arrows alert that draws arrows and alerts when there is a ma cross, i'm thinking if you use say 1 period fast ma and whatever period you choose for slow ma, would be the same as price crossing ma, this version you can change use open,close,etc.

Hi mrtools,

So is it not possible to adjust that paritcular indicator to have it alert when price crosses the ma ?

Is that one that you have here moving average cross moving average alert or a price cross moving average alert ?

DW

 
DarkWolF:
Hi mrtools,

So is it not possible to adjust that paritcular indicator to have it alert when price crosses the ma ?

Is that one that you have here moving average cross moving average alert or a price cross moving average alert ?

DW

Yes it is, once you place the indicator on the chart change one of the ma's to maperiod=1, this is the same as price, the other ma to whatever period you desire. The arrows and alerts will signal on every cross. Just for grins put a moving average on your chart with ma period = 1, you will see what i mean.

 
mrtools:
Yes it is, once you place the indicator on the chart change one of the ma's to maperiod=1, this is the same as price, the other ma to whatever period you desire. The arrows and alerts will signal on every cross. Just for grins put a moving average on your chart with ma period = 1, you will see what i mean.

Hi mrtools,

By doing this it simpy causes the alert to sound at the end of every bar.

So if I was wanting it to alert when say price crosses a 15 period ema it will alert simply because it thinks price is crossing a 1period ema

 
DarkWolF:
Hi mrtools,

By doing this it simpy causes the alert to sound at the end of every bar.

So if I was wanting it to alert when say price crosses a 15 period ema it will alert simply because it thinks price is crossing a 1period ema

Not necessarily to if you have alertsoncurrent set to false then alert will sound only on close of the bar, so if true the alert should sound every tick as the ma's cross, and if you use a 15 period ema as slow ma and 1 period ema as fast ma it will be the same as price crossing the 15 period ema, and once this happens alert should go off and continue until the crossing is complete.

Check out this chart am using 1 period sma or typical price and 200 period sma of typical price,same setup for arrows indicator once the 1 period sma (price) crosses the 200 sma an arrow forms along with the alert.

 

EA Programmer Required Please

Dear All,

I need an EA created for MT4 platform. I have a project outline created along with a visual to show the intended actions.

I would greatly appreciate it if someone could assist me in this regard. Naturally I wouldn't expect the work to be done for free.

Perhaps one of the site moderators would be able to refer me to a reliable, quality programmer..?

I will email across the project outline to those interested parties.

Kind regards,

Steve.

 

Indicator to EA

Hi All,

I would like to make a flag and an EA wants someone to help me make it I'll explain the strategy and will be very simple

THX You

 

EMA crossover alert problem

Hi,

I cobbled together this indicator with sound and email alert from various posts in this thread (thanks Codersguru!)

I need one slight modification that I have not been able to accomplish. Can someone make this only alert once? or once the bar closes? Right now it alerts on every tick. thanks much for any help you can provide!

Mike

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

//| CrossedAlerts.mq4 |

//| Coders Guru |

//| https://www.mql5.com/en/forum |

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

#property copyright "Coders Guru"

#property link "https://www.forex-tsd.com"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int FasterMA = 10;

extern int SlowerMA = 35;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,ExtMapBuffer2);

//----

return(0);

}

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

//| Custor indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

bool Crossed (double line1 , double line2 )

{

static string last_direction = "";

string current_dirction = "";

if(line1>line2)current_dirction = "up";

if(line1<=line2)current_dirction = "down";

if(current_dirction != last_direction)

{

Alert("EMA Cross for "+Symbol()+" on the "+Period()+" minute chart.");

SendMail("Crossover alert","SELL signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime() )+" Symbol="+Symbol()+" Period="+Period());

last_direction = current_dirction;

return (true);

}

else

{

return (false);

}

}

int start()

{

int counted_bars=IndicatorCounted();

//---- check for possible errors

if (counted_bars<0) return(-1);

//---- last counted bar will be recounted

if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;

while(pos>=0)

{

ExtMapBuffer1[pos]= iMA(NULL,0,FasterMA,0,MODE_EMA,PRICE_CLOSE,pos);

ExtMapBuffer2[pos]= iMA(NULL,0,SlowerMA,0,MODE_EMA,PRICE_CLOSE,pos);

pos--;

}

Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));

//----

return(0);

}

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

 
a1arunner:
Hi,

I cobbled together this indicator with sound and email alert from various posts in this thread (thanks Codersguru!)

I need one slight modification that I have not been able to accomplish. Can someone make this only alert once? or once the bar closes? Right now it alerts on every tick. thanks much for any help you can provide!

Mike

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

//| CrossedAlerts.mq4 |

//| Coders Guru |

//| https://www.mql5.com/en/forum |

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

#property copyright "Coders Guru"

#property link "https://www.forex-tsd.com"

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Blue

#property indicator_color2 Red

extern int FasterMA = 10;

extern int SlowerMA = 35;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

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

//| Custom indicator initialization function |

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

int init()

{

//---- indicators

SetIndexStyle(0,DRAW_LINE);

SetIndexBuffer(0,ExtMapBuffer1);

SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(1,ExtMapBuffer2);

//----

return(0);

}

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

//| Custor indicator deinitialization function |

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

int deinit()

{

//----

//----

return(0);

}

bool Crossed (double line1 , double line2 )

{

static string last_direction = "";

string current_dirction = "";

if(line1>line2)current_dirction = "up";

if(line1<=line2)current_dirction = "down";

if(current_dirction != last_direction)

{

Alert("EMA Cross for "+Symbol()+" on the "+Period()+" minute chart.");

SendMail("Crossover alert","SELL signal at Ask="+DoubleToStr(Ask,4)+", Bid="+DoubleToStr(Bid,4)+", Date="+TimeToStr(CurTime(),TIME_DATE)+" "+TimeHour(CurTime())+":"+TimeMinute(CurTime() )+" Symbol="+Symbol()+" Period="+Period());

last_direction = current_dirction;

return (true);

}

else

{

return (false);

}

}

int start()

{

int counted_bars=IndicatorCounted();

//---- check for possible errors

if (counted_bars<0) return(-1);

//---- last counted bar will be recounted

if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;

while(pos>=0)

{

ExtMapBuffer1[pos]= iMA(NULL,0,FasterMA,0,MODE_EMA,PRICE_CLOSE,pos);

ExtMapBuffer2[pos]= iMA(NULL,0,SlowerMA,0,MODE_EMA,PRICE_CLOSE,pos);

pos--;

}

Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));

//----

return(0);

}

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

Hi Mike,

This one is a little different but really the same, think this alert works how you are asking.

 

simple trailing ea

hello,

i ve got this trailling method that is pretty simple but really effective, i tryed to code it myself but without programming skillz, no website or software allow me to do it.

it s base on this indicator that spot the biggest bar range, so when the red histogram goes above the yellow line we move the stop at the low/high of that candle. it s good most of the time check it on live chart.

thanks

Files:
val_bands.mq4  7 kb
 

Traling Stops

Read about iCustom in the documentation

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)

and then make 2 icustom calls in your EA, one for mode =1 which is Yellow and the second for mode=3=3 which is red. In both cases, shift should be 1.

use High[1] or Low[1] which ever is appropriate for your trailing stop. Name is equal to "Val_Bands"

Reason: