Jump to content

Recommended Posts

Posted

Hi,

 

I am looking for a indicator which display percentage increase or decrease in current price with YESTERDAY close.

 

Hope experts out here help me.

 

Thank you

Kisna

Posted

I think you're missing a variable.

 

Do you mean percentage of yesterdays range? Increase or decrease from yesterdays close wouldn't be possible as you don't have a range from which to gauge a percentage increase/decrease.

 

For example if yesterdays close was 10 and today is 12 what percentage would that be?

 

Hope that makes sense.

 

Lux

Posted

Hi sir,

 

I have the formula

Yesterday close = 4921 (A)

Current price (LTP) = 4863 (B)

 

1. Percentage = ((B-A)/B)*100

 

2. Price difference = B - A

 

Hope i have clarified

 

kisna

Posted (edited)

What does LTP stand for?

 

Put this together quickly based on your above formula but not sure what it's supposed to be showing.

 

//+------------------------------------------------------------------+
//|                                                   #krishna79.mq4 |
//|                      
//+------------------------------------------------------------------+


/*
  Yesterday close = 4921 (A)
  Current price (LTP) = 4863 (B)

  1. Percentage = ((B-A)/B)*100

  2. Price difference = B - A
*/

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
 {
//---- indicators
//----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
 {
//----
  
//----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
 {
  
//----
  static double dYesterdaysClose;
  
  // check for new day 
  if(dYesterdaysClose == 0 || NewDay()){
     dYesterdaysClose = iClose(Symbol(),PERIOD_D1,1);
  }
  
  Comment(DoubleToStr(((dYesterdaysClose-Bid)/Bid)*100,2));
  
//----
  return(0);
 }
//+------------------------------------------------------------------+

bool NewDay(){
static datetime LastTime = 0;

if (iTime(Symbol(),PERIOD_D1,0) != LastTime) {
	LastTime = iTime(Symbol(),PERIOD_D1,0) ;		
	return (true);
} else
	return (false);
}

 

Lux

Edited by luxinterior
Posted (edited)

Google search "bid view mt4"

for a comprehensive indicator showing current price, highs, lows, pip change, percent change etc.

 

Please use the thanks button.

Edited by shabz

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...