Pages:
Author

Topic: Chrome Browser extension: MtGox trading bot - page 22. (Read 72509 times)

legendary
Activity: 2053
Merit: 1356
aka tonikt
piotr_n, Can you give me some pointers on how to change the history used to initiate the percentage difference for either buying/selling so that it doesnt wait 2ticks(2hrs) but calculates the ticks used over a shorter period of time ie. if you can point me to where in the source I would need to adjust the tick duration.
Look for 3600 in the html files - 3600 represents 1 hour.
Then replace the string with 1800 for 30min, 900 for 15min and so on...

Basicly I want to focus on buying/selling as soon as the ema10 move above or below the ema21 and not delay it for an extra hour or 2 waiting on a new tick update. If I recall correctly goombla strictly mentioned that as soon as it cross is the correct time to trade(buy/sell) and delaying it wasnt part of the strategy.
if you want the first tick to trigger a trade, replace this fragment (in background.html):

Code:
	if (dif>MinThreshold) {
chrome.browserAction.setBadgeBackgroundColor({color:[0, 128, 0, 200]})
if (USD>=0.01) {
if (getemadif(H1.length-2) > MinThreshold) {
console.log("BUY!!!")
mtgoxpost("buyBTC.php", ['Currency=USD','amount=1000'], one, onl)
}
} else {
//console.log("No USD to exec up-trend")
}
} else if (dif<-MinThreshold) {
chrome.browserAction.setBadgeBackgroundColor({color:[128, 0, 0, 200]})
if (BTC>=0.001) {
if (getemadif(H1.length-2) < -MinThreshold) {
console.log("SELL!!!")
mtgoxpost("sellBTC.php", ['Currency=USD','amount=1000'], one, onl)
}
} else {
//console.log("No BTC to exec down-trend")
}
} else {
if (dif>0) {
chrome.browserAction.setBadgeBackgroundColor({color:[10, 100, 10, 100]})
} else {
chrome.browserAction.setBadgeBackgroundColor({color:[100, 10, 10, 100]})
}
}

... with this:

Code:
	if (dif>MinThreshold) {
chrome.browserAction.setBadgeBackgroundColor({color:[0, 128, 0, 200]})
if (USD>=0.01) {
console.log("BUY!!!")
mtgoxpost("buyBTC.php", ['Currency=USD','amount=1000'], one, onl)
} else {
//console.log("No USD to exec up-trend")
}
} else if (dif<-MinThreshold) {
chrome.browserAction.setBadgeBackgroundColor({color:[128, 0, 0, 200]})
if (BTC>=0.001) {
console.log("SELL!!!")
mtgoxpost("sellBTC.php", ['Currency=USD','amount=1000'], one, onl)
} else {
//console.log("No BTC to exec down-trend")
}
} else {
if (dif>0) {
chrome.browserAction.setBadgeBackgroundColor({color:[10, 100, 10, 100]})
} else {
chrome.browserAction.setBadgeBackgroundColor({color:[100, 10, 10, 100]})
}
}
hero member
Activity: 504
Merit: 502
piotr_n, Can you give me some pointers on how to change the history used to initiate the percentage difference for either buying/selling so that it doesnt wait 2ticks(2hrs) but calculates the ticks used over a shorter period of time ie. if you can point me to where in the source I would need to adjust the tick duration.

Basicly I want to focus on buying/selling as soon as the ema10 move above or below the ema21 and not delay it for an extra hour or 2 waiting on a new tick update. If I recall correctly goombla strictly mentioned that as soon as it cross is the correct time to trade(buy/sell) and delaying it wasnt part of the strategy.
legendary
Activity: 2053
Merit: 1356
aka tonikt
I have tried setting MaxHoursBack and MaxHoursToKeep >200 but still quite different to what Im seeing on bitcoin charts or siera for some reason
Learn how to calculate EMA by yourself, it's basic math, not a rocket science.
Then you will know why the numbers are slightly different.

As I had said, it's mostly about the time window - how many historical candles you process before reaching the final one.
But its not the only factor which can affect the actual number.
I.e. almost all of the charts use the close price, while the extension uses the open price of each hour...

In any case, don't expect that making your EMA a bit more precise would cause the strategy to earn you more money. It doesn't work like that.
If you want to earn more with the strategy you should focus on optimizing the LONG/SHORT/TRESHOLD prams, instead of getting too pedantic with the EMA algorithm.
hero member
Activity: 514
Merit: 500
 I have tried setting MaxHoursBack and MaxHoursToKeep >200 but still quite different to what Im seeing on bitcoin charts or siera for some reason
legendary
Activity: 1372
Merit: 1003
a) if you were to make this an android app, i'd buy it.
b) please remove restrictions as for the EMA numbers (i like to use 100/200, for example)
c) please remove restrictions as for the interval used (lowest: 5minutes, highest 1d, maybe)?
d) please make use of VWAP optionally instead of first price
e) for the android app, please add graphic chart widget


I can't code for the life of me. But if someone were to, I'd buy it.

+1

Maybe it's just me being dyslexic but I get the feeling EMA 10, EMA 21 should be inverted to EMA 21, EMA 10 so the bot buy's BTC at <-0.25% and sells BTC at >+0.25%  Huh

The implementation of the referenced, original trend-following trading strategy is correct. The implemented strategy will not preserve you from loosing money, it's even more likely that you will loose on much more trades than you will win! And of course there is absolutely no guarantee! Using this bot is risky. If you think it's better to trade with inverted EMA's do it, no-one knows in which direction the trend will go.

I would suggest to keep this thread clean from discussions about trading strategies and focus on the technical implementation. There are a lot of other and better threads to discuss the different trading strategies.

Yeah but you can't change the settings to EMA 21, EMA 10 to the bot it won't let you  Huh
sr. member
Activity: 360
Merit: 250
a) if you were to make this an android app, i'd buy it.
b) please remove restrictions as for the EMA numbers (i like to use 100/200, for example)
c) please remove restrictions as for the interval used (lowest: 5minutes, highest 1d, maybe)?
d) please make use of VWAP optionally instead of first price
e) for the android app, please add graphic chart widget


I can't code for the life of me. But if someone were to, I'd buy it.

+1

Maybe it's just me being dyslexic but I get the feeling EMA 10, EMA 21 should be inverted to EMA 21, EMA 10 so the bot buy's BTC at <-0.25% and sells BTC at >+0.25%  Huh

The implementation of the referenced, original trend-following trading strategy is correct. The implemented strategy will not preserve you from loosing money, it's even more likely that you will loose on much more trades than you will win! And of course there is absolutely no guarantee! Using this bot is risky. If you think it's better to trade with inverted EMA's do it, no-one knows in which direction the trend will go.

I would suggest to keep this thread clean from discussions about trading strategies and focus on the technical implementation. There are a lot of other and better threads to discuss the different trading strategies.
legendary
Activity: 1372
Merit: 1003
a) if you were to make this an android app, i'd buy it.
b) please remove restrictions as for the EMA numbers (i like to use 100/200, for example)
c) please remove restrictions as for the interval used (lowest: 5minutes, highest 1d, maybe)?
d) please make use of VWAP optionally instead of first price
e) for the android app, please add graphic chart widget


I can't code for the life of me. But if someone were to, I'd buy it.

+1

Maybe it's just me being dyslexic but I get the feeling EMA 10, EMA 21 should be inverted to EMA 21, EMA 10 so the bot buy's BTC at <-0.25% and sells BTC at >+0.25%  Huh
legendary
Activity: 2058
Merit: 1005
this space intentionally left blank
a) if you were to make this an android app, i'd buy it.
b) please remove restrictions as for the EMA numbers (i like to use 100/200, for example)
c) please remove restrictions as for the interval used (lowest: 5minutes, highest 1d, maybe)?
d) please make use of VWAP optionally instead of first price
e) for the android app, please add graphic chart widget


I can't code for the life of me. But if someone were to, I'd buy it.
sr. member
Activity: 360
Merit: 250
There were already some discussions why the ema difference has to be 2 ticks in a row over/under the defined threshold to trigger a trade.
From looking into the sourcecode I can confirm that behavior. I also don't know why it is there, because I can not remember from the original trading strategy post, that you should wait 2 ticks.
You could change it easily by exchanging  numbers in the buying/selling decisions.  

However, it would be nice to know if this was just a mistake or if the history shows that this is a good extension of the original trading strategy.
So is the 2 tick delay an advice  of the OP? Would love to read about it.
sr. member
Activity: 360
Merit: 250
Today I found some time to look into the code in more detail. I've never done anything with javascript before, so it's not so easy for me to understand everything right away just by looking on it.
However, the code looks very elegant and clean to me, which helped me a lot to understand it, or at least a lot of it. Thanks again piotr_n!

In one of my previous posts I wrote about having bigger trouble with 'floating' historical bot results after a reload of the bot. The bot results were also not or only badly matching to the results of bitcoincharts.com
Also the hint from piotr_n, to set MaxHoursBack=MaxHoursToKeep didn't fix my issues.

I found the problem and now the bot results matching very well with results from other tools. The issue was a mix of different problems.
One was the difference between MaxHoursBack and MaxHoursToKeep.
Then I'm trading with longer EMA's then the default ones (10/21 ticks) and therefore seeing the issue more intensive then users with shorter EMA's.
Finally I had to calculate the EMA over a longer timeframe.

The calculation of the emas in updateEMA() looks correct to me.
But I don't think that the default values are suitable to do a correct EMA calculation. I'm not a math-expert, but did some wiki-research and testing.
What I've found out is the following:
If you want to do a EMA calculation for n-ticks, you have to do the EMA calculation over at least 5*n ticks to get correct values. My tests have shown that the results (3 decimal places) are already nearly exact with a calculation over 4*n ticks. If you only do the calculation over 2*n ticks the results are quite far away from the correct values. With the default settings (EMA's 10/21, MaxHoursBack=48) you do the EMA calculation over ~2.28*n ticks witch is only a roughly approximation of the correct EMA values.  
Longer time-frames then 5*n ticks will not change the result (3 decimal places) anymore and are therefore unnecessary for this tool.

I'm now working with  MaxHoursBack and MaxHoursToKeep >200 ticks and I'm happy to get always the same results and they are also matching with other tools.
legendary
Activity: 1372
Merit: 1003
With the default settings you should be holding USD at the moment.

Thanks think I'll stick with the defaults while I'm still learning.
legendary
Activity: 1372
Merit: 1003
Let me see if I understand the bot now.  At the moment I have USD when two ticks of either +0.25% or -0.25% then the USD will be sold for BTC? Or is it just two +0.25% ticks to buy BTC and two -0.25% ticks to sell BTC?  Am I in the right postion to be holding USD now or should I be holding BTC or doesn't it matter.  Sorry if that sounds n00bish  Huh

Let's assume you set your threshold to 0.25%.
If you have USD in your mtgox account and your ema difference is going over +(your_threshold_value) which is > +0.25%, the bot will buy BTCs for your USDs.
If you have BTC in your mtgox account and your ema difference is going below -(your_threshold_value) which is < -0.25%, the bot will buy USDs for your BTCs.

So you have a BUY/SELL hysteresis of 2*your_threshold_value of your current ema difference.



Thanks  Wink
legendary
Activity: 2053
Merit: 1356
aka tonikt
With the default settings you should be holding USD at the moment.
sr. member
Activity: 360
Merit: 250
Let me see if I understand the bot now.  At the moment I have USD when two ticks of either +0.25% or -0.25% then the USD will be sold for BTC? Or is it just two +0.25% ticks to buy BTC and two -0.25% ticks to sell BTC?  Am I in the right postion to be holding USD now or should I be holding BTC or doesn't it matter.  Sorry if that sounds n00bish  Huh

Let's assume you set your threshold to 0.25%.
If you have USD in your mtgox account and your ema difference is over +(your_threshold_value) which is > +0.25%, the bot will buy BTCs for your USDs.
If you have BTC in your mtgox account and your ema difference is below -(your_threshold_value) which is < -0.25%, the bot will buy USDs for your BTCs.

So you have a BUY/SELL hysteresis of 2*your_threshold_value of your current ema difference.

legendary
Activity: 1372
Merit: 1003
Let me see if I understand the bot now.  At the moment I have USD when two ticks of either +0.25% or -0.25% then the USD will be sold for BTC? Or is it just two +0.25% ticks to buy BTC and two -0.25% ticks to sell BTC?  Am I in the right postion to be holding USD now or should I be holding BTC or doesn't it matter.  Sorry if that sounds n00bish  Huh
legendary
Activity: 2053
Merit: 1356
aka tonikt
Hi does the newest H1.length-MaxHoursToKeep modification in the refreshEMA function fix the trouble with the 'floating' historical results?
Thanks for the update!
No. It was just a fix for a potential issue with expiring old records, if the PC was offline for 2 hours or more..
sr. member
Activity: 360
Merit: 250
Hi does the newest H1.length-MaxHoursToKeep modification in the refreshEMA function fix the trouble with the 'floating' historical results?

Thanks for the update!
sr. member
Activity: 360
Merit: 250

Then extract all the source files to a separate folder,

How did you do this?

Wait -- spoke too soon.  I actually do need some clarity on this if you would please:  Please explain how you extract the source files?  I only see "pack extension" and "load unpacked extension"...   Huh
As I said, it is a zip archive - unpack it with any un-zipper. Not with Chrome.

I just don't see where you obtain the .zip archive -- I am likely just overlooking something very simple...

https://bitcointalksearch.org/topic/m.786714

OH cool, thanks...  Cheesy
I had just found this, too:
"The first step is downloading the extension’s CRX file. Instead of clicking it’s link, which will lead to that extension being installed on your browser, right-click the link and choose “Save link as…”."
from http://orenyomtov.com/how-to-view-a-google-chrome-extensions-full-source-code.html

LOL, a durrr!!!  ::: facepalm :::

I just want to preface this post by saying, I feel like a world-class idiot spamming up this thread with my n00bness...
Anyway... the above method doesn't work Huh  Maybe it's fixed in the newest version of Chrome so that right clicking and choosing "save link as..." doesn't give the .crx file anymore???  Anyway, I'll just follow the link above and get the source that way but... If anyone wants to take the time to really dumb this process of retrieving Chrome Extension source code down for me, I'd pay 0.5 BTC...

Isn't this link working for you?
http://speedy.sh/z2eTZ/mtbot.zip

However, I also didn't use it. I will try to describe you a way to get the source.
Did you already sucessfuly install the bot as a chrome-extention?  If not please do it.
If you installed it already you have already done nearly everything, because the source is already on your computer. You just have to know where.
The location on your computer varies and depends on your setup (OS etc.). I'm using Linux (ubuntu) and the extensions are in your home directory below this path.
~/.config/google-chrome/Default/Extensions/

If you don't know where your google-chrome directory is located on your computer, simply use the file-search function of your OS to look for one of the included filenames like sha512.js
In the found directory is everything you need. You can modify. To run the modified Version you just have to reload the extension.

legendary
Activity: 1372
Merit: 1003
Right I loaded 1BTC on the bot 24hrs ago it finally sold the 1BTC after two dark red boxes and now I have $4.83 but if it sold last night it could of got $5.015  I don't understand the bot maybe I'll have to read Goomboo's Journal  Huh
Well, all I can say is that you should have sold it last night, instead of using the bot Smiley

Well the bot sold the 1BTC at BTC lowest value in the last 25Hrs  Huh

Looking at charts and understanding the bot better I can totally see why it sold then.  Thanks for the bot  Smiley  I will totally be donating most of any profits generated to Goomboo and piotr_n for helping me learn about trading and bots.  Thanks.
legendary
Activity: 1372
Merit: 1003
Sorry if this sounds n00bish but how far back doest the period of the EMA take for its value in the bot  Huh

10 and 21 days  if you use EMA 10 EMA 21  Huh

Yes it is I think again sorry for spamming and general N00bnes concerning this thread but really interested in the bot and learning about trading using it with 1BTC
Pages:
Jump to: