OPEN-SOURCE SCRIPT

(IK) Stoch-60-15

업데이트됨
This strategy uses 60 minute and 15 minute stochastic data to determine entry and exit; it only executes long trades. I've only used this on BTC/USD, but I imagine the concepts employed should hold for any ticker

The script builds a simple Stochastic indicator for the current timeframe, and it also plots a single stochastic line for a higher resolution time frame. I've found good results trading on 15 minutes with a 60 minute higher resolution.

We enter a trade if the higher resolution stochastic is in an uptrend, if the current resolution stochastic is in an uptrend, and if the current stochastic value is less than 50.

We exit a trade when the current stochastic value crosses below 80 or the trailing stop loss is hit.

Stop loss is calculated with the input value, Stop Loss Percent. This value represents the percent of capital you're willing to lose before exiting a trade. A stop loss percent of 0.050 means your trade will exit if it falls 5% from the highest high since entering a trade. You will have at least 95% of your original capital left. There is no option to change a trailing stop loss to a set stop loss (in order to keep the code as simple as possible), however, you can turn it off by setting Stop Loss Percent to 1.

I tried to keep the script itself lightweight and very easy to understand, so it's not very customizable in regards to input options. You can change stochastic data, as well as the trailing stop percentage. The script can be adjusted to other timeframes, however this requires a small change in the code (details in script comments). Changing just the "Higher Resolution" input will not produce expected results

My hope is that by keeping it lightweight and simple, it will be easier for you to adjust to your specific needs, or work into a larger strategy.
릴리즈 노트
Update!

So, my original script had a slight repainting bug that caused it to suffer from hindsight bias. This was great for my backtest results, but not so much for real life. Due to the way I got data from the hourly timeframe, it was possible that a trade that was invalid in realtime could be retrospectively validated. This caused trades to show up on my chart without corresponding alerts.

Unfortunately, fixing this bug really cut into my backtest profitability (no surprise there), so I've given the whole script a bit of a revamp. Unlike last time, the code isn't as 'simple', and I would recommend only using it on a 15min chart with a 60min higher resolution. I've in fact taken out the input setting to change the higher resolution. But I've added other input settings!

You can now customize the stochastic buy and sell thresholds. Trades will enter only if Stochastic %D is below the buy threshold, and trades will exit when stochastic %D crosses under the sell threshold.

You can now choose whether stop loss is trailing or dynamic. I've also flipped the calculation, so a 0.05 stopPercent means that trades will exit if price falls 5% (in my original script, price would need to fall 95% with a value of 0.05)

I've added take profit functionality. Trades will exit, regardless of stochastic data, if prices rises by this percentage. Set this value to 1.0 to effectively turn it off. No trailing option for this, but perhaps in a future update.

This strategy only goes long, and takes into account a 0.1% commission. We enter a trade if a small uptrend is determined in current stochastic data, as well as higher res stochastic data, and if current stochastic %D is below a 'buy threshold'. We exit on three conditions: stop loss, take profit, or current stochastic %D crosses under a 'sell threshold'

I've configured default settings to work well with major crypto, but particularly ETH. I've found that a longer stochastic length as well as a higher D works fairly well across the board, but play around with the input settings for your own personal use. This script is specifically for a 15 minute timeframe. I would not recommend using it on other timeframes without editing the code.
릴리즈 노트
small bug fix in the trailing stop calculation
BTCcryptocryptotradingLONGmtfmulti-timeframeOscillatorstrailingstopTrend Analysis

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?


또한 다음에서도:

면책사항