Change color of Trend Line for Closed positions.

 

Hello,

Is there a way to change the color of trendline plotted for closed positions.

Mine is Blue on black background for Long positions. I can barely see it.

And dark Red for Short positions.

I want these lines to be Yellow so I can easily see them.

And if possible, change the width to 3.

Suggestions welcome.

Thank you.




 

As far as I know, it is predetermined and hard-coded on the platform. There may be some indirect non-documented way to change it but I am unaware.

However, thinking about it, maybe one could write a MQL program to monitor charts for such graphical objects and alter their appearance for you. It's not ideal, but it is a possibility.

 
Fernando Carreiro #:

As far as I know, it is predetermined and hard-coded on the platform. There may be some indirect non-documented way to change it but I am unaware.

However, thinking about it, maybe one could write a MQL program to monitor charts for such graphical objects and alter their appearance for you. It's not ideal, but it is a possibility.

Any way to change the settings in some file in data folder?

 
JForex:

Hello,

Is there a way to change the color of trendline plotted for closed positions.

Mine is Blue on black background for Long positions. I can barely see it.

And dark Red for Short positions.

I want these lines to be Yellow so I can easily see them.

And if possible, change the width to 3.

Suggestions welcome.

Thank you.




first find the function which triggers when a position is closed

then simply find object if it exists

If(ObjectFind(ChartID(),"trendline_name")!=-1) {
//Get Anchor points and Time

double your_price,your_price2;
long time1,time2;
ObjectGetDouble(chart_ID,name,OBJPROP_PRICE,your_price,0); 
ObjectGetDouble(chart_ID,name,OBJPROP_PRICE,your_price2,1);

//get time....


//delete trendline
ObjectDelete(0,"trendline_name");

//redraw it
if(!ObjectCreate(chart_ID,name,OBJ_TREND,sub_window,time1,price1,time2,price2)) 
     { 
      Print(__FUNCTION__, 
            ": failed to create a trend line! Error code = ",GetLastError()); 
      return(false); 
     } 
//set color or width
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr); 
 ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,width); 

}

then update it / force redraw

this is manually typed code for example, may not compile

 
JForex #: Any way to change the settings in some file in data folder?
I do believe my post was quite clear!
 
Arpit T #:

first find the function which triggers when a position is closed

then simply find object if it exists

then update it / force redraw

this is manually typed code for example, may not compile

Thanks. My EA is opening and closing the position using this function.

I use clrGold, but it has no effect.

Are these color parameters not supposed to draw the correct color of trendline?


OrderSend(symbol,cmd,lot_size,price,INT_MAX,0,0,"",0,0,clrGold);                  
OrderClose(OrderTicket(),OrderLots(),Bid,INT_MAX,clrGold);
 
JForex #:

Thanks. My EA is opening and closing the position using this function.

I use clrGold, but it has no effect.

Are these color parameters not supposed to draw the correct color of trendline?


When OrderClose is called, below that you have to place code and it may work, Kindly read documentation for more info

 
Arpit T #:

When OrderClose is called, below that you have to place code and it may work, Kindly read documentation for more info

I think there’s a misunderstanding.
This is not related to EA.

These lines show up when I drag closed positons on to the chart. Even when EA is not running.

This is some setting in MT4.
 
JForex #:
I think there’s a misunderstanding.
This is not related to EA.

These lines show up when I drag closed positons on to the chart. Even when EA is not running.

This is some setting in MT4.

Sorry I thought it was for MT5, I do not have any idea about MT4 as I have never coded something for it.

 

This thread has been moved to the MT4/mql4 section on the forum.

In future please post in the correct section.

 
JForex #: This is some setting in MT4.

As I have already stated, there are no documented settings. It is hard-coded.