Help on identifying what price is

[Deleted]  

How do I call price to be used in a program and if possible can someone show me some example code and tell which part

of the code represents the price?

Thank you, Charles

[Deleted]  

Oh, great thank you very much.

So is it fair to say the bid and ask is what represents the price?

I've seen a few indicators that don't have any reference to bid or ask..

Here is one such indicator:

//+------------------------------------------------------------------+
//| ARSI.mq4 |
//| Copyright ?2009, Walter Choy |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2009, Walter Choy"
#property link ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Orange

//---- input parameters
extern int period = 20;

double ARSI[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ARSI);
SetIndexLabel(0, "ARSI");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i;
double sc;
//----
i = Bars - counted_bars;

while (i>0){
if (Bars - period <= i){
ARSI[i] = Close[i];
} else {
sc = (MathAbs(iRSI(NULL, 0 , period, PRICE_CLOSE, i) / 100 - 0.5) * 2);
ARSI[i] = ARSI[i+1] + sc * (Close[i] - ARSI[i+1]);
}
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+

In this indicator what would represent price?

This is the adaptive RSI indicator.

Thanks for your help,

Charles

[Deleted]  

In your indicator, Close[i] represents the price.

Close[0] gives the current bid price (because the current candle hasn't finished). Close[1] gives the closing bid price of the previous candle, Close[2] the one before that etc.

Also check out iClose() function which provides the facility across other symbols and time periods.

Ask price is the Bid price plus the spread.


CB

[Deleted]  

To add to what CB said, the indicator uses the close price to present to form a mathimatical representation (hence indicator). It is not concerned with the Ask or Bid price as it is not planning on making trade!

Indicators use historical prices (like Close[x]) to do their calculations. You should not use those prices to place a trade. Use Ask or Bid as they represent the most updated values (mostly).

whocares

[Deleted]  

Thank you guys! This is all very helpful. Especially for taking the time to get me those links. That was very kind of you CB.

CV