Calculate the intersection of a trendline and a horizontal line

 

Hello,

I have a trendline on my chart which basically shows the trend of price and I have a horizontal line which stands for support or resistance.

I want to calculate the  intersection of the trendline and the horizontal line

Is there any way to do this with MT4?

 
double slope = myTrend.PriceChangePerMinute();
double breaklvl = (slope < 0 ? mySR.Support() : mySR.Resistance());

if(MathAbs(slope)<_Point) {
   Print("no trend");
}
else {
  double minutestogo = (breaklvl - Bid) / slope;
  Print("intersection in ",minutestogo," minutes");
}
 
or you can use the HLine price on the TLine with ObjectGetTimeByValue