Quote problem

 

Good morning,

I have a problem with quote. I explain.

I have an EA which call an icustom and in the setting I give a pair name. For to be sure the data which used by the icustom is good, I write in a file the iclose (iclose(pair name,0,0), I want the current close ) of the pair. And I don't have the good quote.

I precise, the EA is on a chart and the pair is on this chart is an other I give in the setting of icustom, and the timeframe is daily

What is the problem, please, how can I have the good quotes (sometimes the quotes is good and sometimes no)? I work like this, because my EA use 16 pairs and I can't open a chart for each pair.

Thank's a lot for your answer.

 
neo-13:

Good morning,

I have a problem with quote. I explain.

I have an EA which call an icustom and in the setting I give a pair name. For to be sure the data which used by the icustom is good, I write in a file the iclose (iclose(pair name,0,0), I want the current close ) of the pair. And I don't have the good quote.

I precise, the EA is on a chart and the pair is on this chart is an other I give in the setting of icustom, and the timeframe is daily

What is the problem, please, how can I have the good quotes (sometimes the quotes is good and sometimes no)? I work like this, because my EA use 16 pairs and I can't open a chart for each pair.

Thank's a lot for your answer.

Try using MarketInfo( pair, MODE_ASK ) && MarketInfo( pair, MODE_BID ).

If you're getting Error Messages, Please provide the Error# you're getting.

 
neo-13: I have an EA which call an icustom and in the setting I give a pair name. For to be sure the data which used by the icustom is good, I write in a file the iclose (iclose(pair name,0,0), I want the current close ) of the pair. And I don't have the good quote.
Are you using the tester? In the tester the current chart value is Close[0], but for other pairs, they are not shifted.
datetime now = Time[0]; // or TimeCurrent()
int      iOP = iBarShift(OtherPair, OtherTF, now);
double   cOP = iClose(OtherPair, OtherTF, iOP);
 

Hi and thank's for your answer,

ubzen:

I tested your proposition and I don't have error, it return me BID and ASK, not the true BID and ASK but around this.


Whroeder:

What is the tester? For backtesting?? If it's that, no I didn't use, my problem is with a current system. I do my backtesting with an other soft.

I tested your proposition and I written this* in the init() for see what mt4 return me, and it return wrong close. At the first compilation sometime, it return 0, sometime a close around the true close, and at the second compilation it return the true close. It's the same thing if I use iclose(pair name,0,0).

*datetime now = TimeCurrent();
int iOP = iBarShift("AUDNZD", 0, now);
double cOP = iClose("AUDNZD", 0, iOP);

Print(cOP);


For information, if the chart of the pair ttaht I want the close is open, the result return by iclose(pair name,0,0) is good, but I work with 16 pairs, and I can't open the 16 charts.

Other proposition??

 
neo-13: Other proposition??
What is the piece of code you're having problems with?
 

thank's uzben,

I have a problem just whith iclose(pair name,0,0).

In other word, if I write in the init() Print("USDCAD",0,0) and the chart of USDCAD is not open, mt4 write a price which is not the good price. But if I compil again, mt4 return the good price. Why?

 
neo-13: if I write in the init() Print("USDCAD",0,0) and the chart of USDCAD is not open, mt4 write a price which is not the good price. Why?
Because there is no chart open, it has to download current history. Call iClose once in init. Get the current price in start.
 

Ok thank's,

but how can I do for have the good close without open all the charts?


Thank's again for your help.

 
neo-13: but how can I do for have the good close without open all the charts?
Call iClose (or iOpen) for all your pairs in init to start history download. Get the good values (open, high, low, close) in start.
 

Thank's,

Yes it's a good idea, but it's not good for my system. However I finaly found an other solution. I created a indicator which use all the pair I use, then in the init() I can call iclose and to have the good price.


Thank's so much for your answers and help, I appreciated !!

Reason: