• Get access

Moving Horizontal line in the chart

To add comments, please log in or register
Vijay Akash T P
275
Vijay Akash T P  
   preblueline=data[pos][1];
   if(data[pos][1]>Open[0])
     {
      blueline=data[pos][1]; 
     }
   if(data[pos][1]<Open[0])
     {
      blueline=data[pos][1];
      }
   if (preblueline!=blueline){preblueline=blueline;}

Hi Friends,

I draw a horizontal line the chart say at price 1.14500 ( Previous Value)

Now the market moves the my new horizontal line is 1.12345 (Current Value)

I want to show these in the Chart like

Previous Position of Pivot Line is x.xxxxx Present Position is x.xxxxx

I am trying lot of codes but it shows current pivot value for both. Though i am pro coder.

Thanks in advance 

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types
  • www.mql5.com
When a graphical object is created using the ObjectCreate() function, it's necessary to specify the type of object being created, which can be one of the values of the ENUM_OBJECT enumeration. Further specifications of object properties are possible using functions for working with graphical objects.
Fernando Morales
2939
Fernando Morales  
Vijay Akash T P:

Hi Friends,

I draw a horizontal line the chart say at price 1.14500 ( Previous Value)

Now the market moves the my new horizontal line is 1.12345 (Current Value)

I want to show these in the Chart like

Previous Position of Pivot Line is x.xxxxx Present Position is x.xxxxx

I am trying lot of codes but it shows current pivot value for both. Though i am pro coder.

Thanks in advance 

Documentation gives you the answer


https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_hline

Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_HLINE
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Types / OBJ_HLINE
  • www.mql5.com
//| Create the horizontal line                                       |                 price=0,                         width=1,            //| Move horizontal line                                             | //| Delete a horizontal line                                         |...
Vijay Akash T P
275
Vijay Akash T P  
Fernando Morales:

Documentation gives you the answer


https://www.mql5.com/en/docs/constants/objectconstants/enum_object/obj_hline

This is not what i am looking boss. I created a line at a price (X) for given condition. Later stage the price (X) changes for the given condition.

Here there are two value for X.

Now the problem is I want to recall 

Previous value is X

Present value is X

Keith Watford
Moderator
21036
Keith Watford  
   preblueline=data[pos][1];
   if(data[pos][1]>Open[0])
     {
      blueline=data[pos][1]; 
     }
   if(data[pos][1]<Open[0])
     {
      blueline=data[pos][1];
      }
   if (preblueline!=blueline){preblueline=blueline;}

Please explain what you are trying to achieve with this block of code.

Vijay Akash T P
275
Vijay Akash T P  
Keith Watford:

Please explain what you are trying to achieve with this block of code.

 I created a line at a price (X) for given condition. Later stage the price (X) changes for the given condition.

Here there are two value for X. which i would call as Previous value and present value.

Now the problem is I want to store them separaetely and recall later

Previous value is X

Present value is X

William Roeder
20410
William Roeder  
You need code that saves the previous value when you update the current value?
Vijay Akash T P
275
Vijay Akash T P  
William Roeder:
You need code that saves the previous value when you update the current value?
 preblueline=data[pos][1];
   if(data[pos][1]>Open[0])
     {
      blueline=data[pos][1]; 
     }
   if(data[pos][1]<Open[0])
     {
      blueline=data[pos][1];
      }
   if (preblueline!=blueline){preblueline=blueline;}

this is not working bro

Keith Watford
Moderator
21036
Keith Watford  
Vijay Akash T P:

 I created a line at a price (X) for given condition. Later stage the price (X) changes for the given condition.

Here there are two value for X. which i would call as Previous value and present value.

Now the problem is I want to store them separaetely and recall later

Previous value is X

Present value is X

I am not sure what you are trying to do.

   preblueline=data[pos][1];
   if(data[pos][1]>Open[0])
     {
      blueline=data[pos][1]; 
     }
   if(data[pos][1]<Open[0])
     {
      blueline=data[pos][1];
      }
   if (preblueline!=blueline){preblueline=blueline;}

Can be simplified to

   preblueline=data[pos][1];
   if(data[pos][1]!=Open[0])
      blueline=data[pos][1];
   else
      preblueline=blueline;
Vijay Akash T P
275
Vijay Akash T P  
Keith Watford:

I am not sure what you are trying to do.

Can be simplified to

i am getting the same value for both the lines. What i want is Preblueline is previous value and Blue is current value. Help me please

Keith Watford
Moderator
21036
Keith Watford  
Vijay Akash T P:

i am getting the same value for both the lines. What i want is Preblueline is previous value and Blue is current value. Help me please

The problem is that you are talking about price(x) and you don't use x in your code.

What is data[pos][1] ?

Vijay Akash T P
275
Vijay Akash T P  
Keith Watford:

The problem is that you are talking about price(x) and you don't use x in your code.

What is data[pos][1] ?

To make it clear below actual issue:

close price on a given condition is 1.10876 - previous value
After sometime close price on a given condition is 1.11768 - present value
I want store these values and recall it.

After this present value will change, then present has to be previous value and newly changed value is present value

Cycle goes on. Hope I tried to

12
To add comments, please log in or register