Selected Dates Filter by @zeusbottradingWe are presenting you feature for strategies in Pine Script.
This function/pine script is about NOT opening trades on selected days. Real usage is for bank holidays or volatile days (PPI, CPI, Interest Rates etc.) in United States and United Kingdom from 2020 to 2030 (10 years of dates of bank holidays in mentioned countries above). Strategy is simple - SMA crossover of two lengts 14 and 28 with close source.
In pine script you can see we picked US and GB bank holidays. If you add this into your strategy, your bot will not open trades on those days. You must make it a rule or a condition. We use it as a rule in opening long/short trades.
You can also add some of your prefered dates, here is just example of our idea. If you want to add your preffered days you can find them on any site like forexfactory, myfxbook and so on. But don’t forget to add function “time_tradingday ! = YourChoosedDate” as it is writen lower in the pine script.
Sometimes the date is substituted for a different day, because the day of the holiday is on Saturday or Sunday.
Made with ❤️ for this community.
If you have any questions or suggestions, let us know.
The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold zeusbottrading TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script.
Strategy!
[-_-] Level Breakout, Auto Backtesting StrategyDescription:
A Long only strategy based on breakout from a certain level formed by High price. It has auto-backtesting capabilities (you set ranges for the three main parameters: Lookback, TP and SL; the strategy then goes through different combinations of those parameters and displays a table with results that you can sort by Percentage of profitable trades AND/OR Net profit AND/OR Number of trades). So you can, for example, sort only by Net profit to find combination of parameters that gives highest net profit, or sort by Net profit and Percentage profitable to find a combination of parameters that gives the best balance between profitability and profit. The auto-backtesting also takes into account the commission which is set in % in the inputs (make sure to set the same value in properties of the strategy so that auto-backtesting and real backtesting results match).
NOTE: auto-backtesting only find the best combinations and displays them in a table, you will then need to manually set the Lookback, TP and SL inputs for real backtesting to match.
Parameters:
- Lookback -> # of bars for filtering signals; recommended range from 2 to 5
- TP (%) -> take profit; recommended range from 5 to 10
- SL (%) -> stop loss; recommended range from 1 to 5
- Commission (%) -> commission per trade
- Min/Max Lookback -> lookback range for auto-backtesting
- Min/Max TP -> take profit range for auto-backtesting
- Min/Max SL -> stop loss range for auto-backtesting
- Percentage profitable -> sort by percentage of profitable trades
- Net profit -> sort by net profit
- Number of trades -> sort by number of trades
Chandelier Exit ZLSMA StrategyIntroduction
Heyo guys, I recently checked out some eye-catching trading strategy videos on YT and found one to test.
This indicator is based on the video.
Usage
The recommended timeframe is 5 min.
Signals
Long Entry => L Label
Price crosses above ZLSMA and Chandelier Exit shows Buy
Long Exit => green circle
Price crosses below ZLSMA
Short Entry => S Label
Price crosses below ZLSMA and Chandelier Exit shows Sell
Short Exit => orange circle
Prices crosses above ZLSMA
Ty for checking this out. Enjoy!
--
Credits to
@netweaver2011 - ZLSMA
@everget – Chandelier Exit
Ultimate Strategy Template (Advanced Edition)Hello traders
This script is an upgraded version of that one below
New features
- Upgraded to Pinescript version 5
- Added the exit SL/TP now in real-time
- Added text fields for the alerts - easier to send the commands to your trading bots
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=5
indicator(title='Moving Average Cross', shorttitle='Moving Average Cross', overlay=true, precision=6, max_labels_count=500, max_lines_count=500)
type_ma1 = input.string(title='MA1 type', defval='SMA', options= )
length_ma1 = input(10, title=' MA1 length')
type_ma2 = input.string(title='MA2 type', defval='SMA', options= )
length_ma2 = input(100, title=' MA2 length')
// MA
f_ma(smoothing, src, length) =>
rma_1 = ta.rma(src, length)
sma_1 = ta.sma(src, length)
ema_1 = ta.ema(src, length)
iff_1 = smoothing == 'EMA' ? ema_1 : src
iff_2 = smoothing == 'SMA' ? sma_1 : iff_1
smoothing == 'RMA' ? rma_1 : iff_2
MA1 = f_ma(type_ma1, close, length_ma1)
MA2 = f_ma(type_ma2, close, length_ma2)
// buy and sell conditions
buy = ta.crossover(MA1, MA2)
sell = ta.crossunder(MA1, MA2)
plot(MA1, color=color.new(color.green, 0), title='Plot MA1', linewidth=3)
plot(MA2, color=color.new(color.red, 0), title='Plot MA2', linewidth=3)
plotshape(buy, title='LONG SIGNAL', style=shape.circle, location=location.belowbar, color=color.new(color.green, 0), size=size.normal)
plotshape(sell, title='SHORT SIGNAL', style=shape.circle, location=location.abovebar, color=color.new(color.red, 0), size=size.normal)
/////////////////////////// SIGNAL FOR STRATEGY /////////////////////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title='🔌Connector🔌', display = display.data_window)
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 - I'll add shortly multiple options for the trailing stop loss
- Take-Profit: None or Percentage or ATR - I'll add also a trailing take profit
- Risk-Reward based on ATR multiple for the Stop-Loss and Take-Profit
Special Thanks
Special thanks to @JosKodify as I borrowed a few risk management snippets from his website: kodify.net
Best
Dave
CM_SlingShotSystem+_CassicEMA+Willams21EMA13 htc1977 editionThis strategy is a combination of 2 indicators based on EMA(actually x3 EMAs and Williams ind.
We usin this to see where EMA fast is above EMA slow(for long), entry position when price hit fast EMA and exit if trend changes or price overbought, or by stoploss 1%.
The opposite for a short position.
For better result You can change every EMA's, stoploss, Willam's ind and other visualisation in settings.
If You find good combination - please, let me know(if You want).
I will check it with ML, and attach it here.
Original indicators will write in comments
iMoku (Ichimoku Complete Tool) - The Quant Science iMoku™ is a professional all-in-one solution for the famous Ichimoku Kinko Hyo indicator.
The algorithm includes:
1. Backtesting spot
2. Visual tool
3. Auto-trading functions
With iMoku you can test four different strategies.
Strategy 1: Cross Tenkan Sen - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when "Tenkan Sen" crossover "Kijun Sen".
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is within the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 2: Cross Price - Kijun Sen
A long position is opened with 100% of the invested capital ($1000) when the price crossover the 'Kijun Sen'.
Closing the long position on the opposite condition.
There are 3 different strength signals for this strategy: weak, normal, strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Normal : the signal is normal when the condition is true and the price is inside the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
Strategy 3: Kumo Breakout
A long position is opened with 100% of the invested capital ($1000) when the price breakup the 'Kumo'.
Closing the long position with a percentage stop loss and take profit on the invested capital.
Strategy 4: Kumo Twist
A long position is opened with 100% of the invested capital ($1000) when the 'Kumo' goes from negative to positive (called "Twist").
Closing the long position on the opposite condition.
There are 2 different strength signals for this strategy: weak, and strong.
Weak : the signal is weak when the condition is true and the price is above the 'Kumo'
Strong : the signal is strong when the condition is true and the price is below the 'Kumo'
This script is compliant with algorithmic trading.
You can use this script with trading terminals such as 3Commas or CryptoHopper. Connecting this script is very easy.
1. Enter the user interface
2. Select and activate a strategy
3. Copy your bot's links into the dedicated fields
4. Create and activate alert
Disclaimer: algorithmic trading involves risk, the user should consider aspects such as slippage, liquidity and costs when evaluating an asset. The Quant Science is not responsible for any kind of damage resulting from use of this script. By using this script you take all the responsibilities and risks.
50 Pips A Day Strategy - Kaspricci50 Pips A Day Strategy
This strategy is designed to work on 1 hour timeframe. It is designed to capture the early market move of major forex pairs like EURUSD or GBPUSD. It takes the high and low of the first candle (7 a.m. GMT, London Stock Exchange opens) and places to pending orders at these prices levels.
High + additional gap in pips = buy stop pending order
Low + additional gap in pips = sell stop pending order
For both orders a stop loss of 15 pips and a take profit of 50 pips is used as a default. As soon as price triggers one pending order, the remaining pending order is cancelled. At the end of the configured session time all open and pending orders are closed / cancelled.
Settings
Trading Time - start and end time of session. It is configured for Monday to Friday only. At the beginning the first candle is used to define stop prices for pending orders.
Source for Buy Stop order - Default: high. Used to calculate buy stop order. You can add additional pips as a gap.
Source for Sell Stop order - Default: low. Used to calculate sell stop order. You can add additional pips as a gap.
Stop Loss in Pips - Default: 15. Used for both pending orders.
Take Profit in Pips - Default: 50. Used for both pending orders.
This strategy is for educational purposes only! It is not meant to be a financial recommendation.
Multi Trend Cross Strategy TemplateToday I am sharing with the community trend cross strategy template that incorporates any combination of over 20 built in indicators. Some of these indicators are in the Pine library, and some have been custom coded and contributed over time by the beloved Pine Coder community. Identifying a trend cross is a common trend following strategy and a common custom-code request from the community. Using this template, users can now select from over 400 different potential trend combinations and setup alerts without any custom coding required. This Multi-Trend cross template has a very inclusive library of trend calculations/indicators built-in, and will plot any of the 20+ indicators/trends that you can select in the settings.
How it works : Simple trend cross strategies go long when the fast trend crosses over the slow trend, and/or go short when the fast trend crosses under the slow trend. Options for either trend direction are built-in to this strategy template. The script is also coded in a way that allows you to enable/modify pyramid settings and scale into a position over time after a trend has crossed.
Use cases : These types of strategies can reduce the volatility of returns and can help avoid large market downswings. For instance, those running a longer term trend-cross strategy may have not realized half the down swing of the bear markets or crashes in 02', 08', 20', etc. However, in other years, they may have exited the market from time to time at unfavorable points that didn't end up being a down turn, or at times the market was ranging sideways. Some also use them to reduce volatility and then add leverage to attempt to beat buy/hold of the underlying asset within an acceptable drawdown threshold.
Special thanks to @Duyck, @everget, @KivancOzbilgic and @LazyBear for coding and contributing earlier versions of some of these custom indicators in Pine.
This script incorporates all of the following indicators. Each of them can be selected and modified from within the indicator settings:
ALMA - Arnaud Legoux Moving Average
DEMA - Double Exponential Moving Average
DSMA - Deviation Scaled Moving Average - Contributed by Everget
EMA - Exponential Moving Average
HMA - Hull Moving Average
JMA - Jurik Moving Average - Contributed by Everget
KAMA - Kaufman's Adaptive Moving Average - Contributed by Everget
LSMA - Linear Regression , Least Squares Moving Average
RMA - Relative Moving Average
SMA - Simple Moving Average
SMMA - Smoothed Moving Average
Price Source - Plotted based on source selection
TEMA - Triple Exponential Moving Average
TMA - Triangular Moving Average
VAMA - Volume Adjusted Moving Average - Contributed by Duyck
VIDYA - Variable Index Dynamic Average - Contributed by KivancOzbilgic
VMA - Variable Moving Average - Contributed by LazyBear
VWMA - Volume Weighted Moving Average
WMA - Weighted Moving Average
WWMA - Welles Wilder's Moving Average
ZLEMA - Zero Lag Exponential Moving Average - Contributed by KivancOzbilgic
Disclaimer : This is not financial advice. Open-source scripts I publish in the community are largely meant to spark ideas that can be used as building blocks for part of a more robust trade management strategy. If you would like to implement a version of any script, I would recommend making significant additions/modifications to the strategy & risk management functions. If you don’t know how to program in Pine, then hire a Pine-coder. We can help!
Power Of Stocks - Bollinger Band & 5Ema Indicator - Keanu_RiTz
Power of Stocks - Bollinger band & 5ema Strategy
In this script you get to take Buy/Sell trades using the 3 options mentioned below.(Alerts with price levels for buy/sell at , SL & Target are included in this one)
1. Combined Strategy :- uses confirmation from both strategies to trade.
2. Bollinger band Strategy :- use the Bollinger band Strategy to trade.
3. 5ema Strategy :- use the 5ema Strategy to trade.
1. Combined Strategy :-
for Selling :- we will go short/sell only when conditions of both strategies are satisfied.
i.e. when a candle is completely above the upper Bollinger band & completely above the 5ema then it will be our Alert Candle.
We Short/Sell only when the low of the Alert candle is broken or when the candle closes below the close of the Alert Candle.
SL will be above high of the Alert Candle. Target will be minimum 1:3 or as per your emotions.
for Buying:- we will go Long/Buy only when conditions of both strategies are satisfied.
i.e. when a candle is completely below the lower Bollinger band & completely below the 5ema then it will be our Alert Candle.
We go Long/Buy only when the high of the Alert candle is broken or when the candle closes above the close of the Alert Candle.
SL will be below low of the Alert Candle. Target will be minimum 1:3 or as per your emotions.
2. Power of Stocks - Bollinger Band Strategy :-
Bollinger band with standard deviation = 1.5
when a candle is completely above the upper Bollinger band, that candle will be called a signal/alert candle.
Initiate a Sell trade when that alert candles low is broken. SL will be above high of that alert candle.
Risk to reward ratio will be 1:4 i.e. target will be 4 times the SL.
when a candle is completely below the lower Bollinger band, that candle will be called a signal/alert candle.
Initiate a Buy trade when that alert candles high is broken. SL will be below low of that alert candle.
Risk to reward ratio will be 1:4 i.e. target will be 4 times the SL.
other rules for Options buying:- minimum 15min timeframe
The day you initiate the position , you should be in profit above 10%-15% then only you should carry forward that position overnight, otherwise squareoff your trade on that day only.
Buy ATM or slightly OTM, SL max 100 points , target 1:4
for Long-term/Investing :- Minimum Weekly
If candle is outside the lower band then initiate a Buy trade when that candles High is broken. Sl will be below Low of that candle.
for Long-term Target will be according to your emotions.
3. Power of Stocks - 5ema Strategy (target minimum 1:3)
Timeframe -
5 min for Selling (Sell Futures/index/stocks or buy Put)
15 min for Buying (Buy Futures/index/stocks or sell Put)
for selling stocks :-
you should enter trade within 10am , don't look for entries after that time. take only 2 entries a day.
for selling Index(Banknifty) :-
you can take trade at anytime of the day whenever conditions get satisfied. you can take multiple entries in banknifty as it is very volatile.
for options choose atm strikes: selling trade
sl for premium between 200-300 :- 20-30 points SL
sl for premium between 400-500 :- 40-50 points SL
sl for premium between 500-600 :- 50-60 points SL
Subhashish Pani's (power of stocks) 5 EMA Strategy:-
It plots 5 EMA and Buy/Sell signals with Target & Stoploss levels.
What is Subhashish Pani's (power of stocks) 5 EMA Strategy :-
His strategy is very simple to understand. for intraday use 5 minutes timeframe for selling. You can sell futures, sell call or buy Puts in selling strategy.
What this strategy tries to do is , it tries to catch the tops, so when you sell at top & it turns out to be a reversal point then you can get good profit.
this will hit stop losses often, but stop losses are small and minimum target should be 1:3. but if you stay with the trend you can get big profits.
According to Subhashish Pani this strategy has 60% success rate.
Strategy for Selling (Short future/Call/stock or buy Put)
When ever a Candle closes completely above 5 ema (no part of candle should be touching the 5ema), then that candle should be considered as Alert Candle.
If the next candle is also completely above 5 ema and it has not broken the low of previous alert candle, Then the previous Alert Candle should be ignored and the new candle should be considered as new Alert Candle.
so if this goes on then continue shifting the Alert Candle, but whenever the next candle breaks the low of the Alert Candle we should take the Short trade (Short future/Call/stock or buy Put).
Stoploss will be above high of the Alert Candle and minimum target will be 1:3.
Strategy for Buying (Buy future/Call/stock or sell Put)
When ever a Candle closes completely below 5 ema (no part of candle should be touching the 5ema), then that candle should be considered as Alert Candle.
If the next candle is also completely below 5 ema and it has not broken the high of previous alert candle, Then the previous Alert Candle should be ignored and the new candle should be considered as new Alert Candle.
so if this goes on then continue shifting the Alert Candle, but whenever the next candle breaks the high of the Alert Candle we should take the Long trade (Buy future/Call/stock or sell Put).
Stoploss will be below low of the Alert Candle and minimum target will be 1:3.
Buy/Sell with extra conditions :
it just adds 1 more condition to buying/selling
1. checks if closing of current candle is lower than alert candles closing for Selling & checks if closing of current candle is higher than alert candles closing for Buyling.
This can sometimes save you from false moves but by using this, you can also miss out on big moves as you'll enter trade after candle closing instead of entering at break of high/low.
Note :- According to Subhashish Pani Timeframe for intraday buying should be 15 minutes Timeframe.
If you haven't understood the strategy by reading above description, then search for "Subhashish Pani's (power of stocks) 5 EMA Strategy" on YouTube to get a deeper understanding.
Note:- This is not only for Intraday trading , you can use this strategy for Positional/Swing trading as well. If you use this on Monthly Timeframe then it can be very good for Long Term Investing as well.
Rules will be same for all types of trades & Timeframes.
SpreadTrade - Auto-Cointegration (ps5)Decsription: Auto-Cointegration-Based Pair Trading Strategy (revised version)
To review, there are three popular styles of Pair trading: distance-based pair trading, correlation-based pair trading and cointegration-based pair trading. Typically, they require preliminary statistical estimation of the viability of the corresponding strategy.
Basically a pair trade strategy boils down to shorting the outperforming instrument and going long on the underperforming instrument whenever the temporary correlation weakens which means one instrument is going up and another is going down. Apart from the typical cointegration strategy which employs two cointegrated instruments, this script uses just one instrument, in base timeframe and in lagged timeframe, actually making it an auto-cointegration, or better still, an auto-correlation strategy.
Notice that each moving average function may require different Threshold settings.The orange cross symbol indicates the exit points. To filter out the signals use higher values for the LongWindow and the Threshold parameters. Also pay attention that in some cases with some moving averages the color of the signals has to be inverted.
Davin's 10/200MA Pullback on SPY Strategy v2.0Strategy:
Using 10 and 200 Simple moving averages, we capitalize on price pullbacks on a general uptrend to scalp 1 - 5% rebounds. 200 MA is used as a general indicator for bullish sentiment, 10 MA is used to identify pullbacks in the short term for buy entries.
An optional bonus: market crash of 20% from 52 days high is regarded as a buy the dip signal.
An optional bonus: can choose to exit on MA crossovers using 200 MA as reference MA (etc. Hard stop on 50 cross 200)
Recommended Ticker: SPY 1D (I have so far tested on SPY and other big indexes only, other stocks appear to be too volatile to use the same short period SMA parameters effectively) + AAPL 4H
How it works:
Buy condition is when:
- Price closes above 200 SMA
- Price closes below 10 SMA
- Price dumps at least 20% (additional bonus contrarian buy the dip option)
Entry is on the next opening market day the day after the buy condition candle was fulfilled.
Sell Condition is when:
- Prices closes below 10 SMA
- Hard stop at 15% drawdown from entry price (adjustable parameter)
- Hard stop at medium term and long term MA crossovers (adjustable parameters)
So far this strategy has been pretty effective for me, feel free to try it out and let me know in the comments how you found :)
Feel free to suggest new strategy ideas for discussion and indicator building
TradeIQ - Crazy Scalping Trading Strategy [Kaspricci]This strategy script is a combination of two indicators developed by LuxAlgo:
Triangular Momentum Oscillator & Real Time Divergences ( TMO )
Adjustable MA & Alternating Extremities (AMA)
The script combines the BUY and SELL signals from the TMO indicator with the BUY and SELL extremities shown by the AMA script and waits for the smoothed candles to grow in size. It places a SHORT or LONG order and sets a stop loss at the latest swing high or low (highes high or lowest low for a defined number of recent bars). A new LONG trade is highlighted by a green background. A new SHORT trade is highlighted by red background.
The trades will be closed once a new TMO indicator BUY or SELL signal appears or the color of the AMA extremities is switching from green to red and vice versa.
All parameters of TOM and AMA indicators are added as well and work the same way as in the original scripts provided by LuxAlgo.
The idea to combine these two indicators has been provided to me by TradIQ in his youtube video.
Please leave a comment in case you find a bug. In case you find a combination of parameters with a high win rat and high PnL I would be interested as well.
[MT] Strategy Backtest Template| Initial Release | | EN |
An update of my old script, this script is designed so that it can be used as a template for all those traders who want to save time when programming their strategy and backtesting it, having functions already programmed that in normal development would take you more time to program, with this template you can simply add your favorite indicator and thus be able to take advantage of all the functions that this template has.
🔴Stop Loss and 🟢Take Profit:
No need to mention that it is a Stop Loss and a Take Profit, within these functions we find the options of: fixed percentage (%), fixed price ($), ATR, especially for Stop Loss we find the Pivot Points, in addition to this, the price range between the entry and the Stop Loss can be converted into a trailing stop loss, instead, especially for the Take Profit we have an option to choose a 1:X ratio that complements very well with the Pivot Points.
📈Heikin Ashi Based Entries:
Heikin Ashi entries are trades that are calculated based on Heikin Ashi candles but their price is executed to Japanese candles, thus avoiding false results that occur in Heikin candlestick charts, this making in certain cases better results in strategies that are executed with this option compared to Japanese candlesticks.
📊Dashboard:
A more visual and organized way to see the results and necessary data produced by our strategy, among them we can see the dates between which our operations are made regardless if you have activated some time filter, usual data such as Profit, Win Rate, Profit factor are also displayed in this panel, additionally data such as the total number of operations, how many were gains and how many losses, the average profit and loss for each operation and finally the maximum profits and losses followed, which are data that will be very useful to us when we elaborate our strategies.
Feel free to use this template to program your own strategies, if you find errors or want to request a new feature let me know in the comments or through my social networks found in my tradingview profile.
| Update 1.1 | | EN |
➕Additions: '
Time sessions filter and days of the week filter added to the time filter section.
Option to add leverage to the strategy.
5 Moving Averages, RSI, Stochastic RSI, ADX, and Parabolic Sar have been added as indicators for the strategy.
You can choose from the 6 available indicators the way to trade, entry alert or entry filter.
Added the option of ATR for Take Profit.
Ticker information and timeframe are now displayed on the dashboard.
Added display customization and color customization of indicator plots.
Added customization of display and color plots of trades displayed on chart.
📝Changes:
Now when activating the time filter it is optional to add a start or end date and time, being able to only add a start date or only an end date.
Operation plots have been changed from plot() to line creation with line.new().
Indicator plots can now be controlled from the "plots" section.
Acceptable and deniable range of profit, winrate and profit factor can now be chosen from the "plots" section to be displayed on the dashboard.
Aesthetic changes in the section separations within the settings section and within the code itself.
The function that made the indicators give inputs based on heikin ashi candles has been changed, see the code for more information.
⚙️Fixes:
Dashboard label now projects correctly on all timeframes including custom timeframes.
Removed unnecessary lines and variables to take up less code space.
All code in general has been optimized to avoid the use of variables, unnecessary lines and avoid unnecessary calculations, freeing up space to declare more variables and be able to use fewer lines of code.
| Lanzamiento Inicial | | ES |
Una actualización de mi antiguo script, este script está diseñado para que pueda ser usado como una plantilla para todos aquellos traders que quieran ahorrar tiempo al programar su estrategia y hacer un backtesting de ella, teniendo funciones ya programadas que en el desarrollo normal te tomaría más tiempo programar, con esta plantilla puedes simplemente agregar tu indicador favorito y así poder aprovechar todas las funciones que tiene esta plantilla.
🔴Stop Loss y 🟢Take Profit:
No hace falta mencionar que es un Stop Loss y un Take Profit, dentro de estas funciones encontramos las opciones de: porcentaje fijo (%), precio fijo ($), ATR, en especial para Stop Loss encontramos los Pivot Points, adicionalmente a esto, el rango de precio entre la entrada y el Stop Loss se puede convertir en un trailing stop loss, en cambio, especialmente para el Take Profit tenemos una opción para elegir un ratio 1:X que se complementa muy bien con los Pivot Points.
📈Entradas Basadas en Heikin Ashi:
Las entradas Heikin Ashi son operaciones que son calculados en base a las velas Heikin Ashi pero su precio esta ejecutado a velas japonesas, evitando así́ los falsos resultados que se producen en graficas de velas Heikin, esto haciendo que en ciertos casos se obtengan mejores resultados en las estrategias que son ejecutadas con esta opción en comparación con las velas japonesas.
📊Panel de Control:
Una manera más visual y organizada de ver los resultados y datos necesarios producidos por nuestra estrategia, entre ellos podemos ver las fechas entre las que se hacen nuestras operaciones independientemente si se tiene activado algún filtro de tiempo, datos usuales como el Profit, Win Rate, Profit factor también son mostrados en este panel, adicionalmente se agregaron datos como el número total de operaciones, cuantos fueron ganancias y cuantos perdidas, el promedio de ganancias y pérdidas por cada operación y por ultimo las máximas ganancias y pérdidas seguidas, que son datos que nos serán muy útiles al elaborar nuestras estrategias.
Siéntete libre de usar esta plantilla para programar tus propias estrategias, si encuentras errores o quieres solicitar una nueva función házmelo saber en los comentarios o a través de mis redes sociales que se encuentran en mi perfil de tradingview.
| Actualización 1.1 | | ES |
➕Añadidos:
Filtro de sesiones de tiempo y filtro de días de la semana agregados al apartado de filtro de tiempo.
Opción para agregar apalancamiento a la estrategia.
5 Moving Averages, RSI, Stochastic RSI, ADX, y Parabolic Sar se han agregado como indicadores para la estrategia.
Puedes escoger entre los 6 indicadores disponibles la forma de operar, alerta de entrada o filtro de entrada.
Añadido la opción de ATR para Take Profit.
La información del ticker y la temporalidad ahora se muestran en el dashboard.
Añadido personalización de visualización y color de los plots de indicadores.
Añadido personalización de visualización y color de los plots de operaciones mostradas en grafica.
📝Cambios:
Ahora al activar el filtro de tiempo es opcional añadir una fecha y hora de inicio o fin, pudiendo únicamente agregar una fecha de inicio o solamente una fecha de fin.
Los plots de operaciones han cambiados de plot() a creación de líneas con line.new().
Los plots de indicadores ahora se pueden controlar desde el apartado "plots".
Ahora se puede elegir el rango aceptable y negable de profit, winrate y profit factor desde el apartado "plots" para mostrarse en el dashboard.
Cambios estéticos en las separaciones de secciones dentro del apartado de configuraciones y dentro del propio código.
Se ha cambiado la función que hacía que los indicadores dieran entradas en base a velas heikin ashi, mire el código para más información.
⚙️Arreglos:
El dashboard label ahora se proyecta correctamente en todas las temporalidades incluyendo las temporalidades personalizadas.
Se han eliminado líneas y variables innecesarias para ocupar menos espacio en el código.
Se ha optimizado todo el código en general para evitar el uso de variables, líneas innecesarias y evitar los cálculos innecesarios, liberando espacio para declarar más variables y poder utilizar menos líneas de código.
PowerOfStocks_5EMAThis indicator is based of Subhashish Pani's (power of stocks) 5 EMA Strategy.
It plots 5 EMA and Buy/Sell signals with Target & Stoploss levels.
What is Subhashish Pani's (power of stocks) 5 EMA Strategy :-
His strategy is very simple to understand. for intraday use 5 minutes timeframe for selling. You can sell futures, sell call or buy Puts in selling strategy.
What this strategy tries to do is , it tries to catch the tops, so when you sell at top & it turns out to be a reversal point then you can get good profit.
this will hit stop losses often, but stop losses are small and minimum target should be 1:3. but if you stay with the trend you can get big profits.
According to Subhashish Pani this strategy has 60% success rate.
Strategy for Selling (Short future/Call/stock or buy Put)
When ever a Candle closes completely above 5 ema (no part of candle should be touching the 5ema), then that candle should be considered as Alert Candle.
If the next candle is also completely above 5 ema and it has not broken the low of previous alert candle, Then the previous Alert Candle should be ignored and the new candle should be considered as new Alert Candle.
so if this goes on then continue shifting the Alert Candle, but whenever the next candle breaks the low of the Alert Candle we should take the Short trade (Short future/Call/stock or buy Put).
Stoploss will be above high of the Alert Candle and minimum target will be 1:3.
Strategy for Buying (Buy future/Call/stock or sell Put)
When ever a Candle closes completely below 5 ema (no part of candle should be touching the 5ema), then that candle should be considered as Alert Candle.
If the next candle is also completely below 5 ema and it has not broken the high of previous alert candle, Then the previous Alert Candle should be ignored and the new candle should be considered as new Alert Candle.
so if this goes on then continue shifting the Alert Candle, but whenever the next candle breaks the high of the Alert Candle we should take the Long trade (Buy future/Call/stock or sell Put).
Stoploss will be below low of the Alert Candle and minimum target will be 1:3.
Buy/Sell with extra conditions :
it just adds 1 more condition to buying/selling
1. checks if closing of current candle is lower than alert candles closing for Selling & checks if closing of current candle is higher than alert candles closing for Buyling.
This can sometimes save you from false moves but by using this, you can also miss out on big moves as you'll enter trade after candle closing instead of entering at break of high/low.
Note :- According to Subhashish Pani Timeframe for intraday buying should be 15 minutes Timeframe.
If you haven't understood the strategy by reading above description, then search for "Subhashish Pani's (power of stocks) 5 EMA Strategy" on youtube to get a deeper understanding.
Note:- This is not only for Intraday trading , you can use this strategy for Positional/Swing trading as well. If you use this on Monthly Timeframe then it can be very good for Long Term Investing as well.
Rules will be same for all types of trades & Timeframes.
[D] Dudu 95 Strategy Template ver.1.1.Hello Guys! Nice to meet you all!
This is my Second script after changing My Profile Name!
I updated my strategy template before - I added some filter conditions (EMA, ADX, DMI).
If there's something to update, I will update this script!
Thank you!
-----
I made this based on the open source strategies by jason5480, kevinmck100, myncrypto.
Thank you All!
### Filter
1. Can Choose whether to use filter.
2. Filters Based on ATR, EMA, ADX, and DMI are ready to use.
### StopLoss
1. Can Choose Stop Loss Type: Percent, ATR, Previous Low / High.
2. Can Chosse inputs of each Stop Loss Type.
### Take Profit
1. Can set Risk Reward Ratio for Take Profit.
- To simplify backtest, I erased all other options except RR Ratio.
- You can add Take Profit Logic by adding options in the code.
2. Can set Take Profit Quantity.
### Risk Manangement
1. Can choose whether to use Risk Manangement Logic.
- This controls the Quantity of the Entry.
- e.g. If you want to take 3% risk per trade and stop loss price is 6% below the long entry price,
then 50% of your equity will be used for trade.
2. Can choose How much risk you would take per trade.
### Plot
1. Added Labels to check the data of entry / exit positions.
2. Changed and Added color different from the original one. (green: #02732A, red: #D92332, yellow: #F2E313)
Elder Ray (Bull Power) TP and SL Developed by Dr Alexander Elder, the Elder-ray indicator measures buying
and selling pressure in the market. The Elder-ray is often used as part
of the Triple Screen trading system but may also be used on its own.
Dr Elder uses a 13-day exponential moving average (EMA) to indicate the
market consensus of value. Bull Power measures the ability of buyers to
drive prices above the consensus of value. Bear Power reflects the ability
of sellers to drive prices below the average consensus of value.
Bull Power is calculated by subtracting the 13-day EMA from the day's High.
Bear power subtracts the 13-day EMA from the day's Low.
WARNING:
- For purpose educate only
- This script to change bars colors.
Strategy PnL LibraryLibrary "Strategy_PnL_Library"
TODO: This is a library that helps you learn current pnl of open position and use it to create your own dynamic take profit or stop loss rules based on current level of your profit. It should only be used with strategies.
inTrade()
inTrade: Checks if a position is currently open.
Returns: bool: true for yes, false for no.
notInTrade()
inTrade: Checks if a position is currently open. Interchangeable with inTrade but just here for simple semantics.
Returns: bool: true for yes, false for no.
pnl()
pnl: Calculates current profit or loss of position after the commission. If the strategy is not in trade it will always return na.
Returns: float: Current Profit or Loss of position, positive values for profit, negative values for loss.
entryBars()
entryBars: Checks how many bars it's been since the entry of the position.
Returns: int: Returns a int of strategy entry bars back. Minimum value is always corrected to 1 to avoid lookback errors.
pnlvelocity()
pnlvelocity: Calculates the velocity of pnl by following the change in open profit compared to previous bar. If the strategy is not in trade it will always return na.
Returns: float: Returns a float value of pnl velocity.
pnlacc()
pnlacc: Calculates the acceleration of pnl by following the change in profit velocity compared to previous bar. If the strategy is not in trade it will always return na.
Returns: float: Returns a float value of pnl acceleration.
pnljerk()
pnljerk: Calculates the jerk of pnl by following the change in profit acceleration compared to previous bar. If the strategy is not in trade it will always return na.
Returns: float: Returns a float value of pnl jerk.
pnlhigh()
pnlhigh: Calculates the highest value the pnl has reached since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float highest value the pnl has reached.
pnllow()
pnllow: Calculates the lowest value the pnl has reached since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float lowest value the pnl has reached.
pnldev()
pnldev: Calculates the deviance of the pnl since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float deviance value of the pnl.
pnlvar()
pnlvar: Calculates the variance value of the pnl since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float variance value of the pnl.
pnlstdev()
pnlstdev: Calculates the stdev value of the pnl since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float stdev value of the pnl.
pnlmedian()
pnlmedian: Calculates the median value of the pnl since the start of the current position. If the strategy is not in trade it will always return na.
Returns: float: Returns a float median value of the pnl.
Crypto BTC Correlation Scalper Gaps StrategyThis strategy is based on the gaps theory.
In this case we have the BTC futures from CME, which acts in a way similar to stocks, and we can have gaps present between close/open session, and also sometimes between same candle due to huge movements intra candle.
At the same time I have combined this with a daily moving average, to help out a bit with the trend, since we are looking at small timeframe like 1-15/30min .
On top of that we have a reverse option, where long = short and viceversa, which can be used with against BTC pairs .
Rule are simple:
For long, we have a long gap and the close of the correlated candle is above daily sma
For short, we have a short gap and the close of the correlated candle is below daily sma
For exit:
For exit, we take the highest highest values for short entry TP, meaning we get the different from the HH and rest the current open candle distance, and use that distance as a TP.
At the same time for long entry, we take the lowest low value and rest current close of the candle to that value, and we get the TP.
Can also be applied this logic for SL aswell but from the test I have found out that exiting based on a reverse condition(when tp is not being hit), gives better results/dd overall.
If you have any questions, please let me know !
LarryWillians - Simple StrategyA simple and classic strategy on market, created by LarryWillians using a EMA9.
The brute model use a Cross from closing price on EMA9. But occurs many false entries.
In other to correct this kind of thing, I add a SMA21 to confirm the trend and decrease numbers of false trades.
The strategy waits to break the last High (for buy) a position.
As a strategy requires a Risk Mannager, I created a simple way to trailing this, as well a Take Proft and Stop Loss in %.
Is not the best strategy but, is one of the most famous on financial markets. I did my adaptive version as simples as it is :)
Faytterro Estimator StrategyWhat is "Faytterro Estimator Strategy"?
"Faytterro Estimator Strategy" is strategy of faytterro estimator. if you want to know more about faytterro estimator:
What it does?
It trades according to the signals given by faytterro estimator and some additional restrictions.
How it does it?
Using the faytterro estimator and the following variables, it gives buy and sell signals in different sizes at ideal points.
How to use it?
The "source" part is used to change the source of faytterro estimator.
The "length" is the length of the fayterro estimator.
"Minimum entry-close gap" is the minimum distance between two transactions opened in opposite directions. For example, if you opened long at 20 500 and "Minimum entry-close gap" is 400, you will not receive a sell signal before the price goes above 20900.
If "minimum entry-entry gap" is the minimum difference between two transactions opened in the same direction. For example, if you open long at 20500 level and the "minimum entry-entry gap" is 400, you will not receive a "buy" signal before the price goes below the 20100 level.
"strong entry size" determines the size of strong signals. The size of ordinary signals is always 1.
note: default values for btc/usdt 1 hour timeframe.
Open High Low StrategyThis is a very simple, yet effective and to some extend widely followed scalping strategy to capture the underling sentiments of the counter whether it will go up or down.
What is it?
This is Open-High-Low (OLH) strategy.
As you already aware of Candlestick patterns, there is patterns called as Marubozu patterns where the sell wick or buy wick either ceases to exists (or very small). This is exactly in the same principle.
In OLH strategy: The buy signal appears when the Open Price is the Low Price. It means if you draw the candlestick, there is no bottom wick. So after the opening of the candle, the demand drives the price up to the level, some selling may or may not come and closes in green. This indicates a strong upward biasness of the underlying counter.
Similarly, a sell signal appears when the Open price is the High Price. It means there is no upper wick. So there is no buying pressure, since the opening of the candle, sellers are in force and pulls down the price to a closing.
This strategy generates the signal at the close of the candle (technically barstate.isconfirmed). Because until the bar is real-time there is no option to know the final closing or high. So you will see the bar on which it generates the buy or sell signal is actually indicates the previous bar as OLH bar.
To determine the Stop-Loss, it uses the most widely known SL calculation of:
For buy signal, it takes the low of the last 7 candles and substract the ATR (Average True Range) of 14-period.
For sell signal, it takes the high of the last 7 candles and add it to the ATR (Average True Range) of 14-period.
One can plot the SL lines as dotted green and red lines as well to see visually.
Default Risk:Reward is 1:2, Can be customizable.
What is Unique?
Of course the utter simplistic nature of this strategy is it's key point. Very easy and intuitive to understand.
There are awesome strategies in this forum that talks about the various indicators combinations and what not.
Instead of all this, in a 15m NSE:NIFTY chart, it generates a good ~ 47% profit-factor with 1:2 Risk Reward ratio. Means if you loose a trade you will loose 1% of account and if you win you will gain 2%. Means 3 trades (2 profits and 1 loss) in a trading session result 3% overall gain for the day. (Assuming you are ready with 1% draw down of your account per trade, at max).
Disclaimer:
This piece of software does not come up with any warrantee or any rights of not changing it over the future course of time.
We are not responsible for any trading/investment decision you are taking out of the outcome of this indicator.
Volatility Stop with Vwap StrategyFirst the credits goes to @TradingView for their release of the volatility stop mtf indicator.
I have took it, and inside I have added a weekly vwap for a better trend direction and at the same time I have added a dynamic risk managment which is calculated from the distance between the volatility line to the close of the candle.
The rules for entry are simple:
For long:We enter when our close of the candle is above the volatility stop line and at the same time the close of the candle is above weekly vwap
For short we enter when our close of the candle is below the volatility stop line and at the same time the close of the candle is below weekly vwap.
We exit when we either have a reverse signal than the one we enterred, or based on the TP/SL which is calculated with the distance from vwap to the close of the candle.
If you have any questions please let me know !
SMA_EMA_CPR_PivotThis Script can do multiple jobs in single indicator.
Like -:
Plot 3 SMA as per your inputs.
Plot 3 EMA as per your inputs.
Plot CPR Levels.
Plot Pivot Levels.
Plot Previous Day High Low.
Indicator can used in Intraday stock trading, Positional Trading and options trading.
Please Enjoy.