Line Studies - how to programatically change the color of a line?

 

Hi,


in my chart I'm working with manually drawn trendlines lines (the MT4 build-in line objects).

To speed up the process I'd like to create an indicator that does:

- If I press the key "B" the line tool will be activated with a blue line

- If I press the key "R" with a red line






My question is, whether the line study tool could be initialized with a special color resp. thickness.


Here is my code - it draws the trend line, but I didn't find any possibility to customize it.


#define     MT4_WMCMD_TRENDLINE       33257 

#include    <WinUser32.mqh>           
#import     "user32.dll"
int         GetAncestor(int, int); 
int         GetLastActivePopup( int hWnd );
#define     GA_ROOT 2

int main =  GetAncestor(WindowHandle(_Symbol, _Period), GA_ROOT);


void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
  
   if (id==CHARTEVENT_KEYDOWN && lparam == 66) {  //if the key "B" is presed
      PostMessageA(main, WM_COMMAND, MT4_WMCMD_TRENDLINE, 0); //draw a trendline
      
   }      
} 


Does anybody know how to implement that?