Please help me add Alerts to an Indicator

tung2232

Trader
Jun 9, 2020
2
0
6
31
Please help put alert for me on buy and sell signal
 

Attachments

  • 123PatternsV6.mq4
    13.6 KB · Views: 17

itunufolo

Trader
May 23, 2021
1
0
6
39
Please i tried for many days trying to add alert to this YangTrader for mt4 . But i was not able to make alerts trigger . it is a line indicator .. i followed all your steps on https://www.earnforex.com/blog/how-to-add-alerts-to-metatrader-indicators/

i wanted the alert to trigger : buy @ level above >55
Sell @ level below <45

i have attached both my attempts : Yang Alert attemps & YangTrader Original ( No alert added)

Please help me Add it ....... PLEASE
 

Attachments

  • Yang Alert attempts.mq4
    6.7 KB · Views: 18
  • Yang Trader - ORIGINAL.mq4
    3.7 KB · Views: 23
Last edited:

Enivid

Administrator
Staff member
Nov 30, 2008
18,532
1,355
144
Odesa
www.earnforex.com
At no place in the tutorial there is a suggestion to compare TriggerCandle with 50.

Also, you have to get your requirements to the alerts straight. Here, in the post, you write that you want alerts when the indicator is > 55 or below < 45, but your code seems to be looking for a cross of some level (though incorrectly).
 

swigga

Newbie
Jun 18, 2021
4
0
1
30
I am in search of anyone that can code a verticle rectangle box indicator that can cover/block off candlesticks on the hard right edge of mt4 platform? any interaction will be appreciated.
 

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
it would help to know just how many candles you are talking about covering..... the script below goes in the scripts folder......
//-------

it uses the highest high and lowest low during the period back set by bar......

it will change the chart fore/back ground setting.....

it first deletes prior rectangle of same name.....

color is selectable......

it is draggable....

it is simple......h
//------
nzdusdts-d1-topstepfx-rect.png
 

Attachments

  • rect.ex4
    6.6 KB · Views: 10
  • rect.mq4
    1.6 KB · Views: 17
  • 👍
Reactions: Enivid

Panunes

Newbie
Mar 5, 2021
3
0
2
39
hello could you help me because the warning signal is not working
 

Attachments

  • 10 SEGUNDOS ALERTA.ex5
    12.8 KB · Views: 9
  • 10 SEGUNDOS ALERTA.mq5
    16.2 KB · Views: 15

Enivid

Administrator
Staff member
Nov 30, 2008
18,532
1,355
144
Odesa
www.earnforex.com
I think you should either get rid of this condition (and apply some time variable check to avoid multiple alerts from the same bar):
MQL5:
   if(prev_calculated!=rates_total)
Or you should change rates_total-1 to rates_total-2 here:
MQL5:
if(VendaBuffer[rates_total-1]!=EMPTY_VALUE)
and here:
MQL5:
if(CompraBuffer[rates_total-1]!=EMPTY_VALUE)
Because currently it works like this: a new bar arrives and the alert code is checked on it, but the bar is just 1 tick old - it has Open = High = Low = Close, so the indicator value likely remains equal EMPTY_VALUE. A bit later, when the indicator value gets updated, the initial prev_calculated!=rates_total fails because it is no longer a new bar, hence no alerts get issued.

If you apply the second change (rates_total-1 to rates_total-2) it will be checking only fully completed bars (so, the one just before the current bar) for alerts.
 

Panunes

Newbie
Mar 5, 2021
3
0
2
39
I think you should either get rid of this condition (and apply some time variable check to avoid multiple alerts from the same bar):
MQL5:
   if(prev_calculated!=rates_total)
Or you should change rates_total-1 to rates_total-2 here:
MQL5:
if(VendaBuffer[rates_total-1]!=EMPTY_VALUE)
and here:
MQL5:
if(CompraBuffer[rates_total-1]!=EMPTY_VALUE)
Because currently it works like this: a new bar arrives and the alert code is checked on it, but the bar is just 1 tick old - it has Open = High = Low = Close, so the indicator value likely remains equal EMPTY_VALUE. A bit later, when the indicator value gets updated, the initial prev_calculated!=rates_total fails because it is no longer a new bar, hence no alerts get issued.

If you apply the second change (rates_total-1 to rates_total-2) it will be checking only fully completed bars (so, the one just before the current bar) for alerts.
thank you, it worked
 

swigga

Newbie
Jun 18, 2021
4
0
1
30
I am in search of anyone that can code a verticle rectangle box indicator that can cover/block off candlesticks on the hard right edge of mt4 platform? any interac
it would help to know just how many candles you are talking about covering..... the script below goes in the scripts folder......
//-------

it uses the highest high and lowest low during the period back set by bar......

it will change the chart fore/back ground setting.....

it first deletes prior rectangle of same name.....

color is selectable......

it is draggable....

it is simple......h
//------
nzdusdts-d1-topstepfx-rect.png
Good day, thank you for the reply. With regards to the box, my intention is for the rectangular box to cover the whole right hight hand edge of mt4 platform, with a width of 40candles. the heght of the box would then be edge to edge from top to bottom regardles of the timeframe. If i was to change timeframes the box would still be on my right hand edge covering a width of 40candles top to bottom. The goal of the rectangular box is for when I'm looking at previous years price action, it covers 40candle width at right hand, so that I am then able to project future price movement candle by candle using F12. Currently my OCD makes it hard for me just to use my mt4 platform as is. The box gives my mind that future price still has to come. I acknowledge I wasnt clear in my discription on the first post.
 
Last edited:

hayseed

Master Trader
Jul 27, 2010
1,013
258
149
usa
Can the box settings be changed i.e height width?
yes, but probably not in the manner you are wanting.....

that is just a simple example of a way to cover/block off candlesticks on the hard right edge......

to adjust the width or height, click or double click on the rectangle to select it.... once selected, click and hold on any of the corners and drag out or up....

clicking and holding on the center squares allows you to move the square around.......

other than that, there is not much which can be done as the code is quite simple without adjustments......h
//-----

nzdusdts-d1-equiti-capital-uk-height.png
 

pkoolc1

Active Trader
Feb 26, 2012
12
0
32
Hi I followed the tutorial to add alerts but alert is not triggering alerts. I am not sure of what i did wrong.
 

Attachments

  • Reverse No Repair.mq5
    5.7 KB · Views: 15

Enivid

Administrator
Staff member
Nov 30, 2008
18,532
1,355
144
Odesa
www.earnforex.com
Hi I followed the tutorial to add alerts but alert is not triggering alerts. I am not sure of what i did wrong.
When accessing bufferUp and bufferDown values, you don't need to use [rates_total - 1 - TriggerCandle] selector, use [TriggerCandle] instead. That's because they are set as series in the indicator's initialization function.
 

pkoolc1

Active Trader
Feb 26, 2012
12
0
32
When accessing bufferUp and bufferDown values, you don't need to use [rates_total - 1 - TriggerCandle] selector, use [TriggerCandle] instead. That's because they are set as series in the indicator's initialization function.
Thank very much, if i change the trigger candle to 1 it does not give an alert.
 

pkoolc1

Active Trader
Feb 26, 2012
12
0
32
The indicators buffers are shifted 2 bars to the left, so the latest meaningful value there can only be at index 2. Try setting TriggerCandle to 2.
Yes when it is set to 2 it does give alert, how can i set it so it can give alert from when the trigger is set to 1