Download MetaTrader 5

DayOfWeek-Names vertically at the top

To add comments, please log in or register
Sell products via the Market and track your sales statistics
BurkhardWille
170
BurkhardWille 2014.04.06 11:33 

Hi,

is there maybe a finished indicator, which show me the DayOfWeek-Names vertically at the top (or bottom), like in my picture (text created manually to show my request).


Regards

Burkhard

BurkhardWille
170
BurkhardWille 2014.04.06 11:33  
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.06 11:39  
Google?
Alain Verleyen
Moderator
30743
Alain Verleyen 2014.04.06 12:13  
BurkhardWille:

Did you search the Codebase ?
BurkhardWille
170
BurkhardWille 2014.04.09 15:18  
deysmacro:
Google?

wow, realy good help, thank you. :-X


angevoyageur:
Did you search the Codebase ?

sure, but the nearest code of vertical text is from "News event indicator" (https://www.mql5.com/en/code/10459), but the code dont work with the new MT4 > build 600, so my question is still on top.

Tjipke de Vries
6316
Tjipke de Vries 2014.04.09 16:09  
BurkhardWille:

wow, realy good help, thank you. :-X


sure, but the nearest code of vertical text is from "News event indicator" (https://www.mql5.com/en/code/10459), but the code dont work with the new MT4 > build 600, so my question is still on top.


Then look to the part of the code where the line is created with the text

      if(!skip)
        {
         if(ImpactToNumber(news[i][COLUMN_IMPORTANCE])>impact)impact=ImpactToNumber(news[i][COLUMN_IMPORTANCE]);
         if(StrToTime(news[i][COLUMN_DATE]+" "+news[i][COLUMN_TIME])== current) continue;
         current=(broker-local)+StrToTime(news[i][COLUMN_DATE]+" "+news[i][COLUMN_TIME]);
         color clr = low_color;
         if(impact == 2) clr = medium_color;  else
         if(impact == 3)clr = high_color;
 
         string text="";
         if(news[i][COLUMN_PREVIOUS]!="" || news[i][COLUMN_FORECAST]!="") text="["+news[i][COLUMN_PREVIOUS]+", "+news[i][COLUMN_FORECAST]+"]";
         if(news[i][COLUMN_IMPORTANCE]!="") text=text+" "+news[i][COLUMN_IMPORTANCE];
 
         ObjectCreate("NewsLine"+i,OBJ_VLINE,0,current,0);
         ObjectSet("NewsLine"+i,OBJPROP_COLOR,clr);
         ObjectSet("NewsLine"+i,OBJPROP_STYLE,STYLE_DASHDOTDOT);
         ObjectSet("NewsLine"+i,OBJPROP_BACK,true);
         ObjectSetText("NewsLine"+i,news[i][COLUMN_DATE]+" "+news[i][COLUMN_DESCRIPTION]+" "+text,8);
 
         if(showLineText)
           {
            if(Period()<PERIOD_H4)
              {
               ObjectCreate("NewsText"+i,OBJ_TEXT,0,current,WindowPriceMin()+(WindowPriceMax()-WindowPriceMin())*0.8);
               ObjectSet("NewsText"+i,OBJPROP_COLOR,clr);
               ObjectSet("NewsText"+i,OBJPROP_ANGLE,90);
               ObjectSetText("NewsText"+i,news[i][COLUMN_DATE]+" "+news[i][COLUMN_DESCRIPTION]+" "+text,8);
              }
           }
        }
BurkhardWille
170
BurkhardWille 2014.04.09 21:20  

How you can see, the position of the text is not correctly:

WindowPriceMin()+(WindowPriceMax()-WindowPriceMin())*0.8

The images of the indicator dont match with the code.


I guess, WindowPrice is not a good solution, because only at a new tick, the position of the text-object is calculation correctly.

qjol
3243
qjol 2014.04.09 23:33  
you can try tou use XY position ChartTimePriceToXY or calculate it using CHART_WIDTH_IN_PIXELS and CHART_HEIGHT_IN_PIXELS
Tjipke de Vries
6316
Tjipke de Vries 2014.04.10 15:42  
input double textplace = 25;


//calculation height
   int heightinpixels = ChartHeightInPixelsGet(0,0);
   double textprice = WindowPriceMax()-((WindowPriceMax()-WindowPriceMin())*(textplace/heightinpixels));

day at line

BurkhardWille
170
BurkhardWille 2014.04.17 09:46  

sorry, but it don't work if I zoom in/out, the text is not on the top.

SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.17 10:58  
BurkhardWille:

sorry, but it don't work if I zoom in/out, the text is not on the top.


Have you tried to re-attach?
123
To add comments, please log in or register