I tried using your code but it only get me the Ask/Bid of the first currency pair in the list of symbols in MT5 regardless of the currency symbol I add in the code.
For example, I have USDCAD as the first symbol in MT5 symbols list. I write the code you provided with EURUSD, but the Ask price I get is the USDCAD one not the EURUSD one. How to fix that?
Also, do you have any suggestions on how to connect ask price of all currency pairs/symbols to Excel?
I modified it to take the data: high, close, low (HCL) of the previous candle to the current one; Upper and Lower Bollinger Band values (20,2) of the previous candle to the current one; Stochastic and %D (10,3,3) of the previous candle to the current one.
The code follows:
double BB_T[]; //array for indicator BBdouble BB_B[];
int BB_handle; //handle for indicator BBdouble STOCH[]; //array for indicator STOCHdouble PERCD[];
int ST_handle; //handle for indicator STOCH//-----------------------------------------------------------------------------voidOnInit()
{
EventSetTimer(1);
//--- creation of the BB and STOCH indicator
BB_handle=iBands(_Symbol,PERIOD_CURRENT,20,0,2,PRICE_CLOSE);
ST_handle=iStochastic(_Symbol,PERIOD_CURRENT,10,3,3,MODE_SMA,STO_LOWHIGH);
return;
}
voidOnTimer()
{
//--- filling an array MA[] with current values of iMA//--- Copying 100 elements//BBCopyBuffer(BB_handle,1,0,100,BB_T); //Upper
ArraySetAsSeries(BB_T,true);
CopyBuffer(BB_handle,2,0,100,BB_B); //Lower
ArraySetAsSeries(BB_B,true);
//StochasticCopyBuffer(ST_handle,0,0,100,STOCH); //Stoch
ArraySetAsSeries(STOCH,true);
CopyBuffer(ST_handle,1,0,100,PERCD); //%D
ArraySetAsSeries(PERCD,true);
// Check & Add Item DDEif(!CheckItem(_Symbol,"Maximum"))
{
if(!AddItem(_Symbol,"Maximum")) return;
}
if(!CheckItem(_Symbol,"Minimum")) AddItem(_Symbol,"Minimum");
if(!CheckItem(_Symbol,"Fechamento")) AddItem(_Symbol,"Fechamento");
//if(!CheckItem(_Symbol,"BB_Top")) AddItem(_Symbol,"BB_Top");
if(!CheckItem(_Symbol,"BB_Lower")) AddItem(_Symbol,"BB_Lower");
//if(!CheckItem(_Symbol,"STOCH")) AddItem(_Symbol,"STOCH");
if(!CheckItem(_Symbol,"%D")) AddItem(_Symbol,"%D");
// Set Item Value DDE //HCL candles
SetItem(_Symbol,"Maximum",iHigh(_Symbol,5,1));
SetItem(_Symbol,"Minimum",iLow(_Symbol,5,1));
SetItem(_Symbol,"Fechamento",iClose(_Symbol,5,1));
//BB Top and Bottom
SetItem(_Symbol,"BB_Top",DoubleToString(BB_T[1],2));
SetItem(_Symbol,"BB_Lower",DoubleToString(BB_B[1],2));
//Stochastic and %D
SetItem(_Symbol,"STOCH",DoubleToString(STOCH[1],2));
SetItem(_Symbol,"%D",DoubleToString(PERCD[1],2));
}
I tried using your code but it only get me the Ask/Bid of the first currency pair in the list of symbols in MT5 regardless of the currency symbol I add in the code.
For example, I have USDCAD as the first symbol in MT5 symbols list. I write the code you provided with EURUSD, but the Ask price I get is the USDCAD one not the EURUSD one. How to fix that?
Also, do you have any suggestions on how to connect ask price of all currency pairs/symbols to Excel?
Hi brother, do you have a MT4 version of this. the MT4 DDE doesn't work. But the one I'm using for FX doesn't have an MT5 server. Thanks for providing me a code if you have one. I want to get my net worth and position currency profit/loss,.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
How to add the purchase price of a particular currency pair to Excel
i need ask & bid currency
// Set Item Value DDE
>>>>>> SetItem("BID","EURUSD",(string) ?????());<<<<<<
HI GUYS IF WANT SHOW EURUSD BID OR ASK PRICE HOW TO MODIFY THIS?
THANK YOU
Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
Please do not make excessive use of capital letters when posting. It is considered shouting and very rude.
Good evening.
After a lot of fiddling, I managed to solve it. I registered on the site just for that.
Change the entire OnTimer() function:
void OnTimer()
{
//--- filling an array MA[] with current values of iMA
//--- Copying 100 elements
// CopyBuffer(MA_handle,0,0,100,MA);
// ArraySetAsSeries(MA,true);
double EURUSD_ASK = SymbolInfoDouble("EURUSD",SYMBOL_ASK); // for eurusd (example)
double EURUSD_BID = SymbolInfoDouble("EURUSD",SYMBOL_BID);
double USDCHF_ASK = SymbolInfoDouble("USDCHF",SYMBOL_ASK);
double USDCHF_BID = SymbolInfoDouble("USDCHF",SYMBOL_BID);
// Check & Add Item DDE
// if(!CheckItem("EMA","B"))
// {
// if(!AddItem("EMA","B")) return;
// }
if(!CheckItem("COMPANY","Value")) AddItem("COMPANY","Value");
if(!CheckItem("TIME","Value")) AddItem("TIME","Value");
if(!CheckItem("EURUSD","ASK")) AddItem("EURUSD","ASK");
if(!CheckItem("EURUSD","BID")) AddItem("EURUSD","BID");
if(!CheckItem("USDCHF","ASK")) AddItem("USDCHF","ASK");
if(!CheckItem("USDCHF","BID")) AddItem("USDCHF","BID");
// Set Item Value DDE
SetItem("COMPANY","Value",(string)AccountInfoString(ACCOUNT_COMPANY));
SetItem("TIME","Value",(string)TimeCurrent());
// SetItem("EMA","B","EMA(21):"+DoubleToString(MA[0],6));
SetItem("EURUSD","ASK",DoubleToString(EURUSD_ASK,5));
SetItem("EURUSD","BID",DoubleToString(EURUSD_BID,5));
SetItem("USDCHF","ASK",DoubleToString(USDCHF_ASK,5));
SetItem("USDCHF","BID",DoubleToString(USDCHF_BID,5));
}
The rest is the same as described above.
I hope it helps someone.
Here are the changes I made to the code below.
// Set Item Value DDE
>>>>>> SetItem("BID","EURUSD",(string) ?????());<<<<<<
HI GUYS IF WANT SHOW EURUSD BID OR ASK PRICE HOW TO MODIFY THIS?
THANK YOU
How to add the purchase price of a particular currency pair to Excel
i need ask & bid currency
I tried using your code but it only get me the Ask/Bid of the first currency pair in the list of symbols in MT5 regardless of the currency symbol I add in the code.
For example, I have USDCAD as the first symbol in MT5 symbols list. I write the code you provided with EURUSD, but the Ask price I get is the USDCAD one not the EURUSD one. How to fix that?
Also, do you have any suggestions on how to connect ask price of all currency pairs/symbols to Excel?
Thanks!
I modified it to take the data: high, close, low (HCL) of the previous candle to the current one; Upper and Lower Bollinger Band values (20,2) of the previous candle to the current one; Stochastic and %D (10,3,3) of the previous candle to the current one.
The code follows:
The rest is the same
I tried using your code but it only get me the Ask/Bid of the first currency pair in the list of symbols in MT5 regardless of the currency symbol I add in the code.
For example, I have USDCAD as the first symbol in MT5 symbols list. I write the code you provided with EURUSD, but the Ask price I get is the USDCAD one not the EURUSD one. How to fix that?
Also, do you have any suggestions on how to connect ask price of all currency pairs/symbols to Excel?
Thanks!
Try change: Symbol() to _Symbol
Please visit the brazilian comments
https://www.mql5.com/pt/forum/33344