Thanks for your SL / TS strategy.
But I think it will fail when doing this
BTCUSD price is 100
You set SL to 90 and run goxtool
Price falls to 89 so your strategy will sell 0.01
you reboot your computer (I reboot my Raspberry daily)
Price is still 89
goxtool automatically start (this will be my default settings)
You will sell again 0.01 !!!
I think you should store data in a file !
The problem is with flag self.already_executed
it shouldn't be in your strategy code... but in a file (ini, json, yaml...)
when initializing strategy if already_executed is true, send a debug
message to warm user that SL is disable.
I did something similar with Metatrader 4 (using MQL code)
it was a Stop Loss / Trailing Stop / Take Profit on trader side (stealth SL).
I wasn't using a file to store data but "global variables"
http://docs.mql4.com/globalssee for a Metatrader EA for Stealth SL
http://iticsoftware.com/expert-advisor-virtual-stoploss(it's quite similar to mine but they are storing data, neither in a file,
neither a "global variable" (in MQL4 term) but on a textbox on chart
and a critism of this concept
http://www.onestepremoved.com/stealth-stop-and-take-profit/I also have a little comment about "BTC" string...
maybe it could be a good idea to hide this.
gox.cur1 instead will be better as MtGox was supposed to also support LTC.
I will also replace gox.currency by gox.cur2
an other comment about "1E8"
In my mind this kind of constant should be in the strategy...
8 is number of digits of symbol BTCUSD or BTCEUR
moreover according to
https://en.bitcoin.it/wiki/Proper_Money_Handling_(JSON-RPC)
I also wont if int(STOP_VOLUME * 1e8) shouldn't be replaced by
long(round(STOP_VOLUME * 1e8))