ATH Oscillator StrategyThis idea stems from the belief that people want to reverse the trend when an all time high or low is hit. This strategy incorporates that by using ath and atl values based on the lookback period and the signal gets smoothed by the input smoothing type and length. I found that the best time to use this was on the 3m chart. But I am certain that higher time frames can be used if the settings are tweaked.
Settings:
Strategy -
simple(long,short,switch) - This strategy just uses the directional change of the signal using just longs, just short, or switching between the two.
range - This strategy uses the hlines on the chart to determine when to buy and sell. These can be adjusted using the Range Top / Bot values
div - This strategy uses a simple divergence of the signal line to time entries
Lookback - How many bars back to check the ath and atl
Smoothing - How smooth you want the signal
Smoothing Type - Different ways to smooth the signal
Range Top/Bot - Changes the height of the hlines for the range strategies
On Buy/Sell Signal # - Change when you enter. Increasing this number will move the signals to the left if there are consecutive signals. Useful to find bottoms and tops.
Chart: ETHUSD Perp Bybit
Strategy Properties: 100 base order, 100% equity
Notes: Use on 3-5m time frame for best results. Change settings if you want to try other coins like BTC or higher time frames
Moving Averages
EMA Cross StrategyThis double EMA crossover strategy aims to illustrate a good strategy design.
It is currently the only published script that:
supports a proper date picker for the backtest period
is able to test in short and long mode only
Combo Backtest 123 Reversal & Martin Pring's Special K This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
Pring's Special K is a cyclical indicator created by Martin Pring.
His method combines short-term, intermediate and long-term velocity
into one complete series. Useful tool for Long Term Investors
Modified for any source.
WARNING:
- For purpose educate only
- This script to change bars colors.
Galileo GalileiGalileo Galilei
Is the simplest of them all and easy to understand:
It has an Exponential Moving Average that you can modify to suit your pair on the chart with it's timeframe, looking at the strategy tester to compare results;
The prices for the EMA are taken from the OPEN of every candle (depending on your timeframe);
If the current candle's price closes above the Average and the new candle opens above the average, it will trigger a buying signal because of the bullish setup;
If the current candle's price closes below the Average and the new candle opens below the average, it will trigger a selling signal because of the bearish setup;
No strategy works on all charts and on all timeframes so you have to feel free to modify the parameters to suit your trading setup;
It is possible that the strategy won't give you any good results at all on some trading pairs and timeframes so be careful because it can lose money;
This strategy is called Galileo Galilei, it's free for you all to use and it was developed to be as simple as it can be and to work in bullish or bearish scenarios, but not in flat movements.
You can message me to ask questions, I respond to every message.
Green pips!
Trend Catcher BotTrend analysis strategy with entry filters such as MACD and Tilson T3. It will look at possible entry points and it can use MACD or TilsonT3 filters to decide whether or not enter in a new trade.
Notes:
- Results include a 0.075% Fee.
- Simulated leverage of 5x.
- Initial Capital of $1000.
- Uses a max order size of $200k per trade (Leverage included).
- Stop loss of 1.15%.
- The stop loss is moved to 0.4% Profit once the Trade reaches 1.15% profit.
- All settings adjustable.
- Non Repainting.
Equal-Length EMA/SMA Crossover Momentum StrategyOverview:
This momentum and trend-following strategy captures the majority of any trending move, and works well on high timeframes.
It uses an equal-period EMA and SMA crossover to detect trend acceleration/deceleration, since an EMA places a greater weight and significance on the most recent data.
This version is optimized for longs, and designed to cut your losses quickly and let your winners run.
To reduce noise and optimize entries, we combined this with an overall trend bias for further confluence.
How it works:
Signals are determined by the crossover of an EMA and SMA of the same length, e.g. EMA-50 and SMA-50.
The overall trend bias is determined using a slower SMA golden/death cross, e.g. SMA-50 and SMA-100.
The signal is stronger when it occurs in confluence with the overall trend bias, e.g. when EMA-50 crosses over SMA-50, while above the SMA-100. This is analogous to only opening long positions in a bull market.
Signal description:
Trend Buy: EMA crosses above SMA, and overall trend bias is bullish. Buying is in confluence with the overall trend bias.
Risky Buy: EMA crosses above SMA, and overall trend bias is bearish. Buying is early, more risky, and not in confluence with the overall trend bias.
Late Buy: SMA crosses above BIAS_SLOW. This gives further confirmation of bullish trend, but signal comes later.
Sell: EMA crosses under SMA.
Strategy entry and exit conditions:
This version enters a Long when "TREND BUY" is signalled.
This version has Sell/Shorts disabled because UP ONLY.
Long entry: Strategy enters Long when EMA is above SMA, while overall trend bias is bullish.
Long exit: Close long when EMA crosses under SMA.
Hilega_Milega_StrategyThis study shows the price action strength using RSI & Moving Averages.
In this study different line indicates below measures---
BlackLine - Strength
Red Line - Volume
GreenLine - Price
1. Volume line is below price and strength then the price may go up.
2. Volume line is above price and strength then the price may go down.
3. Volume line below strength line price may stop going down.
4. Price line above strength then price may go down.
There is a total of 2 zones that indicate the price strength in the red zone price is showing strength ness and in the blue zone, the price is showing weakness.
This study helps to identify if the price is having strength or not if going up or down based on volume.\
Strategy give signal based on above-mentioned line as follows.
Buy - Strength line above volume & price line + Price line crossover Volume line.
Sell - Strength line below volume & price line + Price line crossunder Volume line.
Buy and Hold entry finder StrategyHello everyone!
I proudly present the backtest Strategy Script for my "Buy and Hold entry finder" Script.
It basically shows you the outcome, if you would use my indicator in the past.
The buy signals are limited to 1 order per month.
Order Size: Allows you to choose, how much money you want to invest per month. (Please consider, it will only invest an x amount per Order, but it will not stack the amount you did not invest in an previous month ) (Example in my indicator)
Pyramiding: Just regulates, how often you can open an position.
Commission: Here you can set how much it will cost to open an position at your broker.
I coded a feature that allows you to set a Start Date and an End Date for your backtest. In the end of the backtest the script closes all positions.
If you got any question, feel free to ask in the comments or send me a message.
Sincerely, RS Titan.
MRM [VK] V4.0 strategyMRM VK strategy
This strategy uses MA, RSI , MACD combined.
MACD and RSI can be used multi time frame to filter trend.
It is a very simple strategy which goes long/short when MACD , RSI and MA Trend Changes in higher Time Frame.
NIKI MSS BANKNIFTYThis is the strategy version of my old indicator NIKI BANKIFTY. It is more suitable for day trading with a 5 min chart. It is more profitable in BANKNIFTY future. It is based on multiple Supertrend, moving average, Donchain channel, and linear regression. The background color indicates the main trend and the color of the candle represents a short-term trend. The label with TA and SL represents more profitable entry positions. The label RE: LE and RE: SE stands for re-entry positions or signals with less accuracy. Consider the direction of the linear regression line to take trades on re-entry positions. The yellow candle indicates the entry and the blue candle represents the target or stop-loss.
The backtest results are based on BANKNIFTY last year's data. It has an initial capital of 100000 and the size of the lot is 1. The target is 0.3% and stop-loss is 1.5%. It exactly not following the stop loss, the trade will exit based on the Donchain channel breakout. It appears on the chart as a blue candle. The commission paid is 20 cash per trade and the slippage is 5 ticks per trade. Some of the Indian broker's commission is only 10 cash per trade. Adjust the commission as per your broker. Trades are conducted based on the intraday time in India set from 9.20 am to 2.25 pm. All positions will get square off at 3.00 pm. It will execute a maximum of 4 trades per day. All other parameters are suitable for Robo trading with Indian stock brokers.
Contact us using the link given below to obtain access to this indicator.
Bollinger Band with Fib Golden Ratio (0.618)This startegy uses Fib level (0.618) of Bollinger Band for long entry. I find this is the only strategy which gives similar results on the different time frames. I have tested QQQ for 1H, 2H , 3H and 4H charts , all showed over 70% winning rate.
BB settings 50 , mult 1.5 (or you can use 2.5 or 3 )
Note: for the basis I have used VWMA instead of SMA .
BUY
=========
ema 50 is above ema 200
when the price close or low touches BB50(Fib0.615) lower band
Exit
=========
when the price crossover BB50(Fib0.615) upper band
Stop Loss
=========
Stop oss set to 5% , configurable
Strategy works similar to mean reversion style. When it touches the lower bans (which 0.615 level of the BB50) , it bounces from there.
Warning
=========
This strategy is for educational purposes only. Please do your own reserach for trading decissions.
MRD StrategyI heard that MFI and RSI were most reliable when they are close together, so i made a script that takes the rough difference between the two, with some regression etcetera. What you see currently is 50.69% profitable trades, with a profit ratio of 1.3. Hope you like it.
hamster-bot HD preset_2presets for users
// DESCRIPTION OF STRATEGY ver. 2
HiDeep Strategy
Author foresterufa
This is a counter-trend strategy that is gradually gaining a position against the trend at the best price.
A prerequisite for completing a position is the price exit from the internal channel on the chart and the appearance of the HiDeep indicator.
The condition for closing the position is touching the opposite side of the internal channel.
A condition for facilitating closure along the middle line of the channel, with high price volatility , is that the price touches the border of the external channel.
Input signals are generated by HiDeep indicators. Closing a position by moving averages.
KAMA Strategy - Kaufman's Adaptive Moving AverageThis strategy combines Kaufman's Adaptive Moving Average for entry with optional KAMA, PSAR, and Trailing ATR stops for exits.
Kaufman's Adaptive Moving Average is, in my opinion, a gem among the plethora of indicators. It is underrated considering it offers a solution that intuitively makes a lot of sense. When I first read about it, it was a real 'aha!' moment. Look at the top, pink line. Notice how during trending times it follows the trend quickly and closely, but during choppy, non-trending periods, the KAMA stays absolutely flat? Interesting! To trade with it, we simply follow the direction the KAMA is pointing. Is it up? Go long. Is it down? Go short. Is it flat? Hold on.
How does it manage to quickly follow real trends like a fast EMA but ignore choppy conditions that would whipsaw a fast EMA back and forth? It analyses whether recent price moves are significant relative to recent noise and then adapts the length of the EMA window accordingly. If price movement is big compared to the recent noise, the EMA window gets smaller. If price movement is relatively small or average compared to the recent noise, the EMA window gets bigger. In practice it means:
The KAMA would be flat if a 20 point upwards move occurred during a period that has had, on average, regular 20 point moves BUT
the KAMA would point up if a 20 point move occurred during a period that has, on average, had moves of only around 5 points.
In other words, it's a slow EMA during choppy flat / quiet flat periods, and a fast EMA as soon as significant volatility occurs. Perfect!
-----
The Strategy
The strategy is more than just a KAMA indicator. It contains:
KAMA exit (optional)
ATR trailing stop loss exit (optional)
PSAR stop loss exit (optional)
KAMA filter for entry and exits
All features are adjustable in the strategy settings
The Technical Details:
Check out the strategy's 'Inputs' panel. The buy and sell signals are based on the 'KAMA 1' there.
KAMA 1: Length -- 14 is the default. This is the length of the window the KAMA looks back over. In this instance, it c
KAMA 1: Fast KAMA Length -- 2 is the default. This is the tightest the EMA length is allowed to get. It will tend towards this length when volatility is high.
KAMA 1: Slow KAMA Length -- 20 is the default. This is the biggest the EMA length is allowed to get. It will tend towards this length when volatility is low.
KAMA Filter
The strategy buys when the KAMA begins to point up and sells when the KAMA points down. Generally, the KAMA is very good at filtering out the noise itself - it will go flat during noisy/choppy periods. But to add another layer of safety, its author, Perry Kaufman, proposed a KAMA filter. It works by taking the standard deviation of returns over the length of the the 'KAMA 1: Length' I mentioned above and multiplying it by an 'Entry Filter' (1 by default) and 'Exit Filter' (0.5 by default). The entry condition to go long is that the KAMA is pointing up and and it moved up more than 1 x St. Dev. of Returns. The exit condition is when the KAMA is pointing down and it moved down by more than 0.5 x St. Dev. of Returns.
Thanks
Thanks to ChuckBanger, cheatcountry, millerrh, and racer8 for parts of the code. I was able to build upon their good work.
-----
I hope this strategy is helpful to you.
Do you have any thoughts, ideas, or questions? Let me know in the comments or send me a message! I'd be glad to help you out.
If you need an indicator or strategy to be built or customised for you, let me know! I'll be glad to help and it'll probably be cheaper than you think!
Ultimate Strategy TemplateHello Traders
As most of you know, I'm a member of the PineCoders community and I sometimes take freelance pine coding jobs for TradingView users.
Off the top of my head, users often want to:
- convert an indicator into a strategy, so as to get the backtesting statistics from TradingView
- add alerts to their indicator/strategy
- develop a generic strategy template which can be plugged into (almost) any indicator
My gift for the community today is my Ultimate Strategy Template
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
For doing so:
1) Find in your indicator where are the conditions printing the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator wether it's a MACD, ZigZag, Pivots, higher-highs, lower-lows or whatever indicator with clear buy and sell conditions
//@version=4
study(title='Moving Average Cross', shorttitle='Moving Average Cross', overlay=true, precision=6, max_labels_count=500, max_lines_count=500)
type_ma1 = input(title="MA1 type", defval="SMA", options= )
length_ma1 = input(10, title = " MA1 length", type=input.integer)
type_ma2 = input(title="MA2 type", defval="SMA", options= )
length_ma2 = input(100, title = " MA2 length", type=input.integer)
// MA
f_ma(smoothing, src, length) =>
iff(smoothing == "RMA", rma(src, length),
iff(smoothing == "SMA", sma(src, length),
iff(smoothing == "EMA", ema(src, length), src)))
MA1 = f_ma(type_ma1, close, length_ma1)
MA2 = f_ma(type_ma2, close, length_ma2)
// buy and sell conditions
buy = crossover(MA1, MA2)
sell = crossunder(MA1, MA2)
plot(MA1, color=color_ma1, title="Plot MA1", linewidth=3)
plot(MA2, color=color_ma2, title="Plot MA2", linewidth=3)
plotshape(buy, title='LONG SIGNAL', style=shape.circle, location=location.belowbar, color=color_ma1, size=size.normal)
plotshape(sell, title='SHORT SIGNAL', style=shape.circle, location=location.abovebar, color=color_ma2, size=size.normal)
/////////////////////////// SIGNAL FOR STRATEGY /////////////////////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Basically, I identified my buy, sell conditions in the code and added this at the bottom of my indicator code
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal , and -1 for the bearish signal
Now you can connect your indicator to the Strategy Template using the method below or that one
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings and in the Data Source field select your 🔌Connector🔌 (which comes from your indicator)
From then, you should start seeing the signals and plenty of other stuff on your chart
🔥 Note that whenever you'll update your indicator values, the strategy statistics and visual on your chart will update in real-time
Settings
- Color Candles : Color the candles based on the trade state (bullish, bearish, neutral)
- Close positions at market at the end of each session : useful for everything but cryptocurrencies
- Session time ranges : Take the signals from a starting time to an ending time
- Close Direction : Choose to close only the longs, shorts, or both
- Date Filter : Take the signals from a starting date to an ending date
- Set the maximum losing streak length with an input
- Set the maximum winning streak length with an input
- Set the maximum consecutive days with a loss
- Set the maximum drawdown (in % of strategy equity)
- Set the maximum intraday loss in percentage
- Limit the number of trades per day
- Limit the number of trades per week
- Stop-loss: None or Percentage or Trailing Stop Percentage or ATR
- Take-Profit: None or Percentage or ATR
- Risk-Reward based on ATR multiple for the Stop-Loss and Take-Profit
This script is open-source so feel free to use it, and optimize it as you want
Alerts
Maybe you didn't know it but alerts are available on strategy scripts.
I added them in this template - that's cool because:
- if you don't know how to code, now you can connect your indicator and get alerts
- you have now a cool template showing you how to create alerts for strategy scripts
Source: www.tradingview.com
I hope you'll like it, use it, optimize it and most importantly....make some optimizations to your indicators thanks to this Strategy template
Special Thanks
Special thanks to @JosKodify as I borrowed a few risk management snippets from his website: kodify.net
Additional features
I thought of plenty of extra filters that I'll add later on this week on this strategy template
Best
Dave
MA Divergences StrategyThis is the Strategy version of the Study I published. It is a Moving Average that can be applied to any plot to plot divergences on any oscillator, as well as perform backtesting. You'll need a REALLY good oscillator to perform live trades using this alone, but I think it is a valuable tool and had the Strategy hanging around and for some reason didn't upload it yet.
So here it is.
Turn Length to 1 to follow the oscillator without lag. Turn Length up if you are getting too many false signals or tweak the original oscillator settings.