Download MetaTrader 5

Pivot line text

To add comments, please log in or register

Please help add text to the line on the right side. Thank you in advance for your help.

Roger31: Please help add text to the line on the right side.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. learn to code it, or pay someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
It's just an indication where making a mistake and why this happens. 
I added a formula but does not show the text and change the position of the line. I tried to fresh ways but nothing works.
 I'll be grateful for the tips. Text is not shown here. He should be at the line.I added a formula but does not show the text and change the position of the line. I tried to fresh ways but nothing works. I'll be grateful for the tips
//|                                                Fibo pivots ROGER |
//|                                                 Copyright © 2016,|
//|                                  Written by Roger |   
#property copyright "Fibo pivots ROGER"

#property indicator_chart_window
#property indicator_buffers   5

extern int     CountPeriods=10;
extern string  TimePeriod="W1";
extern bool    Plot_pivots=true;
extern bool    pivot_Month=false;
extern string  FontName =  "Arial";             
extern int     FontSize =  10;
extern int     LabelCandleOffset=3;    
extern string  comment1 = "";
extern string  comment2 = "Weekle PIVOT";
extern color chose_color_pivot = clrBlue;
extern color label_color_pivot = clrBlue;
extern int width_of_pivot_line = 1;
extern int line_style_of_pivot = 0;
extern string  comment3 = "Weekle R";
extern color chose_color_Wr38 = clrYellow;
extern color label_color_Wr38 = clrYellow;
extern color chose_color_Wr61 = clrLime;
extern color label_color_Wr61 = clrLime;
extern color chose_color_Wr78 = clrRed;
extern color label_color_Wr78 = clrRed;
extern color chose_color_Wr100 = clrAqua;
extern color label_color_Wr100 = clrAqua;
extern color chose_color_Wr138 = clrOrange;
extern color label_color_Wr138 = clrOrange;
extern color chose_color_Wr161 = clrBrown;
extern color label_color_Wr161 = clrBrown;
extern color chose_color_Wr200 = clrBlack;
extern color label_color_Wr200 = clrBlack;
extern string  comment4 = "Weekle S";
extern color chose_color_Ws38 = clrYellow;
extern color label_color_Ws38 = clrYellow;
extern color chose_color_Ws61 = clrLime;
extern color label_color_Ws61 = clrLime;
extern color chose_color_Ws78 = clrGreen;
extern color label_color_Ws78 = clrGreen;
extern color chose_color_Ws100 = clrAqua;
extern color label_color_Ws100 = clrAqua;
extern color chose_color_Ws138 = clrOrange;
extern color label_color_Ws138 = clrOrange;
extern color chose_color_Ws161 = clrBrown;
extern color label_color_Ws161 = clrBrown;
extern color chose_color_Ws200 = clrBlack;
extern color label_color_Ws200 = clrBlack;

   datetime time1;
   datetime time2;
   double open,close,high,low,mhigh,mlow,mclose,mopen;
   double P,R1,R2,R3,R4,R5,R6,R7,S1,S2,S3,S4,S5,S6,S7;
   double H1,H2,H3,H4,H5,H6,H7,L1,L2,L3,L4,L5,L6,L7,Range;
   double Wr38,Wr61,Wr78,Wr100,Wr138,Wr161,Wr200,Ws38,Ws61,Ws78,Ws100,Ws138,Ws161,Ws200;
   double pstyle, mstyle,cstyle,pstylem;
   int shift, num, period;
   void ObjDel()
      for (;num<=CountPeriods;num++)
      ObjectDelete("W PIVOT["+num+"]");
      ObjectDelete("W PIVOT["+num+"]");

   void PlotLine(string name,double value,double line_color,double style)
   ObjectSet(name, OBJPROP_WIDTH, width_of_pivot_line);
   ObjectSet(name, OBJPROP_STYLE, line_style_of_pivot);
   ObjectSet(name, OBJPROP_RAY, false);
   ObjectSet(name, OBJPROP_BACK, true);
   ObjectSet(name, OBJPROP_COLOR, line_color);
   void objText(string name, string tex, datetime time, double price, int window=0, color tex_color=White, string tex_font="Arial",
                int tex_size=12)   
int init()

   if (TimePeriod=="H1" || TimePeriod=="60") period=PERIOD_H1; 
   if (TimePeriod=="H4" || TimePeriod=="240") period=PERIOD_H4; 
   if (TimePeriod=="D1" || TimePeriod=="1440") period=PERIOD_D1;
   if (TimePeriod=="W1" || TimePeriod=="10080") period=PERIOD_W1; 
   if (TimePeriod=="MN" || TimePeriod=="43200") period=PERIOD_MN1;
   Comment("Wrong TimePeriod. Must be H1, H4, D1, W1 or MN"); 
int deinit()

int start()
  int i;
  for (shift=CountPeriods-1;shift>=0;shift--)
  high  = iHigh(NULL,PERIOD_W1,shift+1);
  low   = iLow(NULL,PERIOD_W1,shift+1);
  open  = iOpen(NULL,PERIOD_W1,shift+1);
  close = iClose(NULL,PERIOD_W1,shift+1);
  P  = (high+low+close)/3;
  R1 = (high-low)*0.382+P;
  R2 = (high-low)*0.618+P;
  R3 = (high-low)*0.764+P;
  R4 = (high-low)*1.00+P;
  R5 = (high-low)*1.382+P;
  R6 = (high-low)*1.618+P;
  R7 = (high-low)*2.00+P;
  S1 = P-(high-low)*0.382;
  S2 = P-(high-low)*0.618;
  S3 = P-(high-low)*0.764;
  S4 = P-(high-low)*1.00;
  S5 = P-(high-low)*1.382;
  S6 = P-(high-low)*1.618;
  S7 = P-(high-low)*2.00;
  mhigh  = iHigh(NULL,PERIOD_MN1,shift+1);
  mlow   = iLow(NULL,PERIOD_MN1,shift+1);
  mopen  = iOpen(NULL,PERIOD_MN1,shift+1);
  mclose = iClose(NULL,PERIOD_MN1,shift+1);

  PlotLine("W PIVOT["+num+"]",P,chose_color_pivot,pstyle);
   PlotLine("Wr 38,2["+num+"]",R1,chose_color_Wr38,pstyle);
   PlotLine("Wr 61,8["+num+"]",R2,chose_color_Wr61,pstyle);
   PlotLine("Wr 76,4["+num+"]",R3,chose_color_Wr78,pstyle);
   PlotLine("Wr 100["+num+"]",R4,chose_color_Wr100,pstyle);
   PlotLine("Wr 138,2["+num+"]",R5,chose_color_Wr138,pstyle);
   PlotLine("Wr 161,8["+num+"]",R6,chose_color_Wr161,pstyle);
   PlotLine("Wr 200["+num+"]",R7,chose_color_Wr200,pstyle);
   PlotLine("Ws 38,2["+num+"]",S1,chose_color_Ws38,pstyle);
   PlotLine("Ws 61,8["+num+"]",S2,chose_color_Ws61,pstyle);
   PlotLine("Ws 76,4["+num+"]",S3,chose_color_Ws78,pstyle);
   PlotLine("Ws 100["+num+"]",S4,chose_color_Ws100,pstyle);
   PlotLine("Ws 138,2["+num+"]",S5,chose_color_Ws138,pstyle);
   PlotLine("Ws 161,8["+num+"]",S6,chose_color_Ws161,pstyle);
   PlotLine("Ws 200["+num+"]",S7,chose_color_Ws200,pstyle);
    ObjectCreate ( "W PIVOT LINE["+num+"]" , OBJ_LABEL , 0 , 0 ,P ) ;
    ObjectSetText ("W PIVOT LINE["+num+"]" , " PIVIOT " , 10 , " Ariel " , Red ) ;
    ObjectSet ( "W PIVOT LINE["+num+"]" , OBJPROP_CORNER , 0 ) ;
    ObjectMove("W PIVO1 LINE["+num+"]", 0, 0,0);
  1. I asked you to edit your original post using SRC, instead you re-posted. Then you typed text in the SRC box, so you lost the highlighting.
  2. "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. You "added a formula" What formula, where, there are no mind readers here.
  4.  P  = (high+low+close)/3;
        ObjectCreate ( "W PIVOT LINE["+num+"]" , OBJ_LABEL , 0 , 0 ,P ) ;
    Did you read OBJ_LABEL - Object Types - Objects Constants - Standard Constants, Enumerations and Structures - MQL4 Reference and understand that it takes a pixel offset from a corner of the chart. P is not a offset (125,) P is a price(1.123.) Perhaps you want OBJ_TEXT.
  5. Once you create your "W PIVOT LINE[x]"  you never delete it, so it will never move.

To add comments, please log in or register