What is the difference between Close[0] and Ask/Bid?

 
I think they are the same, right?
 
All prices of the candles on the chart have been/are Bid - but if you don't know the difference between Ask and Bid - google before you start risking money!
 
Carl Schreiber:
All prices of the candles on the chart have been/are Bid - but if you don't know the difference between Ask and Bid - google before you start risking money!

Hi, surly I know what is Ask and Bid. But OP_BUY, you set Ask. But OP_SELL, you set Bid. Right?


Sofar I understand, the Close[0] is the current price. That means, by BUY, it is the Ask. By SELL, it should be the Bid. Right?

 
thomas2004:

Hi, surly I know what is Ask and Bid. But OP_BUY, you set Ask. But OP_SELL, you set Bid. Right?


Sofar I understand, the Close[0] is the current price. That means, by BUY, it is the Ask. By SELL, it should be the Bid. Right?

As I wrote all the prices of a candle on the chart (op, hi,lo,cl) are/have been Bid-prices!

Because of Bid and Ask it is quite simple, no matter what you are doing you'll always get the worse price: You buy at Ask and sell at Bid.

 

In addition to Carl,

the Close[] is never same Ask/Bid as thomas2004 believes

thomas2004:
I think they are the same, right?

The Close[] is equal the Bid ONLY when it has zero "Close[0]" but when another number used then it will refer to that candle shift

so, Close[] is an array

Ask/Bid are only the current candle at a moment...

double Close[]

Series array that contains close prices for each bar of the current chart.

Series array elements are indexed in the reverse order, i.e., from the last one to the first one. The current bar which is the last in the array is indexed as 0. The oldest bar, the first in the chart, is indexed as Bars-1.

Example:

  int handle = FileOpen("file.csv"FILE_CSV|FILE_WRITE";");
  if(handle>0)
    {
     // table column headers recording
     FileWrite(handle, "Time;Open;High;Low;Close;Volume");
     // data recording
     for(int i=0; i<Bars; i++)
       FileWrite(handle, Time[i], Open[i], High[i], Low[i], Close[i], Volume[i]);
     FileClose(handle);
    }

 

Close[0] is the closing price of the current bar/candle. However, since it hasn't closed yet, the "closing price" isn't meaningful. As stated previously, Close[] is an array that contains the closing prices of the completed bars/candles. 0 is the current bar/candle, 1 is the index of the one before that, etc. Ask is the current price that you would buy at. Bid is the current price that you would sell at. To make that clearer Ask is like the price of a car someone wants to sell at. If you want to buy the car, that's the price you have to pay. Bid is like the price of a car you want to sell. If someone wants to buy it from you, but only at a certain price, that's the price you have to sell to them at. I'm not sure that Close[0] would give you anything since, as mentioned above, bar 0 is the current bar and hasn't closed yet. It would probably return 0 because there isn't a closing value for the bar, Hope this helps clear things up.

 
Jeffrey Irick: It would probably return 0 because there isn't a closing value for the bar,
Wrong. It returns the current Bid price, which is the close price if there are no more ticks in the current candle's period. There is no probably.
 
whroeder1:
Wrong. It returns the current Bid price, which is the close price if there are no more ticks in the current candle's period. There is no probably.

I stand corrected. Cranky as ever I see, Roeder. :-)

 

To be clear, Close[n] is always defined from the final Bid price for candle n, for any n in range 0..earliest, regardless of broker or any other factor. Right?

 
Please never use Close[0] since, as discussed above, it makes no sense at all. Whichever value it may contain is conceptually wrong since an open bar is, by definition, not closed yet.
 
Close[0] is equal to Bid, always. No need to test for index 0 in indicators, just use Close[index]
Reason: