To use chat, please login.
Back to contacts

Need API help

Dec 02, 2013 at 15:45
2,286 Views
38 Replies
Member Since Nov 21, 2011   1718 posts
Dec 02, 2013 at 15:45
Hi all,

Does anyone here skilled enough to developp an API.

https://www.myfxbook.com/api

I would like to get Outlook Community connected to MT4 in order to create signals.

Myfxbook team told me it is possible... but I have no idea how to do so.

I'm looking for someone that could help me.


Cheers
CrazyTrader
Member Since Dec 09, 2009   3 posts
Dec 02, 2013 at 20:10
https://codebase.mql4.com/4428
https://codebase.mql4.com/7353

Above will give you the ability to communicate with API or any other web source.

BTW. You can check dukascopy sentiment too..

Have a pips filled day,

M
 
Member Since Nov 21, 2011   1718 posts
Dec 02, 2013 at 21:19
moneyrain posted:
https://codebase.mql4.com/4428
https://codebase.mql4.com/7353

Above will give you the ability to communicate with API or any other web source.

BTW. You can check dukascopy sentiment too..

Have a pips filled day,

M
 

Thank you... but it's enough for a newbie like me.

Yes there is a lot of sources to check sentiment, but the great thing would be to be alerted when a change is happening... not when we look at it... it could be too late.
Member Since May 15, 2013   11 posts
Dec 09, 2013 at 07:27
hello crazytrader.

possible it is.

the first thing that you might want to do is to get logged in, using somethng like this:

https://www.myfxbook.com/api/[email protected]&password=letsboogie&debug=1

the above link will return a session id which will be required to use most of the other api functions..


1) use the login.json link(above) to acquire your session ID.

2) replace the following session id with your session id, the open said link.

https://www.myfxbook.com/api/get-community-outlook.json?session=DSL07vu14QxHWErTIAFrH40&debug=1

note: you may leave the debug=1 option enabled, your choice, it simplifies the output that is returned/displayed.


for details:
https://myfxbook.com/api


Member Since Nov 21, 2011   1718 posts
Dec 09, 2013 at 13:58
Thank you for helping but where should I login that way as I want to create an indicator for MT4?
Member Since May 15, 2013   11 posts
Dec 10, 2013 at 16:15
ok, fine, lets take this a bit more slowly.

first, manually replace the email and password in this following link and then just pull up that link in your favorite web browser and then make a note of your session id that is returned to you.

https://www.myfxbook.com/api/[email protected]&password=letsboogie&debug=1

then, once you are in possession of said session id, insert it into this link and open it using your browser.

https://www.myfxbook.com/api/get-community-outlook.json?session=DSL07vu14QxHWErTIAFrH40&debug=1

note: as clumsy of a process as all of that might seem, i understand that this is what computers do very well, they automate the processing of clumsy tasks.

this process of logging in(obtain session id) and then accessing the community outlook information could be automated using metatrader's built in programming language, or it could also be written as a php web application which could become your own personal view of the metatrader system.


Member Since May 15, 2013   11 posts
Dec 10, 2013 at 16:15
edit: which could become your own personal view of the MYFXBOOK OUTLOOK system ..
Member Since Nov 21, 2011   1718 posts
Dec 10, 2013 at 16:46
slam_dunk posted:
edit: which could become your own personal view of the MYFXBOOK OUTLOOK system ..
I really appreciate your help man.

This is what I got when I put my ID and password into that link:

https://www.myfxbook.com/api/login.json?email=My_email.com&password=My_password&debug=1

{
 'error': false,
 'message': '',
 'session': 'rrYclnohNMGV7MCw9xAc54230'
}
Member Since May 15, 2013   11 posts
Dec 10, 2013 at 21:24
it seems that i have misplaced my login for the email that i used to register here at myfxbook, so i have not actually tried to run that link with a valid account email and password... ( i also misplaced my myfxbook password)

so i dont actually know if what we are doing with that link is correct or not...

i have perhaps incorrectly assumed that it would work as expected..

perhaps i should reregister another account here at myfxbook and then i can test this link more.


Member Since Nov 21, 2011   1718 posts
Dec 10, 2013 at 22:22
Let me know... : )
Member Since May 15, 2013   11 posts
Dec 11, 2013 at 11:20
my suggestion to you is that you might consider writing to the development team at myfxbook.

simply inform them that you are having difficulty getting that link to work properly.

prior to your actually contacting them, i woud suggest that you make an effort to resolve/debug the problem yourself.

might i suggest fiddling with/removing the debug parameter?

are you using the email address/password that you use to login to this myfxbook website?

fyi, developers tech support teams will be much less likely to respond to your s.o.s. if you have made no effort on your part to solve the problem on your own first.

btw, i suspect that you could probably find a ton of people at the jobs board at mql4.com that could do this for a very reasonable amount.

Member Since Nov 21, 2011   1718 posts
Dec 11, 2013 at 11:53
slam_dunk posted:

are you using the email address/password that you use to login to this myfxbook website?


Yes I do.

'btw, i suspect that you could probably find a ton of people at the jobs board at mql4.com that could do this for a very reasonable amount.'

I was thinking about that as well because I don't even know what's an API lol.

Thank you for your help one more time.

pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 20, 2013 at 08:55
elance is way too impersonal of a way to hire digital people, especially when it comes to producing a profitable trading bot..

i visited elance a few times and the programmers seemed to be entry level and all seemed to be eager to get things done for a song.

to hire a programmer for this trading systems work, there would need to be a bit more intimacy for my taste..

go ahead and hire one of those elance people and i bet that you will not have a truly workable product.

i would probably prefer placing an ad on craigslist instead of via elance.

i would be willing to bet that not one single trading programming job from elance ever produced any profit at all.

feel free to prove me wrong if you like.



pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 22, 2013 at 13:00
change the userid and password values at the top of this file.

load it up in your browser.

done.

[code]


<script>

userid='[email protected]';
password='mysecretpassword';

document.write('<plaintext>\n');

main();




function main()
{

mysession=getsession();

if(mysession=='')
{
document.write('oops, session not established.\n\n');
return(0);
}//if

document.write('session established.\n');
document.write('my session id is..'+mysession);
document.write('\n\n');


getoutlook(mysession);

return(0);
}//end of main function



function getoutlook(session)
{

 if (window.XMLHttpRequest)
   {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
   }
 else
   {// code for IE6, IE5
   xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
   }

url='https://www.myfxbook.com/api/get-community-outlook.xml?session='+session


xmlhttp.open('GET',url,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;




var general=xmlDoc.getElementsByTagName('general');
demoAccountsPercentage=general[0].getElementsByTagName('demoAccountsPercentage')[0].childNodes[0].nodeValue;
document.write('demoAccountsPercentage='+demoAccountsPercentage+'\n');

realAccountsPercentage=general[0].getElementsByTagName('realAccountsPercentage')[0].childNodes[0].nodeValue;
document.write('realAccountsPercentage='+realAccountsPercentage+'\n');

profitablePercentage=general[0].getElementsByTagName('profitablePercentage')[0].childNodes[0].nodeValue;
document.write('profitablePercentage='+profitablePercentage+'\n');

nonProfitablePercentage=general[0].getElementsByTagName('nonProfitablePercentage')[0].childNodes[0].nodeValue;
document.write('nonProfitablePercentage='+nonProfitablePercentage+'\n');

fundsWon=general[0].getElementsByTagName('fundsWon')[0].childNodes[0].nodeValue;
document.write('fundsWon='+fundsWon+'\n');

fundsLost=general[0].getElementsByTagName('fundsLost')[0].childNodes[0].nodeValue;
document.write('fundsLost='+fundsLost+'\n');

averageDeposit=general[0].getElementsByTagName('averageDeposit')[0].childNodes[0].nodeValue;
document.write('averageDeposit='+averageDeposit+'\n');

averageAccountLoss=general[0].getElementsByTagName('averageAccountLoss')[0].childNodes[0].nodeValue;
document.write('averageAccountLoss='+averageAccountLoss+'\n');

totalFunds=general[0].getElementsByTagName('totalFunds')[0].childNodes[0].nodeValue;
document.write('totalFunds='+totalFunds+'\n');




                  
document.write('\n');
var symbols=xmlDoc.getElementsByTagName('symbol');

for(i=0;i<symbols.length;i++)
{
name=symbols[i].getElementsByTagName('name')[0].childNodes[0].nodeValue;
document.write('symbolname='+name+'\n');

shortPercentage=symbols[i].getElementsByTagName('shortPercentage')[0].childNodes[0].nodeValue;
document.write('shortpercentage='+shortPercentage+'\n');

longPercentage=symbols[i].getElementsByTagName('longPercentage')[0].childNodes[0].nodeValue;
document.write('longpercentage='+longPercentage+'\n');

shortVolume=symbols[i].getElementsByTagName('shortVolume')[0].childNodes[0].nodeValue;
document.write('shortVolume='+shortVolume+'\n');

longVolume=symbols[i].getElementsByTagName('longVolume')[0].childNodes[0].nodeValue;
document.write('longVolume='+longVolume+'\n');

longPositions=symbols[i].getElementsByTagName('longPositions')[0].childNodes[0].nodeValue;
document.write('longPositions='+longPositions+'\n');

shortPositions=symbols[i].getElementsByTagName('shortPositions')[0].childNodes[0].nodeValue;
document.write('shortPositions='+shortPositions+'\n');

totalPositions=symbols[i].getElementsByTagName('totalPositions')[0].childNodes[0].nodeValue;
document.write('totalPositions='+totalPositions+'\n');

avgShortPrice=symbols[i].getElementsByTagName('avgShortPrice')[0].childNodes[0].nodeValue;
document.write('avgShortPrice='+avgShortPrice+'\n');

avgLongPrice=symbols[i].getElementsByTagName('avgLongPrice')[0].childNodes[0].nodeValue;
document.write('avgLongPrice='+avgLongPrice+'\n');



document.write('\n\n');

}//for





document.write('-----------------------------------\n');
document.write('-----------------------------------\n');
document.write('-----------------------------------\n');
  //document.write(syms);

document.write (xmlhttp.responseText);

}//end getoutlook function

function getsession()
{

 if (window.XMLHttpRequest)
   {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
   }
 else
   {// code for IE6, IE5
   xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
   }

url='https://www.myfxbook.com/api/login.xml?email='+userid+'&password='+password

xmlhttp.open('GET',url,false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;


document.write(xmlhttp.responseText);


response=xmlDoc.getElementsByTagName('response');

if(response[0].getAttribute('error')=='true')
{
document.write('ERROR='+response[0].getAttribute('message')+'\n\n');
return('');
}//if

session=xmlDoc.getElementsByTagName('session')[0].childNodes[0].nodeValue;
document.write('SESSION VARIABLE='+session+'\n');

return(session);
}//end getsession function


</script>
 
</body>
</html>

[/code]
pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 22, 2013 at 13:00
that didnt work out so well, attempting to insert said code into the above post..

so i will try to attach it to this post.

i think that this will work better.

just follow the instrutions in the above post to edit the userid and password in the file and then load it up in your browser.

pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 22, 2013 at 13:05
warning:

do not insert this code into your public website, as it would contain your myfxbook userid and password in plain view for others to see.

javascript would not actually be my preferred language to implement an api interface to this myfxbook site.

my preference would be to use php on a linux box, hands down.

plz enjoy.

just fyi, this information is possibly useful by some traders, for any of several reasons, this api gives us the ability to constantly monitor these values and then we can do whatever we want with said values... ie, we could issue cell phone or email alerts based upon some triggered conditions...

yo.
pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 22, 2013 at 13:05
or, these values could actually be usable by a trading bot?

i dont know.

but now you know how to access said values using the myfxbook api.

ok, i will be quiet now.

Member Since Nov 21, 2011   1718 posts
Dec 22, 2013 at 13:55
Hi

Thank you for your posts @pumpingmonkey

I have edited the file with UltraEdit and changed ID and password.

Then I tried to launch it on Firefox and Chrome... but I only get this:

Tool bar:
file:///C:/Documents%20and%20Settings/...../Bureau/FXCM/my_z2.htm

Content:
</body> </html>
pumpingmonkey
forex_trader_168526
Member Since Dec 19, 2013   126 posts
Dec 23, 2013 at 08:57
i do the following:

i am using windows 7.
i right click on the attachment above(my_z2.htm)

i then SAVE TARGET AS to a subdirectory on my C drive.

now i open said file using EDIT from the dos command prompt.

edit the USERID AND PASSWORD variables to your myfxbook login info.

from the dos command prompt, type my_z2.htm

your output from this javascript file will produce something like this:


SESSION VARIABLE=rYP4f0zVy44UGnLr0HH2168526
session established.
my session id is..rYP4f0zVy44UGnLr0HH2168526

demoAccountsPercentage=41
realAccountsPercentage=58
profitablePercentage=45
nonProfitablePercentage=54
fundsWon=109,978,674.67
fundsLost=-81,078,593.17
averageDeposit=16,472.24
averageAccountLoss=-5,551.05
totalFunds=240,593,481.55

symbolname=EURUSD
shortpercentage=72
longpercentage=27
shortVolume=3814.32
longVolume=1476.04
longPositions=6611
shortPositions=11407
totalPositions=5290
avgShortPrice=1.3517
avgLongPrice=1.3701


symbolname=GBPUSD
shortpercentage=65
longpercentage=34
shortVolume=1903.76
longVolume=987.25
longPositions=3691
shortPositions=6544
totalPositions=2891
avgShortPrice=1.6006
avgLongPrice=1.6334


symbolname=USDJPY
shortpercentage=69
longpercentage=30
shortVolume=834.13
longVolume=367.62
longPositions=1889
shortPositions=3277
totalPositions=1201
avgShortPrice=100.6684
avgLongPrice=103.7853


symbolname=GBPJPY
shortpercentage=72
longpercentage=27
shortVolume=346.06
longVolume=129.39
longPositions=628
shortPositions=1466
totalPositions=475
avgShortPrice=161.2273
avgLongPrice=168.2439


symbolname=USDCAD
shortpercentage=56
longpercentage=43
shortVolume=492.78
longVolume=386.4
longPositions=1315
shortPositions=1912
totalPositions=879
avgShortPrice=1.0505
avgLongPrice=1.0669


symbolname=EURAUD
shortpercentage=65
longpercentage=34
Member Since Nov 21, 2011   1718 posts
Dec 23, 2013 at 09:35
I use Windows XP

I have to manually edit from ultraedit the file because I don't know how to edit the file from the DOS command.

I type my_z2.thm... it lauched a new tab on my navigator but with the same result : (
Sign In / Sign Up to comment
You must be connected to Myfxbook in order to leave a comment
*Commercial use and spam will not be tolerated, and may result in account termination.
Tip: Posting an image/youtube url will automatically embed it in your post!
Tip: Type the @ sign to auto complete a username participating in this discussion.