TradingView
FiatExIntl
2017年11月10日早上7點56分

MACD Strategy - No short selling - Using 5 Fast, 30 Slow & 9 MAC 看多

Ethereum / TetherBittrex

描述

//@version=3

////////// I've been playing around with a new trading script using a MACD Indicator
////////// When I run the script shows that hypothetically made over 600% in 22 months.
////////// It would have take 50,000 and turned it into $314,827 dollars..
////////// MACD Indicator is set to FastLength 5, SlowLength 30, and MACDLength 9.
////////// I find that performing a Close All strategy at the end seems to work best
////////// rather then shorting the position. I ran this on a 4hr Chart on Ethereum / USDT.
////////// Other paramaters used were Initial Capital 50000, Pyramiding Checked, 1 order,
////////// Order Size 100% of Capital, and Recalculate after Refile.
////////// I know that 100% is crazy aggresive, but it's for testing purposes - Go big or Go Home Right :)
////////// Feel free to play with it, and let me know if you find improvments .

strategy("MACD Strategy", overlay=true)

fastLength = input(5)
slowlength = input(30)
MACDLength = input(9)

MACD = ema(close, fastLength) - ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD
sell = cross(MACD, aMACD) and MACD < aMACD

if (crossover(delta, 0))
strategy.entry("MacdLE", strategy.long, comment="MacdLE")

if (crossunder(delta, 0))
strategy.close_all(when = sell)

plot(close)

評論

All trading involves high risk; past performance is not necessarily indicative of future results. Hypothetical or simulated performance results have certain inherent limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not actually been executed, the results may have under- or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown.
評論
CryptoMonkeyDev
Have tested these non-standard MACD parameters using my own software on KRAKEN ohlc, ETH/USD, 4hr candles, but it shows no benefit against default MACD parameters (12/26/9).

Last 114 days result with pure 4hr MACD (market buys/sells) was -0.1% daily, whereas passive hold would make about 0.3% daily.
If smoothed with smart limit buys/sells trials using 1hr MACD (much more complicated strategy), it made 0.79% daily with 5/30/9, but little over 1% using 12/26/9.

Its useless to count, how many percent the script did really, you need to compare results against what you would make by passive holding the currency. If script can beat passive hold, then its viable, otherwise not.

I have tested many complicated strategies, using MACD, RSI, Stochastics, combinations using OBV, Aroon and other indicators, testing them on many samples of OHLC data, I didnt yet found strategy, which would succesfully beat passive hold in long term. There are instances of timeframes, where it would work nicely, but taking big picture, simple MACD system will yield very poor results.

Dont even look, what you would make, if you simply bought ETHER 22 month ago and let it stay until now.
CryptoMonkeyDev
And i need to add up here, this is still just simulation. In reality it never works same well and results usually make huge difference because of spreads, fees etc. Always when i found some strategy which yielded positive results over passive hold over many sample data, i tested it in real trading, and those minor differences became major. Any MACD strategy will likely lose you shitload of money in any sideways market, will earn less on uptrend and usually also lose less on downtrend.
FiatExIntl
@CryptoMonkeyDev, I really need to do these test against a Cyrptocurrency that has been going sideways I would imagine.. I agree with the premise that using a indicator when the market is trending up will actually work against you in most cases, in regards to you just purchasing and holding your position.
FiatExIntl
@CryptoMonkeyDev, Totally agree with your point.. I was looking, and I too saw the difference if I was to just hold my position. I wonder how the indicators would work in a downward trending market.
FiatExIntl
@CryptoMonkeyDev, When you make the comment "If smoothed with smart limit buys/sells trials using 1hr MACD (much more complicated strategy), it made 0.79% daily with 5/30/9" Do you know that that would look like in a Pine script?
FiatExIntl
@CryptoMonkeyDev, Looking at this again, I see that I was wrong about the time period.. It was late last night when I posted this.. The 1st trade was Jan 5th of this year, and the script did out perform the buy and hold.. I also included a .05 % for commissions.. Still did well.. I haven't used it live, but I'm gong to see about using it in Gunbot if possible..

I'm still curious about your comments about applying other variables to the script, and would love to hear more..
CryptoMonkeyDev
@FiatExIntl, Hi, in january ETH was only about 10 usd, now its 3000% more, so 600% is very bad result. Also, my question is what you have used as purchase price (bid/ask/last). That makes huge impact. On buy, you should use ask and on sell, use bid price.

Regarding pinescript, i dont know how and if its possible to replicate the strategy: its based on theory that macd is way too slow, so its using 4x smaller timewindow to try to make limit orders to be on more favorable side (buy at bid price and on kraken, get half fee). It will make market order when bigger time window signal is received, but try to make limit orders before (on smaller time windows, you receive signal sooner). To avoid too many buy/sell during sideways or chpoppy market, its using only main time window. Tested using obv, stochastic and aroon as supplementary indicators but results were usually worse than pure macd (or pure RSI). On placing limit orders i used regression to predict the probable low/high.

Doing market order and limit order is biggest difference.

From many sample timewindows i tested, these strategies usually perform better on falling markets against passive hold, but since most crypto grown tremendously, this didnt count too much. The conditions is different on each market and testing one year old data may be not valid.

Maybe, kraken laggyness did cause the bad results in live trading, even in manual trading i barely made profit on kraken last 2 months, while i almost doubled my assets on cex.

Anyway, if you are interested to try more and get deeper, we can exchange contacts and do something,i would live to crack this as i believe its possible, just not easy. Most bots which you can design on public websites suck hard and you will hardly beat passive hold.
CryptoMonkeyDev
..
FiatExIntl
@CryptoMonkeyDev, I get exactly what you're saying and agree.. You'll have to forgive me I'm only been looking at investing in Cryptocurrencies for a couple of months, and very little experience in technical trading.. I'm not a developer either. So, I've been fumbling with this. I do have some very basic knowledge of programming, but I'm more of a network support person.

Interestingly emough though, I work with a Software development company with some talented programmers that have developed an interest in this since I keep talking about it at work. I tried to implement what you mentioned earlier today with an exit strategy based on a 1 hour indicator, but I think that you're right in that I don't believe that the Pine Script back testing utility is applying it how I would like..

Here is my updated script.. Oh, I'm good with trading information, I just don't know how much help I would be.. Maybe my co-workers once I get them more involved.. Here's what I did today though

//@version=3

// I've been playing around with a new trading script using a MACD Indicator
// When I run the script shows that hypothetically made over 600% in 22 months.
// It would have take 50,000 and turned it into $314,827 dollars..
// I find that performing a Close All strategy at the end seems to work best
// rather then shorting the position. I ran this on a 4hr Chart on Ethereum / USDT.
// Other paramaters used were Initial Capital 50000, Pyramiding Checked, 1 order,
// Order Size 100% of Capital, and Recalculate after Refile.
// I know that 100% is crazy aggresive, but it's for testing purposes - Go big or Go Home Right :)
// Feel free to play with it, and let me know if you find improvments .

strategy("MACD Strategy", overlay=true)

// Add the inputs
timeFrameBuy = input(title="time frame", type=resolution,
defval="240")
timeFrameSell = input(title="time frame", type=resolution,
defval="60")

fastLength = input(5)
slowlength = input(30)
MACDLength = input(9)

// Retrieve the higher time frame's data
symbolHigh = security(tickerid, timeFrameBuy, high)
symbolLow = security(tickerid, timeFrameSell, low)

MACD = ema(close, fastLength) - ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD
buy = symbolHigh and cross(MACD, aMACD) and MACD > aMACD
sell = symbolLow and cross(MACD, aMACD) and MACD < aMACD

if (crossover(delta, 0))
strategy.entry("MacdLE", strategy.long, comment="MacdLE", when=buy)

if (crossunder(delta, 0))
strategy.close_all(when = sell)

plot(close)
FiatExIntl
@FiatExIntl, disregard the comments on top..
更多