Scripting Tutorial B - TManyMA - Commission/FeesThis script is for a triple moving average strategy where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually.
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish , bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter . Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
- Converted the existing study into a strategy.
- Strategy only enters long positions with a market order when MA crossovers occur.
- Strategy exits positions when crossunders occur.
- Trades 100% of the equity with one order/position by default.
- Ability to disable trading certain crosses with input checks.
- Ability to exit trades with a take profit or stop loss.
- User input to allow quick changes to the take profit or stop loss percentages.
- Strategy now calculates on every tick
- Strategy also includes fixed commission values based on Coinbase standard order fees
This script is meant as an educational script with well-formatted styling, and references for specific functions.
*** PLEASE NOTE - THIS STRATEGY IS MEANT FOR LEARNING PURPOSES. DEPENDING ON IT'S CONFIGURATION IT MAY OR MAY NOT BE USEFUL FOR ACTUAL TRADING. THE STRATEGY IS NOT FINANCIAL ADVICE ***
Profit
Scripting Tutorial A - TManyMA - StopsThis script is for a triple moving average strategy where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually.
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish, bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter. Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
- Converted the existing study into a strategy.
- Strategy only enters long positions with a market order when MA crossovers occur.
- Strategy exits positions when crossunders occur.
- Trades 100% of the equity with one order/position by default.
- Ability to disable trading certain crosses with input checks.
- Ability to exit trades with a take profit or stop loss.
- User input to allow quick changes to the take profit or stop loss percentages.
This script is meant as an educational script with well-formatted styling, and references for specific functions.
*** PLEASE NOTE - THIS STRATEGY IS MEANT FOR LEARNING PURPOSES. DEPENDING ON IT'S CONFIGURATION IT MAY OR MAY NOT BE USEFUL FOR ACTUAL TRADING. THE STRATEGY IS NOT FINANCIAL ADVICE ***
Extreme ScalpingThis is a test of an easy scalping method: buy if actual close is below forecast close and sell if actual close is above forecast close. Take profit and stop loss shall be very small (few pips) as in most of scalping strategies.
No filter is used for only long or only short positions, but you can select buy only or sell only based on other indicators or whatever you feel is the direction of trading.
NOTE: you can add this strategy to your chart but you should modify the backtest day otherwise you will get an error due to calculation limits of pine script. For example, on one minute chart, you should set the backtest day from today only. For past days, set both start day and and day.
I have also a study with alarms.
Please use comment section for any feedback.
ATR based Pivots mcbwHey everyone this is an exciting new script I have prepared for you.
I was reading an old forex bulletin article some time ago when I came across this: solar.murty.net (or you can download the full bulletin with lots of other good articles here: www.forexfactory.com).
You can already buy this for metatrader (www.mql5.com) so I figured to make it for free for tradingview.
This bulletin suggested that you can reasonably predict daily volatility by adding or subtracting multiples of the daily ATR to the daily opening. Using this you can choose multiples to use as price targets and alternatively as stop losses. For example, if you already have a sense of market direction you can buy at market open place a stop loss at - 1 daily ATR and a profit target at + 3 ATRs for a risk to reward ratio of 3. If you are looking for smaller/quicker moves with a ratio of 3 you can have a stop loss at -0.25 ATR and a take profit at +0.75 ATR.
Alternatively this article also suggests to use this method to catch volatility breakouts. If price is higher than the + 1 ATR area then you can safely assume it will be going to the +2 ATR area so you can put a buy stop at + 1 ATR with a profit target at + 2 ATR with a stop loss at +0.5 ATR to catch a volatility breakout with a risk to reward ratio of 2!
Even further there are methods that you can use with ATRs of multiple window sizes, for example by opening two copies of this indicator and measuring recent volatility with a 1 week window and long term volatility within a 1 month window. If the short term volatility is crossing the long term volatility then there is a high probability chance that even more price movement will occur.
However I have found that this method is good for more than daily volatility , it can also be used to measure weekly volatility , and monthly volatility and use these multiples as good long term price targets.
To select if you want daily, weekly, or monthly values of the ATR of volatility you're using go to the settings and click on the options in the "Opening period". The default window of the ATR here is 14 periods, but you can change this if you want to in "ATR period". Most importantly you are able to select which multiples of the ATR you would like to use in the settings in "ATR multiple 1" which is the green line, "ATR multiple 2" which is the blue line, and "ATR multiple 3" which is the purple line. You can select any values you want to put in these, the choice of 0.25, 0.5, and 1 is not special, some people use fibonacci numbers here or simply 0.33, 0.66, and 0.99.
Repainting issue: This script uses the daily value of the Average True Range (ATR), which measures the volatility that is happening today. If price becomes more volatile then the value of the ATR can increase throughout the day, but it can never decrease. What this means is that the ATR based pivots are able to expand away from the opening price, which should not affect the trades that you take based on these areas. If you base your take profit on one of these ATR multiples and the daily volatility increase this means that your take profit area will be closer to your entry than the ATR multiple. Meaning that your trades will be more conservative.
While this all may sound very technical it is super intuitive, throw this on your chart and play around with it :)
Happy trading!
Simple Stock StrategyThis is a simple and easy to use strategy for low-volatility stocks. It prints a BUY or SELL signal to alert you that certain conditions have been met. I use it as a time saver to help identify which charts I need to look at. You can adjust the inputs and properties to suit your needs. I would suggest allowing two or three orders.
BUY Signals
MACD Above 0
SMA Cross
Big Green Candles
SELL Signals
Profit Target %
Stop Loss %
Renko Strategy Open_CloseSimple Renko strategy, very profitable. Thanks to vacalo69 for the idea.
Rules when the strategy opens order at market as follows:
- Buy when previous brick (-1) was bearish and previous brick (-2) was bearish too and actual brick close is bullish
- Sell when previous brick (-1) was bullish and previous brick (-2) was bullish too and actual brick close is bearish
Rules when the strategy send stop order are the same but this time a stop buy or stop sell is placed (better overall results).
Note that strategy open an order only after that condition is met, at the beginning of next candle, so the actual close is not the actual price.
Only input is the brick size multiplier for stop loss and take profit: SL and TP are placed at (brick size)x(multiplier) Or put it very high if you want startegy to close order on opposite signal.
Adjust brick size considering:
- Strategy works well if there are three or more consecutive bricks of same "color"
- Expected Profit
- Drawdown
- Time on trade
This strategy uses Renko charts with TRADITIONAL bricks, so no repaint.
Study with alerts, MT4 expert advisor and jforex automatic strategy are available at request.
Please use comment section for any feedback.
Strategy based on Squeeze Momentum Indicator [LazyBear]This Strategy is based on LazyBear Squeeze Momentum Indicator.
I added some custom feature and filters.
You can customize a lot of features to get a profitable strategy.
Here is a link to original study.
Please use comment section for any feedback.
Next improvement (only to whom is interested to this script and follows me): study with alerts on multiple tickers all at one. Leave a comment if you want to have access to study.
********************************** IMPORTANT*******************************
I have developed an expert advisor for metatrader4 (MT4) and for jforex platform: results of expert advisor form 2015-01-01 to 2018-11-25 are very good with low drawdown and good profit.
********************************************************************************
Doji strategyThis is a simple strategy based on Doji star candlestick.
It places two orders: buy stop at doji star high or previous candle high and sell stop at doji star low or previous candle low.
Exit rules are with take profit and fixed stop loss or take profit and stop loss at doji min or max.
This strategy works very well with high time frames like Daily and Weekly because those are without noise in doji formation.
Each currency pair has its own optimal setting for TP and SL: it's up to user find the best ones.
I could implement SL based on ATR, maybe in next revision.
Please use comment section for any feedback.
Next improvement (only to whom is interested to this script and follows me): study with alerts on multiple tickers all at one. Leave a comment if you want to have access to study.
MTF stochastic strategyThis strategy is based on MTF strategy found on Forex Factory forum and published by bobby2 (credits to him).
This is quite simple but need improvement to work properly:
1- it is made for 5 min chart
2- when 15min stochastic cross above 50 and 5min stochastic is rising, buy
3- when 15min stochastic cross below 50 and 5min stochastic is falling, sell
RSI Multi Time Frame - Spot Panic Sell Moments and profit!Union of three RSI indicators: 1h, 4h and daily. In order to show 1h RSI, you have to set it as active time frame on the chart.
Purpose: spot "triple oversold" moments, where all the three RSI are under the threshold, which is 30 by default but editable.
Target Market: Cryptocurrencies. Didn't try it on other ones, may work as well. Fits Crypto well as, by experience, I can tell it usually doesn't stay oversold for long.
When the market panics and triple oversold occurs, the spot is highlighted by a green vertical bar on the indicator.
The indicator highlights triple overbought conditions as well (usually indicating strong FOMO), but I usually don't use it as a signal.
I suggest to edit the oversold threshold in order to make it fit the coin you're studying, minimizing false positives.
Special thanks to Heavy91, a Discord user, for inspiring me in this indicator.
Any editing proposal is welcome!
I reposted this script, as the first time I wrote it in Italian. Sorry for that.
Sweat DreamsIt is based on the intersection of the kagi function and the weighted moving average
Available for all time frames
Available for all crypto currency pairs
High-yield on all time frames
The script is the dream of all traders
Repaints like a boss.
Use at your own risk, or dont use at all!
------------------------------
Основан на пересечении функции каги и взвешенной скользящей средней.
Доступен для всех временных рамок
Доступен для всех криптовалютных пар
Высокодоходный на всех временных рамках
Скрипт- мечта всех трейдеров
Перерисовывает словно Гуру.
Использовать на свой страх и риск, или не использовать вобще!
Sweat Dreams - Extra high profitable
Available for all time frames
Available for all crypto currency pairs
High-profitable on all time frames
The script is the dream of all traders
Repaints like a boss.
Use at your own risk, or don't use at all!
Vix FIX / StochRSI StrategyThis strategy is based off of Chris Moody's Vix Fix Indicator . I simply used his indicator and added some rules around it, specifically on entry and exits.
Rules :
Enter upon a filtered or aggressive entry
If there are multiple entry signals, allow pyramiding
Exit when there is Stochastic RSI crossover above 80
This works great on a number of stocks. I am keeping a list of stocks with decent Profit Factors and clean equity curves here .
Possible ways to use this:
Modify this script and setup alerts around the various entries
Use as is with different stocks or currency pairs
Modify entry / exit points to make it more profitable for even more symbols and currencies
Fractal Adaptive Moving Average (real one)Ignore the other one (it contains some errors).
On this FRAMA you can play with length, SC and FC.
Just read on below links to understand more about this super useful moving average:
etfhq.com
etfhq.com
www.quantshare.com
$EURUSD 1 Minute Chart StrategyYou must be using the renko chart with traditional settings with the block size set at .0001. This can be done by going to settings. Style at the bottom should be changed from ATR to traditional. The set the block size as .0001.
How to automate this strategy for free using a chrome extension.Hey everyone,
Recently we developed a chrome extension for automating TradingView strategies using the alerts they provide. Initially we were charging a monthly fee for the extension, but we have now decided to make it FREE for everyone. So to display the power of automating strategies via TradingView, we figured we would also provide a profitable strategy along with the custom alert script and commands for the alerts so you can easily cut and paste to begin trading for profit while you sleep.
Step 1:
You are going to need to download the Chrome Extension called AutoView. You can get the extension for free by following this link: bit.ly ( I had to shorten the link as it contains Google and TV automatically converts it to a symbol)
Step 2: Go to your chrome extension page, and under the new extension you'll see a "settings" button. In the setting you will have to connect and give permission to the exchange 1broker allowing the extension to place your orders automatically when triggered by an alert.
Step 3: Setup the strategy and custom script for the alerts in TradingView. The attached script is the strategy, you can play with the settings yourself to try and get better numbers/performance if you please.
This following script is for the custom alerts:
//@version=2
study("4All-Alert", shorttitle="Alerts")
src = close
len = input(4, minval=1, title="Length")
up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsin = input(5)
sn = 100 - rsin
ln = 0 + rsin
short = crossover(rsi, sn) ? 1 : 0
long = crossunder(rsi, ln) ? 1 : 0
plot(long, "Long", color=green)
plot(short, "Short", color=red)
Now that you have the extension installed, the custom strategy and alert scripts in place, you simply need to create the alerts.
To get the alerts to communicate with the extension properly, there is a specific syntax that you will need to put in the message of the alert. You can find more details about the syntax here : gist.github.com
For this specific strategy, I use the Alerts script, long/short greater than 0.9 on close.
In the message for a long place this as your message:
Long
c=order b=short
c=position b=short l=200 t=market
b=long q=0.01 l=200 t=market tp=13 sl=25
and for the short...
Short
c=order b=long
c=position b=long l=200 t=market
b=short q=0.01 l=200 t=market tp=13 sl=25
If you'll notice in my above messages, compared to the strategy my tp and sl (take profit and stop loss) vary by a few pips. This is to cover the market opens and spread on 1broker. You can change the tp and sl in the strategy to the above and see that the overall profit will not vary much at all.
I hope this all makes sense and it is enough to not only make some people money, but to show the power of coming up with your own strategy and automating it using TradingView alerts and the free Chrome Extension AutoView.
ps. I highly recommend upgrading your TradingView account so you have access to back testing and multiple alerts.
There is really no reason you won't cover the cost and then some on a monthly basis using the tools provided.
Best of luck and happy trading.
Note: The extension currently allows for automation on 2 exchanges; 1broker and Okcoin. If you do not have accounts there, we'd appreciate you signing up using our referral links.
www.okcoin.com
1broker.com
Ichimoku Cloud ALERTHi, this my new script which show you correct Ichimoku signals, when price exit cloud.
SELL SIGNAL:
- red line below blue
- green line below price
- price exit cloud bottom
- price below 3 EMA's!
BUY SIGNAL:
- red line above blue
- green line above price
- price exit cloud upper
- price above 3 EMA's!
You can change ichimoku parameters and input 3 EMA's. If u dont want use any of the EMA's then input 1 into them.