Download MetaTrader 5
To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
J Webster
929
J Webster 2011.03.10 13:37 
Is there a way to change the chart background color depending on a variable in MQL4?
qjol
3243
qjol 2011.03.10 13:47  

AFAIK it's can be done only through WINAPI

Roman
637
Roman 2011.03.10 14:03  
SanMiguel:
Is there a way to change the chart background color depending on a variable in MQL4?

hi


you can draw rectangle object, bigger than background, effect will be the same.


regards

oromek

J Webster
929
J Webster 2011.03.10 14:05  
oromek:

hi


you can draw rectangle object, bigger than background, effect will be the same.


regards

oromek


How do I get the size of the window to draw a rectangle across it and continually readjust the rectangle to the new candle?
Ickyrus
872
Ickyrus 2011.03.10 14:37  

I think I saw somthing about this in the libraries. The trouble for me is that the comments are in russian https://www.mql5.com/en/code/8412

Airat Safin
1300
Airat Safin 2011.03.10 14:56  
qjol
3243
qjol 2011.03.10 17:12  
J Webster
929
J Webster 2011.03.14 21:31  

I tried this code but it doesn't colour in the right hand side of the chart on ichiomoku charts sue to the 26 period shift.

Any ideas on what to change?

I tired adding +26 to the WindowBarsPerChart but it doesnt change anything.


   //background
   datetime left=Time[WindowFirstVisibleBar()];
   int      right_bound=WindowFirstVisibleBar()-WindowBarsPerChart();
   if(right_bound<0) right_bound=0;
   datetime right=Time[right_bound]+Period()*60;

   if (
          Bid > iIchimoku(Symbol(), PERIOD_D1, 9, 26, 52, MODE_SENKOUSPANA, 0) && 
          Bid > iIchimoku(Symbol(), PERIOD_D1, 9, 26, 52, MODE_SENKOUSPANB, 0) &&
          Bid > iIchimoku(Symbol(), PERIOD_H4, 9, 26, 52, MODE_SENKOUSPANA, 0) && 
          Bid > iIchimoku(Symbol(), PERIOD_H4, 9, 26, 52, MODE_SENKOUSPANB, 0) &&
          Bid > iIchimoku(Symbol(), PERIOD_H1, 9, 26, 52, MODE_SENKOUSPANA, 0) && 
          Bid > iIchimoku(Symbol(), PERIOD_H1, 9, 26, 52, MODE_SENKOUSPANB, 0)
      )
   {
      ObjectSet("Bkgrnd", OBJPROP_COLOR, LimeGreen);
      ObjectSet("Bkgrnd", OBJPROP_PRICE1, WindowPriceMax(0));
      ObjectSet("Bkgrnd", OBJPROP_PRICE2, WindowPriceMin(0));
      ObjectSet("Bkgrnd", OBJPROP_TIME1, left);
      ObjectSet("Bkgrnd", OBJPROP_TIME2, right);
   }
J Webster
929
J Webster 2011.03.15 10:38  

It seems that if I do this, the Time function cannot pick up a correct time:


datetime left=Time[WindowFirstVisibleBar()];
   int      right_bound=WindowFirstVisibleBar()-WindowBarsPerChart()-26;
   //if(right_bound<0) right_bound=0;
   datetime right=Time[right_bound]+Period()*60;
J Webster
929
J Webster 2011.03.16 10:21  
? bump
Airat Safin
1300
Airat Safin 2011.03.16 11:53  
int iShiftBars = 26 ;
datetime right=Time[right_bound]+Period()*60*iShiftBars;
/ /12
To add comments, please log in or register