Download MetaTrader 5
To add comments, please log in or register
Have you discovered something really important? Write an article and receive 200 USD!
Roger31
8
Roger31 2016.08.20 17:23 

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

whroeder1
13627
whroeder1 2016.08.20 20:03  
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.
Roger31
8
Roger31 2016.08.21 09:14  
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 r.suwala@wp.pl |   
//+------------------------------------------------------------------+
#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("Wr38["+num+"]");
      ObjectDelete("Wr61["+num+"]");
      ObjectDelete("Wr78["+num+"]");
      ObjectDelete("Wr100["+num+"]");
      ObjectDelete("Wr138["+num+"]");
      ObjectDelete("Wr161["+num+"]");
      ObjectDelete("Wr200["+num+"]");
      ObjectDelete("Ws38["+num+"]");
      ObjectDelete("Ws61["+num+"]");
      ObjectDelete("Ws78["+num+"]");
      ObjectDelete("Ws100["+num+"]");
      ObjectDelete("Ws138["+num+"]");
      ObjectDelete("Ws161["+num+"]");
      ObjectDelete("Ws200["+num+"]");
      ObjectDelete("W PIVOT["+num+"]");
      
      
  
      }
   }

   void PlotLine(string name,double value,double line_color,double style)
   {
   ObjectCreate(name,OBJ_TREND,0,time1,value,time2,value);
   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; 
   else
   if (TimePeriod=="H4" || TimePeriod=="240") period=PERIOD_H4; 
   else
   if (TimePeriod=="D1" || TimePeriod=="1440") period=PERIOD_D1;
   else
   if (TimePeriod=="W1" || TimePeriod=="10080") period=PERIOD_W1; 
   else
   if (TimePeriod=="MN" || TimePeriod=="43200") period=PERIOD_MN1;
   else
   {
   Comment("Wrong TimePeriod. Must be H1, H4, D1, W1 or MN"); 
   return(0);
   }
  return(0);
  }
   
   
int deinit()
  {
   ObjDel();
   Comment("");
   return(0);
  }

int start()
  {
  int i;
     
  ObjDel();
  num=0;
  
  for (shift=CountPeriods-1;shift>=0;shift--)
  {
  time1=iTime(NULL,period,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);
     

       
  time2=time1+period*60;
         
  pstyle=line_style_of_pivot;
  mstyle=1;
  cstyle=3;
  num=shift;
       
  PlotLine("W PIVOT["+num+"]",P,chose_color_pivot,pstyle);
  if(Plot_pivots)
  {
     {
  
  
     }
    
   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);
  }          
  
  {
  
  }
  }
   return(0);
  }
//+------------------------------------------------------------------+
whroeder1
13627
whroeder1 2016.08.21 12:56  
  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