I am trying to include an alert into an inside bar indicator but I can't get it to work. It gives me an alert for every new candle instead of only for inside bars.
I was hoping you could provide some help.
input int TriggerCandle = 1;
input bool EnableNativeAlerts = true;
input bool EnableSoundAlerts = true;
input bool EnableEmailAlerts = true;
input string AlertEmailSubject = "";
input string AlertText = "";
input string SoundFileName = "alert.wav";
datetime LastAlertTime = D'01.01.1970';
//At the end of the onCalculate function
if ((TriggerCandle > 0) && (Time > LastAlertTime))
if (HighBuff[TriggerCandle] > 0)
Text = AlertText + "Inside Bar: " + Symbol() + " - " + EnumToString((ENUM_TIMEFRAMES)Period());
if (EnableNativeAlerts) Alert(Text);
if (EnableEmailAlerts) SendMail(AlertEmailSubject + "Inside Bar", Text);
if (EnableSoundAlerts) PlaySound(SoundFileName);
LastAlertTime = Time;
This is the code I was using.
The indicator I am using is from Tecciztecatl's inside bar indicator.
I hope someone can help
Thank you for the answer.
I do get an alert, (which is what I am focusing on right now). There are also no errors in the compiler.
However, what I want to achieve:
Get an alert for every new inside bar.
What I get:
An alert for every new bar that is starting.
What I assume is that since a new bar always starts as an inside bar this prompts the alert. What I don't get is that I am using HighBuffer so it should focus only on the second candle not the current.
Also it could be that the Buffer is drawn to a candle while it is in the current state. However, since I am using HighBuffer not HighBuffer I don't see why this should matter.
It could be another problem I don't see, because I'm not so familiar with programming.
As I understand the code, a candle that is not an inside bar gets a value of EMPTY_VALUE and the test >0 should not execute the if statement (alert).
google mal nach: "mt5 inside bar pattern" - ich wieder hole mich, warum das Rad neu erfinden, wenn es bereits verschenkt wird?
Nach weiterer suche habe ich den hier gefunden: http://www.pointzero-trading.com/Products/view/PZInsideBars
Funktioniert mit alert sehr gut, falls noch jemand sucht.