EA doesn't create variables called:
GV_xAPI_Long_
Have you pressed F3 to check the list of Global Variables?
It prints Outlook has been refresh!... but I don't see them.
You need to put a print statement in the block above, to make sure the code that sets the GVs is being called e.g.
{
Print("Setting global variables");
GlobalVariableSet("GV_xAPI_Long_"+name,StringToDouble(longps));
GlobalVariableSet("GV_xAPI_Short_"+name,StringToDouble(shortps));
}
Yes I'm checking with F3.
Indeed... I have added your print test... and it doesn't print "Setting global var"
So it means the function isn't working:
bool GetPersent(string s,string&longps,string&shortps,string sData)
{
int Pair, start_, stop;
// -------------------------------------------------
// Parse the XML file looking for an event to report
// -------------------------------------------------
Pair = 0;
Pair = StringFind(sData, s, Pair);
if (Pair == -1)
{
longps = "";
shortps = "";
return false;
}
start_ = StringFind(sData, "<shortPercentage>", Pair);
start_ += 17;
stop = StringFind(sData, "</shortPercentage>", start_);
shortps = StringSubstr(sData, start_, stop - start_);
start_ = StringFind(sData, "<longPercentage>", Pair);
start_ += 16;
stop = StringFind(sData, "</longPercentage>", start_);
longps = StringSubstr(sData, start_, stop - start_);
return true;
}
What to do?
Frenchytrader:
What to do?
Track down if GetPersent() is even called (if "limit" is 0, it won't be):
printf("limit = %i", limit);
for(int i=0;i<limit;i++)
If it is, track down why GetPersent() is returning false, which can only be in here:
i.e. "s" is not found in "sData"
{
int Pair, start_, stop;
int limit=ArraySize(sym);
printf("limit = %i", limit);
for(int i=0;i<limit;i++)
// -------------------------------------------------
// Parse the XML file looking for an event to report
// -------------------------------------------------
Pair = 0;
Pair = StringFind(sData, s, Pair);
if (Pair == -1)
{
longps = "";
shortps = "";
return false;
}
start_ = StringFind(sData, "<shortPercentage>", Pair);
start_ += 17;
stop = StringFind(sData, "</shortPercentage>", start_);
shortps = StringSubstr(sData, start_, stop - start_);
start_ = StringFind(sData, "<longPercentage>", Pair);
start_ += 16;
stop = StringFind(sData, "</longPercentage>", start_);
longps = StringSubstr(sData, start_, stop - start_);
return true;
}
Pair = external parameter:
It says 28... as I should get value for 28 pairs listed:
So as I said in my previous post, the problem is probably that "s" is not found in "sData".
The same process as before (i.e. standard debugging...)
Print your variables and check they make sense.
Print(sData);
Print(s);
Pair = StringFind(sData, s, Pair);
Print(Pair);
Pair = external parameter:
Pair != pair
You are setting Pair = 0..
thank you for helping.
It's hard for me to degub something I haven't created:
I have performed the following test:
Print("sData=",sData);
Print("s",s);
Pair = StringFind(sData, s, Pair);
Print("Pair=",Pair);
Apparently: sData is empty:
2017.02.14 12:32:18.769 My-Indicator_EA_v5 EURUSD,H1: Pair=-1
2017.02.14 12:32:18.769 My-Indicator_EA_v5 EURUSD,H1: sAUDCAD
2017.02.14 12:32:18.769 My-Indicator_EA_v5 EURUSD,H1: sData=
sData comes from GrabWeb()
string URL = "http://www.
myfxbook.com/api/get-community-outlook.xml?session=XEzQS9XQ0OLAOfl56uEC144836";
{
string cookie=NULL,headers;
char post[],result[];
int res;
ResetLastError();
res=WebRequest("GET",URL,cookie,NULL,5000,post,0,result,headers);
if(res==-1)Print(ErrorDescription(GetLastError()));
return(CharArrayToString(result));
}
{
//-
string sData=GrabWeb();
int limit=ArraySize(sym);
for(int i=0;i<limit;i++)
{
string name=sym[i].name;
string longps,shortps;
if(GetPersent(name,longps,shortps,sData))
{
Print("Setting global variables");
GlobalVariableSet("GV_xAPI_Long_"+name,StringToDouble(longps));
GlobalVariableSet("GV_xAPI_Short_"+name,StringToDouble(shortps));
}
}
Print("Outlook has been refreshed!");
}
I have already paremeter this way: picture attached:
Frenchytrader:
It's hard for me to degub something I haven't created:
OK, I did wonder if you had written the original code!
No problem.
Same deal again - figure out why GrabWeb() is returning an empty string.
Are there any messages in the Experts log?
if(res==-1)Print(ErrorDescription(GetLastError()));
You should also adjust your code to get rid of the warnings when you compile:
{
long Login_Verified = AccountInfoInteger(ACCOUNT_LOGIN);
{
datetime GV_xAPI_Index_Long_AUD_Last = GlobalVariableSet("GV_xAPI_Index_Long_AUD_Last",GlobalVariableGet("GV_xAPI_Index_Long_AUD"));
datetime GV_xAPI_Index_Long_CAD_Last = GlobalVariableSet("GV_xAPI_Index_Long_CAD_Last",GlobalVariableGet("GV_xAPI_Index_Long_CAD"));
datetime GV_xAPI_Index_Long_CHF_Last = GlobalVariableSet("GV_xAPI_Index_Long_CHF_Last",GlobalVariableGet("GV_xAPI_Index_Long_CHF"));
datetime GV_xAPI_Index_Long_EUR_Last = GlobalVariableSet("GV_xAPI_Index_Long_EUR_Last",GlobalVariableGet("GV_xAPI_Index_Long_EUR"));
datetime GV_xAPI_Index_Long_GBP_Last = GlobalVariableSet("GV_xAPI_Index_Long_GBP_Last",GlobalVariableGet("GV_xAPI_Index_Long_GBP"));
datetime GV_xAPI_Index_Long_JPY_Last = GlobalVariableSet("GV_xAPI_Index_Long_JPY_Last",GlobalVariableGet("GV_xAPI_Index_Long_JPY"));
datetime GV_xAPI_Index_Long_USD_Last = GlobalVariableSet("GV_xAPI_Index_Long_USD_Last",GlobalVariableGet("GV_xAPI_Index_Long_USD"));
datetime GV_xAPI_Index_Long_NZD_Last = GlobalVariableSet("GV_xAPI_Index_Long_NZD_Last",GlobalVariableGet("GV_xAPI_Index_Long_NZD"));
}
This Print doesn't print anything.
I don't see any message into logs.
Also this code works with my laptop at home???
Why datetime? it's should be value... so double???
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please help me to correct the error.
EA doesn't create variables called:
GV_xAPI_Long_
It prints Outlook has been refresh!... but I don't see them.
Also it prints: Function is not confirmed.
What function? I don't know.
So far... Only the void isn't working properly:
Please find attach the EA
Thank you