Hi guys! I need one indicator that gives me a signal when one candle (bull or bear) cross the horizontal trendline. I don't know if this is difficult, but if not, could you please help me?

creative,
It's a very easy thing my friend.
Please try this code (save it as indicator) when the market opens.
//| Demo.mq4 |
//| Mohammed |
//+------------------------------------------------------------------+
#property indicator_chart_window
extern double Line_Price = 0;
extern color clr = Yellow;
int init()
{
Draw_Horzintal_Line(Line_Price);
return(0);
}
int deinit()
{
int nobj = ObjectsTotal();
for (int i=nobj; i>=0; i--){
string objn = ObjectName(i);
if(StringFind(objn, "mhline", 0) >= 0)
ObjectDelete(objn);}
return(0);
}
int start()
{
/*-----
/ step 1: draw the horsintal line
/ step 2: alerts in crossing the line up and down
-----*/
if (High[0] Line_Price)
Alert("Price crossed down");
if (High[0] > Line_Price && Low[0] < Line_Price)
Alert("Price crossed up");
return(0);
}
//+------------------------------------------------------------------+
void Draw_Horzintal_Line(double value)
{
ObjectCreate("mhline", OBJ_HLINE, 0, 0, value);
ObjectSet("mhline", OBJPROP_COLOR, clr);
ObjectsRedraw();
}
When you attach the indicator set the price level of the horzintal line and its color.
Enjoy
Very nice Mohammed
Mohammed i want to thank you for your reply , but i need to see the line on the chart before the candle cross. I want to have a visual, do you understand Mohammed?
Regards!
Mohammed i want to thank you for your reply

creative, Yes I know what do you want.
Just set the Line and wait the cross? Did I mis understand you?
You attach the indicator and set the line (very like you draw a normal line but with an indicator this time) and you wait the cross.
If the candle was down the line and crossed up it will alerts you up.
If the candle was up the line and crossed down it will alerts you down.
I hope it's what you want and sorry if it wasn't what you want.
But there is another problem, i can't plot two lines on the chart, just one.. can you fix please?
creative, Yes I know what do you want.
Just set the Line and wait the cross? Did I mis understand you?
You attach the indicator and set the line (very like you draw a normal line but with an indicator this time) and you wait the cross.
If the candle was down the line and crossed up it will alerts you up.
If the candle was up the line and crossed down it will alerts you down.
I hope it's what you want
Yes man that's exactly what i want ! I want to give you a big thanks for your precious help! All the best for you!
Just want two...
But there is another problem, i can't plot two lines on the chart, just one.. can you fix please?
No problem!
I'm working in it now !
Once again thank you very much!!!
Best regards!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys! I need one indicator that gives me a signal when one candle (bull or bear) cross the horizontal trendline. I don't know if this is difficult, but if not, could you please help me?
Thanks in advance!
Cheers