High Low Cloud Strategy BacktestingHigh Low Cloud Strategy Backtesting: this is a breakout and reversal previous trend strategy
A. Indicator: row 6 to row 17
1. Fast Cloud
Upper line = ema of High with 60 periods
Lower line = ema of Low with 60 periods
1. Slow Cloud
Upper line = ema of High with 240 periods
Lower line = ema of Low with 240 periods
B. Strategy Backtesting
1. Chart IDC, Time frame: M30
2. Long condition: row 20 to row 34
a. Entry =
* Upper line of Fast Cloud below Lower line of Slow Cloud
* Price crossover Upper line of Slow Cloud
b. Stoploss =
* Price crossunder bottom of 240 periods (~ bottom of 5 days)
c. Takeprofit =
* Lower line of Fast Cloud above Upper line of Slow Cloud
* Price crossunder Lower line of Fast Cloud
3. Short condition: row 37 to row 49
a. Entry =
* Lower line of Fast Cloud above Upper line of Slow Cloud
* Price crossunder Lower line of Slow Cloud
b. Stoploss =
* Price crossover peak of 240 periods (~ bottom of 5 days)
c. Takeprofit =
* Upper line of Fast Cloud below Lower line of Slow Cloud
* Price crossover Upper line of Fast Cloud
Moving Averages
Slow Heiken Ashi and Exponential Moving average Strategy 2.2Strategy using Slow Heiken Ashi by Glaz and Exponential moving averages. Looking for someone to help me turn the strategy into non-reoccuring alerts as I am having trouble doing so.
[fikira] Fibma/Fibema StrategyMy strategy regarding the Fibma/Fibema lines (also see my Fibma/Fibema study)
You can enable/disable each strategy to see what
works best in what timeframe
Thanks!
MACD_RSI strategyUse three indicator to entry a position
EMA (20), MACD (12, 26, 20), RSI (14)
apply ema20 on rsi as signal line
Entry long when
price above EMA20, MACD above signal line and RSI above signal line
Entry short when
price below EMA20, MACD below signal line and RSI below signal line
Study only, use it under your own risk.
EASYMOKU INDICATORThis is the popular Ichimoku Indicator with an easier way to adjust the settings that can help you in your trading.
Components of the Ichimoku indicator:
Tenkan Sen: Basically it is a moving average that goes from 7 to 9 periods.
Kijun Sen: Like Tenkan Sen, we are facing a moving average, but this time from 22 to 26 periods.
Chikou Span: It is the one that represents the current price, but reflected in 22 to 26 periods back.
Senkou Span A: Unlike Chikou Span, this line is drawn over the next 22 to 26 periods, and its calculation is obtained from the average between Tenkan Sen and Kijun Sen. It is a projected average in the future.
Senkou Span B: It is the result of calculating the average between the maximum and minimum over the last 44 to 52 periods, representing the following 22 to 26 periods (as well as the Senkou Span A)
As with Occidental trading systems, based on the crossings of averages, with the Ichimoku we will use the crossing of the Tenkan Sen (fast moving average) with the Kijun Sen (slow moving average) as buying and selling signals.
Strategy of this script:
A strong bullish signal is when price and Chikou Span rises above Kumo cloud and Tenkan Sen cross above Kijun Sen.
A strong bearish signal is when price and Chikou Span falls below Kumo cloud and Tenkan Sen croos under Kijun Sen.
MA 12, MA 24, RSI OB-OS, CCI by WP@SITechDeveloped by Worachart Pirunruk, MD - Siam Intelligence Technology
This is the signal that generates based on 4 Technical Analysis Tools:
1. SMA 12,
2. SMA 26,
3. RSI 14,3,3
4. CCI
Signal to Buy/Long when the RSI below Dynamic oversold line based on close price back 60 bars.
Parameter. This signal doesn't have to best TP point, I'm working on improvement, now. Btw, don't forget to calculate you Margin Level. I'll teach you guys later of how to calculate.
Have fun Trading guys, and don't forget to give back to others. Because, Giving is Receiving."
WP@SITech
sma dipsparity and sdvFXBTCJPY 1min contrarian script (2020/1/30)
1分足の逆張りです.
If you want to use other timescale, need to change disparity rate and sdv.
To display disparity(sma) and standard deviation, and to draw a hline(pine function) a certain valu. And lets think. I thought disparity rate 1~1.3 or -1~-1.3 are able to use constrarian trade (and sdv>600).
In bottom, disparity index is auxiliary. It is different from the multiple in the script to make the value easier to understand.
Sorry if the expiration date of the script has expired.
HatiKO EnvelopesPublished source code is subject to the terms of the GNU Affero General Public License v3.0
This script describes and provides backtesting functionality to internal strategy of algorithmic crypto trading software "HatiKO bot".
Suitable for backtesting any Cryptocurrency Pair on any Exchange/Platform, any Timeframe.
Core Mechanics of this strategy are based on theory of price always returning to Moving Average + Envelopes indicator (Moving_average_envelope from Wiki)
Developement of this script and trading software is inspired by:
"Essential Technical Analysis: Tools and Techniques to Spot Market Trends" by Leigh Stevens (published on 12th of April 2002)
"Moving Average Envelopes" by ChartSchool, StockCharts platform (published on 13th of April 2015 or earlier)
"Коля Колеснік" from Crypto Times channel ("Метод сетка", published on 19th of August 2018)
"3 ways to use Moving Average Envelopes" by Rich Fitton, published on Trader's Nest (published on 28st of November 2018 or earlier)
noro's "Robot WhiteBox ShiftMA" strategy v1 script, published on TradingView platform (published on 29th of August 2018)
"Moving Average Envelopes: A Popular Trading Tool" Investopedia article (published 25th of June 2019)
and KROOL1980's blogpost on Argolabs ("Гридерство или Сетка как источник прибыли на форекс", published on 27th of February 2015)
Core Features:
1) Up to 4 Envelopes in each direction (Long/Short)
2) Use any of 6 different basis MAs, optionally use different MAs for Opening and Closure
3) Use different Timeframes for MA calculation, without any repainting and lookahead bias.
4) Fixed order size, not Martingale strategy
5) Close open position earlier by using Deviation parameter
6) PineScript v4 code
Options description:
Lot - % from your initial balance to use for order size calculation
Timeframe Short - Timeframe to use for Short Opening MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Short - Type of MA to use for Short Opening MA calculation, can be chosen from dropdown list, default is SMA
Data Short - Source of Price for Short Opening MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Short - Period used for Short Opening MA calculation, should be >=1, default is 3
MA offset Short - Offset for MA value used for Short Envelopes calculation, should be >= 0, default is 0
Timeframe Long - Timeframe to use for Long Opening MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Long - Type of MA to use for Long Opening MA calculation, can be chosen from dropdown list, default is SMA
Data Long - Source of Price for Long Opening MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Long - Period used for Long Opening MA calculation, should be >=1, default is 3
MA offset Long - Offset for MA value used for Long Envelopes calculation, should be >= 0, default is 0
Mode close MA Short - Enable different MA for Short position Closure, default is "false". If false, Closure MA = Opening MA
Timeframe Short Close - Timeframe to use for Short Position Closure MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Close Short - Type of MA to use for Short Position Closure MA calculation, can be chosen from dropdown list, default is SMA
Data Short Close - Source of Price for Short Closure MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Short Close - Period used for Short Opening MA calculation, should be >=1, default is 3
Short Deviation - % to move from MA value, used to close position above or beyond MA, can be negative, default is 0
MA offset Short Close - Offset for MA value used for Short Position Closure calculation, should be >= 0, default is 0
Mode close MA Long - Enable different MA for Long position Closure, default is "false". If false, Closure MA = Opening MA
Timeframe Long Close - Timeframe to use for Long Position Closure MA calculation, can be chosen from dropdown list, default is Current Graph Timeframe
MA Type Close Long - Type of MA to use for Long Position Closure MA calculation, can be chosen from dropdown list, default is SMA
Data Long Close - Source of Price for Long Closure MA calculation, can be chosen from dropdown list, default is OHLC4
MA Length Long Close - Period used for Long Opening MA calculation, should be >=1, default is 3
Long Deviation - % to move from MA value, used to close position above or beyond MA, can be negative, default is 0
MA offset Long Close - Offset for MA value used for Long Position Closure calculation, should be >= 0, default is 0
Short Shift 1..4 - % from MA value to put Envelopes at, for Shorts numbers should be positive, the higher is number, the higher should be Shift position, example: "Shift 1 = 1, shift 2 = 2, etc."
Long Shift 1..4 - % from MA value to put Envelopes at, for Longs numbers should be negative, the lower is number, the lower should be Shift position, example: "Shift 1 = -1, shift 2 = -2, etc."
From Year 20XX - Backtesting Starting Year number, only 20xx supported as script is cryptocurrency-oriented.
To Year 20XX - Backtesting Final Year number, only 20xx supported as script is cryptocurrency-oriented.
From Month - Years starting Month, optional tweaking, changing not recommended
To Month - Years ending Month, optional tweaking, changing not recommended
From day - Months starting day, optional tweaking, changing not recommended
To day - Months ending day, optional tweaking, changing not recommended
Graph notes:
Green lines - Long Envelopes.
Red lines - Short Envelopes.
Orange line - MA for closing of Short positions.
Lime line - MA for closing of Long positions.
**************************************************************************************************************************************************************************************************************
Опубликованный исходный код регулируется Условиями Стандартной Общественной Лицензии GNU Affero v3.0
Этот скрипт описывает и предоставляет функции бектеста для внутренней стратегии алгоритмического программного обеспечения "HatiKO bot".
Подходит для тестирования любой криптовалютной пары на любой бирже/платформе, на любом таймфрейме.
Кор-механика этой стратегии основана на теории всегда возвращающейся к значению МА цены с использованием индикатора Envelopes (Moving_average_envelope from Wiki)
Разработка этого скрипта и программного обеспечения для торговли вдохновлена следующими источниками:
Книга "Essential Technical Analysis: Tools and Techniques to Spot Market Trends" Ли Стивенса (опубликовано 12 апреля 2002 года)
«Moving Average Envelopes» от ChartSchool, платформа StockCharts (опубликовано 13 апреля 2015 года или раньше)
«Коля Колеснік» с канала Crypto Times («Метод сетка», опубликовано 19 августа 2018 года)
«3 ways to use Moving Average Envelopes» Рича Фиттона, опубликованные в «Trader's Nest» (опубликовано 28 ноября 2018 года или раньше)
Скрипт стратегии noro "Robot WhiteBox ShiftMA" v1, опубликованный на платформе TradingView(опубликовано 29 августа 2018 года)
«Moving Average Envelopes: A Popular Trading Tool», статья Investopedia (опубликовано 25 июня 2019 года)
Блог KROOL1980 из Argolabs («Гридерство или Сетка как источник прибыли на форекс», опубликовано 27 февраля 2015 года)
Основные особенности:
1) До 4-х Ордеров в каждом из направлении (Лонг / Шорт)
2) Выбор из 6-ти разных базовых МА, опционально используйте разные МА для открытия и закрытия.
3) Используйте разные таймфреймы для расчета MA, без перерисовки и "эффекта стеклянного шара".
4) Фиксированный размер ордера, а не стратегия Мартингейла
5) Возможность закрытия открытой позиции заблаговременно, используя параметр Deviation
6) Код реализован на PineScript v4
Описание параметров:
Lot - % от вашего первоначального баланса, используется при расчете размера Ордера
Timeframe Short - таймфрейм, используемый для расчета МА Открытия Шорт позиций, может быть выбран из списка, по умолчанию - таймфрейм текущего графика
MA Type Short - тип MA, используемый для расчета МА Открытия Шорт позиций, может быть выбран из списка, по умолчанию SMA
Data Short - источник цены для расчета МА Открытия Шорт позиций, может быть выбран из списка, по умолчанию OHLC4
MA Length Short - период, используемый для расчета МА Открытия Шорт позиций, должен быть >= 1, по умолчанию 3
MA Offset Short - смещение значения MA, используемого для расчета Шорт Ордеров, должно быть >= 0, по умолчанию 0
Timeframe Long - таймфрейм, используемый для расчета МА Открытия Лонг позиций, может быть выбран из списка, по умолчанию - таймфрейм текущего графика
MA Type Long - тип MA, используемый для расчета МА Открытия Лонг позиций, может быть выбран из списка, по умолчанию SMA
Data Long - источник цены для расчета МА Открытия Лонг позиций, может быть выбран из списка, по умолчанию OHLC4
MA Length Long - период, используемый для расчета МА Открытия Лонг позиций, должен быть >= 1, по умолчанию 3
MA Offset Long - смещение значения MA, используемого для расчета Лонг Ордеров, должно быть >= 0, по умолчанию 0
Mode close MA Short - Включает отдельное MA для закрытия Шорт позиции, по умолчанию «false». Если false, MA Закрытия = MA Открытия
Timeframe Short Close - таймфрейм, используемый для расчета МА Закрытия Шорт позиций, может быть выбран из списка, по умолчанию - таймфрейм текущего графика
MA Type Close Short - тип MA, используемый при расчете МА Закрытия Шорт позиции. Mожно выбрать из списка, по умолчанию SMA
Data Short Close - источник цены для расчета МА Закрытия Шорт позиций, может быть выбран из списка, по умолчанию OHLC4
MA Length Short Close - период, используемый для расчета МА Закрытия Шорт позиции, должен быть >= 1, по умолчанию 3
Short Deviation - % отклонения от значения MA, используется для закрытия позиции выше или ниже рассчитанного значения MA, может быть отрицательным, по умолчанию 0
MA Offset Short Close - смещение значения MA, используемого для расчета закрытия Шорт позиции, должно быть >= 0, по умолчанию 0
Mode close MA Long - Включает разные MA для закрытия Лонг позиции, по умолчанию «false». Если false, MA Закрытия = MA Открытия
Timeframe Long Close - таймфрейм, используемый для расчета МА Закрытия Лонг позиций, может быть выбран из списка, по умолчанию - таймфрейм текущего графика
MA Type Close Long - тип MA, используемый при расчете МА Закрытия Лонг позиции. Mожно выбрать из списка, по умолчанию SMA
Data Long Close - источник цены для расчета МА Закрытия Лонг позиций, может быть выбран из списка, по умолчанию OHLC4
MA Length Long Close - период, используемый для расчета МА Закрытия Лонг позиции, должен быть >= 1, по умолчанию 3
Long Deviation -% для перехода от значения MA, используется для закрытия позиции выше или ниже рассчитанного значения MA, может быть отрицательным, по умолчанию 0
MA Offset Long Close - смещение значения MA, используемого для расчета закрытия Лонг позиции, должно быть >= 0, по умолчанию 0
Short Shift 1..4 - % от значения MA для размещения Ордеров, для Шорт Ордеров должен быть положительным, чем выше номер, тем выше должна располагаться позиция Shift, например: «Shift 1 = 1, Shift 2 = 2 и т.д. "
Long Shift 1..4 - % от значения MA для размещения Ордеров, для Лонг Ордеров должно быть отрицательным, чем ниже число, тем ниже должна располагаться позиция Shift, например: «Shift 1 = -1, Shift 2 = -2, и т.д."
From Year 20XX - Год начала тестирования, из-за ориентированности на криптовалюты поддерживаются только значения формата 20хх.
To Year 20XX - Год окончания тестирования, из-за ориентированности на криптовалюты поддерживаются только значения формата 20хх.
From Month - Начальный месяц, опционально, менять не рекомендуется
To Month - Конечный месяц, опционально, менять не рекомендуется
From day - Начальный день месяца, опционально, менять не рекомендуется
To day - Конечный день месяца, опционально, менять не рекомендуется
Пояснения к графику:
Зеленые линии - Лонг Ордера.
Красные линии - Шорт Ордера.
Оранжевая линия - MA Закрытия Шорт позиций.
Лаймовая линия - MA Закрытия Лонг позиций.
Pair Trade cryptoPair trade for crypto with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Pair TradePair trade with inputs:
* length of correlation and moving average
* trade pair
* spread threshold to enter long / short
* spread threshold to exit long / short
Long Term Long/Short Strategy (Pair Trading)Longing or shorting an asset ratio depending on long term trend.
Long term trend is defined by crossing of an asset or index and its SMA.
Input values:
* trend asset
* SMA configuration (periods, resolution)
* strategy: long only, long/short, short only
How To Set Backtest Time Ranges
Example how to set the time range window to be backtested for both entries and exits. Additional examples are also included showing how to set the date range and toggle plot visibility.
By incorporating this code with your own strategy's logic, it will allow you to backtest various time windows.
Much gratitude to @LucF and @a.tesla2018 for help with including ':1234567' for time ranges on weekends. Thank you both!
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
EMA Candle Close StrategyThis is a simple script which overlays the 200, 55, 21, 13 and 8 EMA's and suggest a buy and sell based on if the 8,13 and 21 EMA's have crossed the 55 EMA and the close is also above the 55 EMA for the candle. This is a popular strategy used and is best used on the Daily or the Hourly chart. In particular I have had success with the 'Daily' chart.
More features will be added soon with variations that can be turned off or on in the options.
By default the strategy assumes you are starting with $1000 and a commission rate of 0.26% which is the typical taker fee for crypto exchanges, but you can change this in the settings.
Strategy PyramiCoverStrategy for pyramidization and coverage. (Indicator PyramiCover)
Recommended time frame 60 min.
Adaptive Price Zone Backtest The adaptive price zone (APZ) is a volatility-based technical indicator that helps investors
identify possible market turning points, which can be especially useful in a sideways-moving
market. It was created by technical analyst Lee Leibfarth in the article “Identify the
Turning Point: Trading With An Adaptive Price Zone,” which appeared in the September 2006 issue
of the journal Technical Analysis of Stocks and Commodities.
This indicator attempts to signal significant price movements by using a set of bands based on
short-term, double-smoothed exponential moving averages that lag only slightly behind price changes.
It can help short-term investors and day traders profit in volatile markets by signaling price
reversal points, which can indicate potentially lucrative times to buy or sell. The APZ can be
implemented as part of an automated trading system and can be applied to the charts of all tradeable assets.
WARNING:
- For purpose educate only
- This script to change bars colors.
Bollinger Band BreakoutIt is a long only strategy.
1. Buy when price breaks out of the upper band.
2. Exit has two options. Option 1 allows you to exit using lower band. Option 2 allows you to exit using moving average.
3. Option 1 preferred over option 2 if the instrument is highly volatile.
4. Slippage and commissions are not considered in the return calculation.
YJ Mean ReversionMean reversion strategy, based upon the price deviation (%) from a chosen moving average (bars). Do note that the "gains" are always relative to your starting capital, so if you set a smaller starting capital (e.g. $10000) your gains will look bigger. Also when the strategy tester has finished calculating, check the "Open P/L", as there could still be open trades.
Some Tips:
- Was designed firstly to work on an index like the S&P 500 , which over time tends to go up in value.
- Avoid trading too frequently (e.g. Daily, Weekly), to avoid getting eaten by fees.
- If you change the underlying asset, or time frame, tweaking the moving average may be necessary.
- Can work with a starting capital of just $1000, optimise the settings as necessary.
- Accepts floating point values for the amount of units to purchase (e.g. Bitcoin ).
- If price of units exceeds available capital, script will cancel the buy.
- Adjusted the input parameters to be more intuitive.
Voss Strategy (Filter + Trend Indicator) [Bitduke]Created strategy based on Voss Predictive Filter, implemented by TradingView user e2e4mfck.
Voss Predictive Filter
This is a relatively new filter from John F. Ehlers’ article, “A Peek Into The Future .” Ehlers describes the calculation of a new filter that could help signal cyclical turning points in markets.
But filter has a negative group delay and while an indicator based on it cannot actually see into the future, it may provide the trader with signals in advance of other indicators.
In mentioned article he tested filter on SPY and at one point in time "it went into a trend mode in January 2019, and the cycle signal failed miserably, signaling a short position during the runup. <...> The only way to minimize the impact of this condition is to employ an additional trend detector."
Thus I've added another Ehlers' based trend based indicator Instantaneous Trendline (thanks to LazyBear for implementation) to minimize the impact of the trend mode and got a good results on XBTUSD pair 4h.
Backtest :
> Range: 2016 - 2020
> XBTUSD
> 4h
> ~20% drawdown
> Sharpe (0.361, not too impressive)
I think it can be improved with Risk Management system and experimenting with various trend following indicators.
BEST Supertrend StrategyHello traders
Sharing a sample Supertrend strategy to illustrate how to calculate a convergence and using it in a strategy
I based the setup as follow:
- Entries on Supertrend MTF breakout + moving average cross. Entering whenever there is a convergence
- exit whenever a Simple Moving Averages cross in the opposite direction happen
- possibility to filter only Longs/Shorts or both
All the best
Dave
Volatility Traders Minds Strategy (VTM Strategy)Volatility Traders Minds Strategy (VTM Strategy)
I found this startegy on internet, with a video explaingin how it works.
Conditions for entry:
1 - Candles must to be above or bellow the 48 MA (Yellow line)
2 - Candles must to break the middle of bollinger bands
3 - Macd must to be above or bellow zero level;
4 - ADX must to be above 25 level
Credits to who developed this startegy (google it).
Thanks to all pinescripters mentined in the code for their snippets.
It could be improved with stop loss based on ATR etc.
I have also a study with alerts.
Please use comment section for any feedback or contact me if you need support.