Alerts - page 2

 
hua:
Sorry but Alpari's platforma crashed and had to reopen but freezes continuously. As told yu in the past, Alpari alerts window hv a list of all alerts (very good indeed as yu can see your alerts at any time), There4 we need alert to hit only once. But, in this case coming another popup window (for only this alert) which freezes the computer. Its ok Sir, dont bother anymore. Yu hv a lot of valuable things to do with other members requests. Thanks again your nice assistance.

Hua,

It didn't crash with me, but you are right too, because:

http://www.metaquotes.net/forum/758/

Alerts seem better but there's no option to hit only once in indicators.

Files:
msg.jpg  66 kb
 
codersguru:
Hua,

It didn't crash with me, but you are right too, because:

http://www.metaquotes.net/forum/758/

Alerts seem better but there's no option to hit only once in indicators.

Tks vm again, but hv a look on the attached indicator, this one hits alert only once. tks again.

Files:
 
hua:
Tks vm again, but hv a look on the attached indicator, this one hits alert only once. tks again.

Hua,

But "Disable alert once hit" Means "enable only first alert signal"

The indicator you've sent use an option to show alerts or not.

And you have to set this option from the properties windows of the indicator before starting the indicator.

And if you set it to false before starting the indicator you will not get even one alert.

it's not the idea of "Disable alert once hit"

Why didn't you tell me you want something like that? It's 2 lines of code

 
codersguru:
Hua,

But "Disable alert once hit" Means "enable only first alert signal"

The indicator you've sent use an option to show alerts or not.

And you have to set this option from the properties windows of the indicator before starting the indicator.

And if you set it to false before starting the indicator you will not get even one alert.

it's not the idea of "Disable alert once hit"

Why didn't you tell me you want something like that? It's 2 lines of code

Sorry Sir, i dont need that and its my mistake, i am really a bit confused.

So, forget it and tk yu once more. take care.

 

Some questions

hi codersguru...

I'd like to know how I can put 3 things:

1) Arrows in the chart;

2) Alert when cross;

3) Comment in the left corner;

the indicator its Stoch..

many tkx

 

Answers

hellkas:
hi codersguru...

I'd like to know how I can put 3 things:

1) Arrows in the chart;

2) Alert when cross;

3) Comment in the left corner;

the indicator its Stoch..

many tkx

hi hellkas,

1- Arrows in the chart;

Use this code to draw an arrow (color=Gold, Width=1) in the main window.

ObjectCreate("my arrow", OBJ_ARROW, 0, Time[0], High[0]+Point*10);

ObjectSet("my arrow", OBJPROP_ARROWCODE, 1);

ObjectSet("my arrow", OBJPROP_COLOR , Gold);

ObjectSet("my arrow", OBJPROP_WIDTH , 1);

ObjectsRedraw();[/PHP]

2) Alert when cross;

This is my Alerts demo (working when 8EMA crosses 13EMA and telles you the direction):

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

//| CrossedAlerts.mq4 |

//| Coders Guru |

//| https://www.forex-tsd.com |

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

#property copyright "Coders Guru"

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

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

//---- 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 ,string& direction)

{

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("CRROSED: Line1 is (" + current_dirction + ") Line2 now");

last_direction = current_dirction;

direction=current_dirction;

return (true);

}

else

{

direction=current_dirction;

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,8,0,MODE_EMA,PRICE_CLOSE,pos);

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

pos--;

}

string direction;

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

//----

return(0);

}

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

3) Comment in the left corner;

This line of code will print a comment on the top left corner of the main window:

[PHP]Comment("Hi! I'm here on the main chart windows!");

I hope I helped!

 
codersguru:
hi hellkas,

1- Arrows in the chart;

Use this code to draw an arrow (color=Gold, Width=1) in the main window.

ObjectCreate("my arrow", OBJ_ARROW, 0, Time[0], High[0]+Point*10);

ObjectSet("my arrow", OBJPROP_ARROWCODE, 1);

ObjectSet("my arrow", OBJPROP_COLOR , Gold);

ObjectSet("my arrow", OBJPROP_WIDTH , 1);

ObjectsRedraw();[/PHP]

2) Alert when cross;

This is my Alerts demo (working when 8EMA crosses 13EMA and telles you the direction):

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

//| CrossedAlerts.mq4 |

//| Coders Guru |

//| https://www.forex-tsd.com |

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

#property copyright "Coders Guru"

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

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 Red

#property indicator_color2 Blue

//---- 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 ,string& direction)

{

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("CRROSED: Line1 is (" + current_dirction + ") Line2 now");

last_direction = current_dirction;

direction=current_dirction;

return (true);

}

else

{

direction=current_dirction;

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,8,0,MODE_EMA,PRICE_CLOSE,pos);

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

pos--;

}

string direction;

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

//----

return(0);

}

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

3) Comment in the left corner;

This line of code will print a comment on the top left corner of the main window:

[PHP]Comment("Hi! I'm here on the main chart windows!");
I hope I helped!

CODERS'GURU:

Is that possible to hv different sounds on alerts creates by EA, than those ones created by indicators??? and moreover, is that possible to hv different sounds btwn indicator alerts??? mny tks in advance.

 

Yes!

hua:
CODERS'GURU: Is that possible to hv different sounds on alerts creates by EA, than those ones created by indicators??? and moreover, is that possible to hv different sounds btwn indicator alerts??? mny tks in advance.

hua,

Happy to hear you again.

YES, we can have different sounds.

Tell me exactlywhat do you want to do and I'll program it for you

 
codersguru:
hua,

Happy to hear you again.

YES, we can have different sounds.

Tell me exactlywhat do you want to do and I'll program it for you

OK SIR, The most important. 1) EA alerts to hv different sound than those ones in indicator alerts and 2) Different sounds between indicators alerts.

All i am trying to say, is to avoid traders to be always infront their screen. IE if they/we can hv different sounds on various alerts, according to each trader subjective importance, then we can make our life easier. tks vm indeed in advance.

 
hua:
OK SIR, The most important. 1) EA alerts to hv different sound than those ones in indicator alerts and 2) Different sounds between indicators alerts. All i am trying to say, is to avoid traders to be always infront their screen. IE if they/we can hv different sounds on various alerts, according to each trader subjective importance, then we can make our life easier. tks vm indeed in advance.

OK , Furthermore to make your life easier. Sorry Sir, you are extremely valuable to us, so sorry again to make your life difficult sometimes.

Away, i give yu an example as attached, one EA Alert, and one indicator alert, on which would like diferent sounds . tks vm again.

Files:
Reason: