Draw trendline in code

 
When I click a button I hoped that the trendline tool can be clicked -- it appears the mouse is prepared to draw a trendline -- but I have searched all over to come up with no solution. I guess what I am saying is  how can the user know that they can draw trendline through the use of a button without DLLs. Like for instance I want to dedicate functionality for that trendline to a specific goal like for instance being an order type entry and stoploss. How will the user know that the mouse is prepared to draw a trendline and how can it be canceled all much in the same way that clicking the trendline tool happens where you can click the trendline tool and see the mouse pointer change so you know you are prepared to draw a trendline and you could just cancel it if you right clicked.  If you wanted to see all this happen just by clicking a button the closest thing you could get to it is the mouse never changed appearance ~ you couldn't cancel it ~ and it was drawn by creating the trendline in code and you can't see the trendline underneath the mouse pointer.  Any ideas?
 

i wrote a simple trend line program but it needs that u give two lows/highs prices and times on it. it dont draw line for u but it returns price of trend line up/down of index price

maybe it can help u, this is for h1 candles, 

    input float fx = 1; // FIRST HIGH/LOW PRICE
    input float gx = 1; // SECOUND HIGH/LOW PRICE
    input datetime x1 = D'2021.4.1 12:00' ;// FIRST DATE TIME WITH THIS FORMAT
    input datetime x2 = D'2021.4.1 12:01' ;// SECOUND DATE TIME WITH THIS FORMAT
  double  price =NormalizeDouble(((gx-fx)/(Bars(Symbol(),PERIOD_H1,x1,x2)) * (1+Bars(Symbol(),PERIOD_H1,x1,TimeCurrent())))+ fx,Digits);
 
ejmin ejoni:

i wrote a simple trend line program but it needs that u give two lows/highs prices and times on it. it dont draw line for u but it returns price of trend line up/down of index price

maybe it can help u, this is for h1 candles, 

Thanks! 

 but I was looking for something more like this

https://www.mql5.com/en/forum/159058

How to program pressing a button from the Line Studies (HL, VL, Trendline)?
How to program pressing a button from the Line Studies (HL, VL, Trendline)?
  • 2016.05.06
  • www.mql5.com
Hi everyone, instead of using my mouse to press the buttons from the line studies - horizontal/vertical line, trendline, etc - I want to press a ke...