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
Educational
Je Buurmans Simple Manual EntriesIf ever in need for a quick way to swiftly check some random trades
or brag to your 'friends'/buddies/pals/haters/followers/the_crowd with fabricated winnings ..
This Script is for you.
Either set the entry and exit dates for a maximum of up to 10 trades (either Long or Short) via Menu
or simply drag the 'handler' to the desired time/date.
Next fill in how many shares/contracts to enter and/or exit
There is some Visual Feedback as well.
(initially written specifically for someone .. now free for grabs)
Pure Mark Minervini 10%TP 5%CLBacktesting Mark Miniverni Template
By Donnie Lee
Overall, a good basic guideline from Mark Miniverni to choose which stock to buy. His selection are said to be stocks in stage 2 uptrend phase which could see price surge soon.
This script enable backtesting of Mark template (Investor's Business Ranking Excluded) on equity like stocks
Further fine tuning with additional filters are needed to find good entry with desired cut loss level and position sizing.
There is no holy grail strategy. Choose one with an edge that you are comfortable with and stick to it.
Losing is part and parcel of trading. Hesitation to cut loss can lead to big loss. And if you can avoid losing big, you might stand a chance to profit in the end.
Mark Miniverni Template
1. The current stock price is above both the 150-day (30-week) and the 200-day (40-week) moving average price lines.
2. The 150-day moving average is above the 200-day moving average.
3. The 200-day moving average line is trending up for at least 1 month (preferably 4–5 months minimum in most cases).
4. The 50-day (10-week) moving average is above both the 150-day and 200-day moving averages.
5. The current stock price is trading above the 50-day moving average.
6. The current stock price is at least 25% above its 52-week low (30% as per his book 'Trade Like a Stock Market Wizard').
7. The current stock price is within at least 25% of its 52-week high (the closer to a new high the better).
Backtests Are BrokenThis script demonstrates a fatal flaw with Trading View backtests involving trailing stops. Trading View assumes the most optimistic case for trailing stops, always giving you the best case high/low of a bar instead of the worst or average case. Within a bar, the price could reverse against your position after the open and trigger your trailing stop for a loss before the price goes in your favor, but Trading View backtests do not consider this and instead always give you the best case returns. This allows a trivial strategy to appear as though it would perform miracles.
This strategy enters on a random bar and sets a trailing stop triggered one tick better than the current price with 0 trailing distance. Trading View then generously gives this strategy the difference between the open price and best possible wick as a profit. The only way this strategy can lose money in simulation is if the price goes straight down after entry and never retraces. It works on all symbols on all timeframes due to this systematic problem with the Trading View backtester.
Trading range display with BoxThis script is just for reference to see the trading range.
Do not use this strategy logic, it is just Test strategy.
The trading range is colored depending on whether it is profitable or not.
You can change the color if you want.
When you declare the strategy, put (process_orders_on_close=true,calc_on_every_tick=true, max_boxes_count=500) in your script.
Then it can show you current open trading as well.
If you use switching strategy (e.g longposition to shortposition right away), it may not show you the range properly.
In that case, reduse the test period.
IT IS Repainting Reference.
If you want to see your strategy result visually,
Just copy and paste from line 22 in my script.
Good Luck everyone.
전략 거래 기간 동안을 보여주는 지표입니다.
이 지표에 쓰인 전략은 단순 테스트용 입니다. 절대 사용하지 마세요.
각 거래기간은 수익이냐 아니냐에 따라 색깔이 정해 집니다.
색깔은 여러분이 변경하실 수 있습니다.
전략을 선언부에 process_orders_on_close=true,calc_on_every_tick=true, max_boxes_count=500 을 넣으시면 현재 오픈 거래도 보실 수 있습니다.
스위칭 전략(롱에서 숏으로 바로 전환하는 전략)을 쓰시는 분들은 아마 테스트 기간을 줄이라는 경고를 받으실 수 있습니다.
이 지표는 리페이팅이 될 수 있습니다.
전략 결과를 눈으로 보고 싶으신 분들은 22번째 줄 부터 카피하시면 됩니다.
행운이 있길..
---strategy set---
default_qty_value=10
commission_value=0.04
slippage=2
[Sniper] SuperTrend + SSL Hybrid + QQE MODHi. I’m DuDu95.
**********************************************************************************
This is the script for the series called "Sniper".
*** What is "Sniper" Series? ***
"Sniper" series is the project that I’m going to start.
In "Sniper" Series, I’m going to "snipe and shoot" the youtuber’s strategy: to find out whether the youtuber’s video about strategy is "true or false".
Specifically, I’m going to do the things below.
1. Implement "Youtuber’s strategy" into pinescript code.
2. Then I will "backtest" and prove whether "the strategy really works" in the specific ticker (e.g. BTCUSDT) for the specific timeframe (e.g. 5m).
3. Based on the backtest result, I will rate and judge whether the youtube video is "true" or "false", and then rate the validity, reliability, robustness, of the strategy. (like a lie detector)
*** What is the purpose of this series? ***
1. To notify whether the strategy really works for the people who watched the youtube video.
2. To find and build my own scalping / day trading strategy that really works.
**********************************************************************************
*** Strategy Description ***
This strategy is from " QQE MOD + supertrend + ssl hybrid" by korean youtuber "코인투데이".
"코인투데이" claimed that this strategy will make you a lot of money in any crypto ticker in 15 minute timeframe.
### Entry Logic
1. Long Entry Logic
- Super Trend Short -> Long
- close > SSL Hybrid baseline upper k
- QQE MOD should be blue
2. Short Entry Logic
- Super Trend Long -> Short
- close < SSL Hybrid baseline lower k
- QQE MOD should be red
### Exit Logic
1. Long Exit Logic
- Super Trend Long -> Short
2. Short Entry Logic
- Super Trend Short -> Long
### 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)
3. SuperTrend and SSL Hybrid Baseline is by default drawn on the chart.
4. If you check EMA filter, EMA would be drawn on the chart.
5. Should add QQE MOD indicator manually if you want to see QQE MOD.
**********************************************************************************
*** Rating: True or False?
### Rating:
→ 3.5 / 5 (0 = Trash, 1 = Bad, 2 = Not Good, 3 = Good, 4 = Great, 5 = Excellent)
### True or False?
→ True but not a 'perfect true'.
→ It did made a small profit on 15 minute timeframe. But it made a profit so it's true.
→ It worked well in longer timeframe. I think super trend works well so I will work on this further.
### Better Option?
→ Use this for Day trading or Swing Trading, not for Scalping. (Bigger Timeframe)
→ Although the result was not good at 15 minute timeframe, it was quite profitable in 1h, 2h, 4h, 8h, 1d timeframe.
→ Crypto like BTC, ETH was ok.
→ The result was better when I use EMA filter.
### Robust?
→ Yes. Although result was super bad in 5m timeframe, backtest result was "consistently" profitable on longer timeframe (when timeframe was bigger than 15m, it was profitable).
→ Also, MDD was good under risk management option on.
**********************************************************************************
*** Conclusion?
→ I recommend you not to use this on short timeframe as the youtuber first mentioned.
→ In my opinion, I can use on longer timeframe like 2h or bigger with EMA filter, stoploss and risk management.
[Sniper] SSL Hybrid + QQE MOD + Waddah Attar StrategyHi. I’m DuDu95.
**********************************************************************************
This is the script for the series called "Sniper".
*** What is "Sniper" Series? ***
"Sniper" series is the project that I’m going to start.
In "Sniper" Series, I’m going to "snipe and shoot" the youtuber’s strategy: to find out whether the youtuber’s video about strategy is "true or false".
Specifically, I’m going to do the things below.
1. Implement "Youtuber’s strategy" into pinescript code.
2. Then I will "backtest" and prove whether "the strategy really works" in the specific ticker (e.g. BTCUSDT) for the specific timeframe (e.g. 5m).
3. Based on the backtest result, I will rate and judge whether the youtube video is "true" or "false", and then rate the validity, reliability, robustness, of the strategy. (like a lie detector)
*** What is the purpose of this series? ***
1. To notify whether the strategy really works for the people who watched the youtube video.
2. To find and build my own scalping / day trading strategy that really works.
**********************************************************************************
*** Strategy Description ***
This strategy is from "SSL QQE MOD 5MIN SCALPING STRATEGY" by youtuber "Daily Investments".
"Daily Investments" claimed that this strategy will make you some money from 100 trades in any ticker in 5 minute timeframe.
### Entry Logic
1. Long Entry Logic
- close > SSL Hybrid Baseline.
- QQE MOD should turn into blue color.
- Waddah Attar Explosion indicator must be green.
2. Short Entry Logic
- close < SSL Hybrid Baseline
- QQE MOD should turn into red color.
- Waddah Attar Explosion indicator must be red.
### Exit Logic
1. Long Exit Logic
- When QQE MOD turn into red color.
2. Short Entry Logic
- When QQE MOD turn into blue color.
### 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)
3. SSL Hybrid Baseline is by default drawn on the chart.
4. If you check EMA filter, EMA would be drawn on the chart.
5. Should add QQE MOD and Waddah Attar Explosion indicator manually if you want to see QQE MOD.
**********************************************************************************
*** Rating: True or False?
### Rating:
→ 1.5 / 5 (0 = Trash, 1 = Bad, 2 = Not Good, 3 = Good, 4 = Great, 5 = Excellent)
### True or False?
→ False
→ Doesn't Work on 5 minute timeframe. Also, it doesn't work on crypto.
### Better Option?
→ Use this for Day trading or Swing Trading, not for Scalping. (Bigger Timeframe)
→ Although the result was bad at 5 minute timeframe, it was profitable in 1h, 2h, 4h, 8h, 1d timeframe.
→ BTC, ETH was ok.
→ The result was better when I use EMA filter (only on longer timeframe).
### Robust?
→ So So. Although result was bad in short timeframe (e.g. 30m 15m 5m), backtest result was "consistently" profitable on longer timeframe.
→ Also, MDD was not that bad under risk management option on.
**********************************************************************************
*** Conclusion?
→ Don't use this on short timeframe.
→ Better use on longer timeframe with filter, stoploss and risk management.
[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.
[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)
[DuDu95] SSL 4C MACD Laugerre RSI StrategyHello Guys! Nice to meet you all!
Before I start, my nickname has changed to 'DuDu95'!!
This is the Strategy introduced by youtube channel.
I made this based on the open source indicator by kevinmck100, vkno422, KivancOzbilgic. Thank you All!
### Entry Logic
1. Long Entry Logic
- close > SSL Hybrid baseline upper k (keltner channel)
- macd signal > 0 and current MACD value > previous MACD value
- Laguerre RSI < overbought Line.
2. short Entry Logic
- close < SSL Hybrid baseline lower k (keltner channel)
- macd signal < 0 and current MACD value < previous MACD value
- Laguerre RSI > overbought Line.
### Exit Logic
1. Long Exit Logic
- close < SSL Hybrid baseline lower k (keltner channel)
- macd signal < 0
2. short Entry Logic
- close > SSL Hybrid baseline upper k (keltner channel)
- macd signal > 0
### 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)
RSI Buy & Sell Trading ScriptThis is my first attempt at a trading script using the RSI indicator for Buy & Sell signals (so please be nice but would appreciate any constructive comments).
Starting with $100 initial capital and using 10% per trade
You can select which month the backtesting starts
There is also a monthly table (sorry can’t remember who I got this from) that shows the total monthly profits, but you’ll need to turn it on by going into settings, Properties and in the Recalculate section tick the “On every tick” box
It should do the following:
Open Buy order if the RSI > 68 and the current Moving Average is greater than the previous Moving average
• TP1 = 50% of Order at 0.4%
• TP2 = 50% of order at 0.8%
• SL = 2% below entry
• Close Buy order if the RSI < 30
Open Sell order if the RSI < 28 and the current Moving Average is less than the previous Moving average
• TP1 = 50% of Order at 0.4%
• TP2 = 50% of order at 0.8%
• SL = 2% above entry
• Close Buy order if the RSI < 60
I would like to build on this if you have any ideas/ code that could help like the following:
• Move the SL to break even when it hits TP1
• Move the SL to TP1 when TP2 hits
• Moving take profit code so I can let the some of the trade stay in play (activate if it hits 1% profit and close trade if price retracts 0.5%)
[fpemehd] Strategy TemplateHello Guys! Nice to meet you all!
This is my fourth script!
This is the Strategy Template for traders who wants to make their own strategy.
I made this based on the open source strategies by jason5480, kevinmck100, myncrypto. Thank you All!
### 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)
[fpemehd] SSL Baseline StrategyHello Guys! Nice to meet you all!
This is my third script!
This Logic is trend following logic, This detects long & short trends based on SSL Hybrid Baseline.
This fits to the longer time frame like 4hr and 1d.
### Long Condition
1. close > SSL Hybrid baseline upper k
- Baseline is the ma of close price. (You can choose ma type and length)
- Upper k is the upper Keltner Channel.
### Short Condition
1. close < SSL Hybrid baseline lower k
- Baseline is the ma of close price. (You can choose ma type and length)
- Lower k is the lower Keltner Channel.
### Etc
1. Added Stoploss based on highest high or lowest low with lookback.
2. Strategy Template is based on @kevinmck100 template. Thank you!
Fake StrategyTHIS IS A FAKE STRATEGY. PLEASE DO NOT USE THIS FOR TRADING.
Just publishing this to display how easily you can fake backtest results in the strategies. However, there are ways to identify the scams. Let's discuss about major red herrings in a strategy. How to identify them and stay away from them.
Any strategy which proclaims significantly high win rate (such as this) are not practical and can only be achieved via following means
Significantly high risk compared to reward
Trades are set in such a way that profits are taken in small movement whereas stops are significantly farther. By doing this, win rate will surely increase. But, will be picking pennies by risking plenty of capital. General trait of such strategies can be identified by comparing average trade and max drawdown . These kind of strategies will have significantly higher drawdown even though the number of losses are less. For example, 1 losing trade leading to drawdown of 10+% whereas every winning only contributes 0.25%.
We can also see this kind of behaviour in option selling strategies such as 0 and 1 DTE option selling strategies. Here too probability of winning can be pretty high (north of 90%). But, on every winning, you make 1-2% of your capital however on remaining trades, you will lose your complete capital - which leads to overall losing position.
Inducing repainting through code
This strategy is an excellent example of how repainting can be induced via code using request.securities method. There are plenty of ways a strategy or code can be made to repaint. Tradingview user manual has lots of information about repainting. Feel free to read through if you have extra time. If you look at this code, it is very simple to induce repainting in a strategy to make it look like an infinite money printing machine.
High Leverage and lack of usage of margin
Using leverage in pine can show false results. This is because, the strategy engine will not stop when equity goes below 0% until the trade is closed. But, that does not happen in real life. This is the reason why using leverage along with high risk and low reward trades can show false results overall making it look like the strategy is unbeatable. But, when you try to use that in real time, it is likely that account will be blown out.
To understand leverage conditions, please have a look at the strategy property fields - Order Size, Pyramiding, Commission, Slippage, Margin Long/Short.
Curve fitting
If the author claims that strategy will only work on particular set of instrument and particular timeframe, then the strategy is not real. It is curve fitting. Knowingly/Unknowingly author has moulded his strategy to fit what has happened in the past. This is general issue even non malicious author go through. It is very much essential to test the strategy across various set of instruments and timeframes to understand the real capability. Use back-testing as test cases. More test cases you have, more bug free your strategy will be. There are many methods to understand curve fitting and perform better testing of the strategy in hand which can be studied and implemented by authors.
Significantly short trades - a sign of lack of strategy
A strategy built using pine in general work on close of candle. So, all the calculations generally happen upon close of the candle. You can force intra-bar calculations using bar magnifier. But, that is not equivalent to tick data. Due to this reason, I consider any trade happening within a bar (Meaning open and close within the same bar) as not reliable. This is because, it is not possible for strategy back-tester to know whether entry condition is satisfied first or exit in a completely foolproof way. Bar magnifier can help reduce this issue - but will not eradicate this problem completely. If there are lots of trades in a strategy - which are closing within the same bar, this is very likely that the strategy backtest results are not reliable.
Hope this helps at least some people to understand the scams and stay away from it.
Tick StrategyTick Strategy:
Questions many pine coders/traders have is, How to enter/exit trade as soon as trade condition is met i.e. do not wait till candle completion to enter/exit the trade. This strategy will help you to understand one of the way to achieve it.
This is an educational strategy to demonstrate, how one can trade based on tick data. This being a strategy based on tick data, it can be tested only on real time candles. This strategy will not take any trades on historical candles and cannot be used for back testing. All the strategy trades taken on real time candles will disappear (repainting) once chart is refreshed and new trades will be entered on real time candles.
The strategy will do nothing during off market hours and will not take any trades.
The strategy has been designed based on rules/inputs below:
1. Count the ticks from start of a candle till end of candle
2. Bifurcate ticks as up-ticks and down-ticks. If tick price is above previous tick price the tick is considered as up-tick and vice versa
3. Count the successive up-ticks and successive down-ticks
Strategy rules:
1. Track candle type (green or red) continuously on each tick (green candle is when latest tick price > previous tick price)
2. Take a long trade if work in progress (WIP) candle is green candle and we get successive up-ticks equal to user input ticks for trade
3. Take a short trade if work in progress (WIP) candle is red candle and we get successive down-ticks equal to user input ticks for trade
4. Exit the trade when we get successive ticks equal to user input ticks in opposite direction
5. Optionally for trade entry, user can decide whether to calculate successive up-ticks/down-ticks from beginning of candle or successive up-ticks/down-ticks anytime during the candle formation
6. Optionally for trade exit/square off, user can decide whether to apply exit rules on the entry candle or only from subsequent candle
Strategy setting:
1. '' – This is just to describe when trades are entered. This parameter is not used for any calculation
2. 'No of successive ticks to enter the trade' – User input to decide, number of successive ticks for trade entry
3. 'Count successive ticks for trade only from start of candle' – check this to count successive ticks only from beginning of a candle
4. 'Exit if succussive ticks in opposite direction' - User input to decide, number of successive ticks in opposite direction for exiting the trade
5. 'Apply exit criteria on entry candle' – check to allow exit of trade on the entry candle, if un-checked, trade will not be exited on the entry candle i.e. opposite direction ticks will be counted from subsequent candle
Information below will be displayed continuously on the chart:
1. Candle no – Candles are counted from start of the trading session. This is current candle being formed on the chart
2. Candle now – This shows either ‘Green’ or ‘Red’ based on type of candle being formed
3. Tick count – This is current tick number being processed. Tick number starts from 1 for each new candle
4. Up-tick count – Number of up-ticks during formation of current candle
5. Down-tick count – Number of down-ticks during formation of current candle
6. Successive up-ticks – Current successive up-tick count
7. Successive down-ticks – Current successive down-tick count
8. Up-tick volume – Volume associated with up-ticks
9. Down-tick volume – Volume associated with down-ticks
10. Up-tick volume % - This is % of volume associated with up-ticks
11. Total volume – Candle volume till now. (Some times you might observe small difference between total volume and the volume shown by volume indicator. The difference could be because of refresh rate of your screen)
12. Candle completion % - This shows current candles completion %. This is candle progress from start of candle till close of candle
GT 5.1 Strategy═════════════════════════════════════════════════════════════════════════
█ OVERVIEW
People often look an indicator in their technical analysis to enter a position. We may also need to look at the signals of one or more indicators to verify the signals given by some indicators. In this context, I developed a strategy to test whether it really works by choosing some of the indicators that capture trend changes with the same characteristics. Also, since the subject is to catch the trend change, I thought it would be right to include an indicator using the heikin ashi logic. By averaging and smoothing the market noise, Heiken Ashi makes it easier to detect the direction of the trend helps to see possible reversal points on the chart. However, it should be noted that Heiken Ashi is a lagging indicator.
I picked 5 different indicators (but their purpose are similar) and combined them to produce buy and sell signals based on your choice(not repaint). First of all let's get some information about our indicators. So you will understand me why i picked these indicators and what is the meaning of their signals.
1 — Coral Trend Indicator by LazyBear
Coral Trend Indicator is a linear combination of moving averages, all obtained by a triple or higher order exponential smoothing. The indicator comes with a trend indication which is based on the normalized slope of the plot. the usage of this indicator is simple. When the color of the line is green that means the market is in uptrend. But when the color is red that means the market is in downtrend.
As you see the original indicator it is simple to find is it in uptrend or downtrend.
So i added a code to find when the color of the line change. When it turns green to red my script giving sell signals, when it turns red to green it gives buy signals.
I hide the candles to show you more clearly what is happening when you choose only Coral Strategy. But sometimes it is not enough only using itself. Even if green dots turn to red it continues in uptrend. So we need a to look another indicator to approve our signal.
2 — SSL channel by ErwinBeckers
Known as the SSL , the Semaphore Signal Level channel is an indicator that combines moving averages to provide you with a clear visual signal of price movement dynamics. In short, it's designed to show you when a price trend is forming. This indicator creates a band by calculating the high and low values according to the determined period. Simply if you decide 10 as period, it calculates a 10-period moving average on the latest 10 highs. Calculate a 10-period moving average on the latest 10 lows. If the price falls below the low band, the downtrend begins, if the price closes above the high band, the uptrend begins. Lets look the original form of indicator and learn how it using.
If the red line is below and the green band is above, it means that we are in uptrend, and if it is on the opposite side, it means that we are in downtrend. Therefore, it would be logical to enter a position where the trend has changed. So i added a code to find when the crossover has occured.
As you see in my strategy, it gives you signals when the trend has changed. But sometimes it is not enough only using this indicator itself. So lets look 2 indicator together in one chart.
Look circle SSL is saying it is in downtrend but Coral is saying it has entered in uptrend. if we just look to coral signal it can misleads us. So it can be better to look another indicator for validating our signals.
3 — Heikin Ashi RSI Oscillator by JayRogers
The Heikin-Ashi technique is used by technical traders to identify a given trend more easily. Heikin-Ashi has a smoother look because it is essentially taking an average of the movement. There is a tendency with Heikin-Ashi for the candles to stay red during a downtrend and green during an uptrend, whereas normal candlesticks alternate color even if the price is moving dominantly in one direction. This indicator actually recalculates the RSI indicator with the logic of heikin ashi. Due to smoothing, the bars are formed with a slight lag, reflecting the trend rather than the exact price movement. So lets look the original version to understand more clearly. If red bars turn to green bars it means uptrend may begin, if green bars turn to red it means downtrend may begin.
As you see HARSI giving lots of signal some of them is really good but some of them are not very well. Because it gives so much signals Now i will change time period and lets look same chart again.
Now results are better because of heikin ashi's logic. it is not suitable for day traders, it gives more accurate result when using the time period is longer. But it can be useful to use this indicator in short time periods using with other indicators. So you may catch the trend changes more accurately.
4 — MACD DEMA by ToFFF
This indicator uses a double EMA and MACD algorithm to analyze the direction of the trend. Though it might seem a tough task to manage the trades with the help of MACD DEMA once you know how the proper way to interpret the signal lines, it will be an easy task.
This indicator also smoothens the signal lines with the time series algorithm which eventually makes the higher time frame important. So, expecting better results in the lower time frame can result in big losses as the data reading from the MACD DEMA will not be accurate. In order to understand the function of this indicator, you have to know the functions of the EMA also.
The exponential moving average tends to give more priority to the recent price changes. So, expecting better results when the volatility is very high is a very risky approach to trade the market. Moreover, the MACD has some lagging issues compared to the EMA, so it is super important to use a trading method that focuses on the higher time frame only. What does MACD 12 26 Close 9 mean? When the DEMA-9 crosses above the MACD(12,26), this is considered a bearish signal. It means the trend in the stock – its magnitude and/or momentum – is starting to shift course. When the MACD(12,26) crosses above the DEMA-9, this is considered a bullish signal. Lets see this indicator on Chart.
When the blue line crossover red line it is good time to buy. As you see from the chart i put arrows where the crossover are appeared.
When the red line crossover blue line it is good time to sell or exit from position.
5 — WaveTrend Oscillator by LazyBear
This is a technical indicator that creates high and low bands between two values. It then creates a trend indicator that draws waves with highs and lows within these boundaries. WaveTrend is a widely used indicator for finding direction of an asset.
Calculation period: number of candles used to calculate WaveTrend, defaults to 10. Averaging period: number of candles used to average WaveTrend, defaults to 21.
As you see in chart when the lines crossover occured my strategy gives buy or sell signals.
═════════════════════════════════════════════════════════════════════════
█ HOW TO USE
I hope you understand how the indicators I mentioned above work and what they are used for. Now, I will explain in detail how to use the strategy I have created.
When you enter the settings section, you will see 5 types of indicators. If you want to use the signals of the indicators, simply tick the box next to the indicators. Also, under each option there is an area where you can set the "lookback". This setting is a field that will make the signals overlap when you select more than one option. If you are going to trade with only one option, you should make sure that this field is 0. Otherwise, it may continue to generate as many signals as you choose.
Lets see in chart for easy understanding.
As you see chart, if i chose only HARSI with lookback 0 (HARSI and CORAL should be 1 minumum because of algorithm-we looking 1 bar before, others 0 because we are looking crossovers), it will give signals only when harsı bar's color changed. But when i changed Lookback as 7 it will be like this in chart.
Now i will choose 2 indicator with settings of their lookback 0.
As you see it will give signals when both of them occurs same time. But HARSI is an indicator giving very early signal so we can enter position 5-6 bars after the first bar color change. So i will change HARSI Lookback settings as 7. Lets look what happens when we use lookback option.
So it wil be useful to change lookback settings to find best signals in each time period and in each symbol. But it shouldnt be too high. Because you can be late to catch trend's starting.
this is an image of MACD and WAVE trend used and lookback option are both 6.
Now lets see an example with 3 options are chosen with lookback option 11-1-5
Now lets talk about indicators settings. After strategy options you will see each indicators settings, you can change their settings as you desired. So each indicators signal will be changed according to your adjustment.
I left strategy options with default settings. You can change it manually as if you want.
═════════════════════════════════════════════════════════════════════════
█ LIMITATIONS: Don't rely on non-standard charts results. For example Heikin Ashi is a technical analysis method used with the traditional candlestick chart.Heikin Ashi vs. Candlestick Chart: The decisive visual difference between Heikin Ashi and the traditional chart is that Heikin Ashi flattens the traditional candlestick chart using a modified formula.
The primary advantage of Heikin Ashi is that it makes the chart more reader-friendly and helps users identify and analyze trends .
Because Heikin Ashi provides averaged price information rather than real-time price and reacts slowly to volatility — not suitable for scalpers and high-frequency traders. I added HARSI indicator as a supportive signal because it is useful with using CORAL and SSL channel indicators. If you change your candle types to Heikin Ashi , your profit will change in good way but dont rely on it.
═════════════════════════════════════════════════════════════════════════
█ THANKS:
Special thanks to authors of the scripts that i used.
@LazyBear and @ErwinBeckers and @JayRogers and @ToFFF
═════════════════════════════════════════════════════════════════════════
█ DISCLAIMER
Any trade decisions you make are entirely your own responsibility.
Bollinger Pair TradeNYSE:MA-1.6*NYSE:V
Revision: 1
Author: @ozdemirtrading
Revision 2 Considerations :
- Simplify and clean up plotting
Disclaimer: This strategy is currently working on the 5M chart. Change the length input to accommodate your needs.
For the backtesting of more than 3 months, you may need to upgrade your membership.
Description:
The general idea of the strategy is very straightforward: it takes positions according to the lower and upper Bollinger bands.
But I am mainly using this strategy for pair trading stocks. Do not forget that you will get better results if you trade with cointegrated pairs.
Bollinger band: Moving average & standard deviation are calculated based on 20 bars on the 1H chart (approx 240 bars on a 5m chart). X-day moving averages (20 days as default) are also used in the background in some of the exit strategy choices.
You can define position entry levels as the multipliers of standard deviation (for exp: mult2 as 2 * standard deviation).
There are 4 choices for the exit strategy:
SMA: Exit when touches simple moving average (SMA)
SKP: Skip SMA and do not stop if moving towards 20D SMA, and exit if it touches the other side of the band
SKPXDSMA: Skip SMA if moving towards 20D SMA, and exit if it touches 20D SMA
NoExit: Exit if it touches the upper & lower band only.
Options:
- Strategy hard stop: if trade loss reaches a point defined as a percent of the initial capital. Stop taking new positions. (not recommended for pair trade)
- Loss per trade: close position if the loss is at a defined level but keeps watching for new positions.
- Enable expected profit for trade (expected profit is calculated as the distance to SMA) (recommended for pair trade)
- Enable VIX threshold for the following options: (recommended for volatile periods)
- Stop trading if VIX for the previous day closes above the threshold
- Reverse active trade direction if VIX for the previous day is above the threshold
- Take reverse positions (assuming the Bollinger band is going to expand) for all trades
Backtesting:
Close positions after a defined interval: mark this if you want the close the final trade for backtesting purposes. Unmark it to get live signals.
Use custom interval: Backtest specific time periods.
Other Options:
- Use EMA: use an exponential moving average for the calculations instead of simple moving average
- Not against XDSMA: do not take a position against 20D SMA (if X is selected as 20) (recommended for pairs with a clear trend)
- Not in XDSMA 1 DEV: do not take a position in 20D SMA 1*standart deviation band (recommended if you need to decrease # of trades and increase profit for trade)
- Not in XDSMA 2 DEV: do not take a position in 20D SMA 2*standart deviation band
Session management:
- Not in session: Session start and end times can be defined here. If you do not want to trade in certain time intervals, mark that session.(helps to reduce slippage and get more realistic backtest results)
SUPPORT RESISTANCE STRATEGY [5MIN TF]A SUPPORT RESISTANCE BREAKOUT STRATEGY for 5 minute Time-Frame , that has the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above Resistance Level ,indicated by Red Line, is a Long condition.
2) Price crosses below Support Level ,indicated by Green Line , is a Short condition.
3) Candle high crosses above ema1, is a part of the Long condition .
4) Candle low crosses below ema1, is a part of the Short condition .
5) Volume Threshold is an added confirmation for long/short positions.
6) Maximum Risk per trade for the intraday trade can be changed .
7) Default qty size is set to 50 contracts , which can be changed under settings → properties → order size.
8) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
→ L_Bars ———————————> Length of Resistance / Support Levels.
→ R_Bars ———————————> Length of Resistance / Support Levels.
→ Volume Break ———————> Volume Breakout from range to confirm Long/Short position.
→ Price Cross Ema —————> Added condition as explained above (3) and (4).
→ ATR LONG —————————> ATR stoploss trail for Long positions.
→ ATR SHORT ————————> ATR stoploss trail for Short positions.
→ RISK ————————————> Maximum Risk per trade intraday.
The strategy was back-tested on TCS ,the input values and the results are mentioned under "BACKTEST RESULTS" below.
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 50 contracts , which can be changed under
Settings
↓
Properties
↓
Order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 27.
The Indian Markets open at 9:15am and closes at 3:30pm.
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm , at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 92 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 100 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better Back-Test results.
The strategy applied to NSE:TCS ( 5 min Time-Frame and contract size 50) gives us 60% profitability , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.8 ,net Profit of 30,000 Rs profit .
Sharpe Ratio : 0.49
Sortino Ratio : 1.4
The graph has a Linear Curve with Consistent Profits.
The INPUTS are as follows,
1) L_Bars —————————> 4
2) R_Bars —————————> 4
3) Volume Break ————> 5
4) Price Cross Ema ——> 100
5) ATR LONG ——————> 2.4
6) ATR SHORT —————> 2.6
7) RISK —————————> 2000
8) Default qty size ——> 50
NSE:TCS
Save it to favorites.
Apply it to your charts Now !!
Thank You ☺ NSE:TCS
PIVOT STRATEGY [INDIAN MARKET TIMING]
A Back-tested Profitable Strategy for Free!!
A PIVOT INTRADAY STRATEGY for 5 minute Time-Frame , that also explains the time condition for Indian Markets
The Timing can be changed to fit other markets, scroll down to "TIME CONDITION" to know more.
The commission is also included in the strategy .
The basic idea is when ,
1) Price crosses above ema1 ,indicated by pivot highest line in green color .
2) Price crosses below ema1 ,indicated by pivot lowest line in red color .
3) Candle high crosses above pivot highest , is the Long condition .
4) Candle low crosses below pivot lowest , is the Short condition .
5) Maximum Risk per trade for the intraday trade can be changed .
6) Default_qty_size is set to 60 contracts , which can be changed under settings → properties → order size .
7) ATR is used for trailing after entry, as mentioned in the inputs below.
// ═════════════════════════//
// ————————> INPUTS <————————— //
// ═════════════════════════//
Leftbars —————> Length of pivot highs and lows
Rightbars —————> Length of pivot highs and lows
Price Cross Ema —————> Added condition
ATR LONG —————> ATR stoploss trail for Long positions
ATR SHORT —————> ATR stoploss trail for Short positions
RISK —————> Maximum Risk per trade for the day
The strategy was back-tested on RELIANCE ,the input values and the results are mentioned under "BACKTEST RESULTS" below .
// ═════════════════════════ //
// ————————> PROPERTIES<——————— //
// ═════════════════════════ //
Default_qty_size ————> 60 contracts , which can be changed under settings
↓
properties
↓
order size
// ═══════════════════════════════//
// ————————> TIME CONDITION <————————— //
// ═══════════════════════════════//
The time can be changed in the script , Add it → click on ' { } ' → Pine editor→ making it a copy [right top corner} → Edit the line 25 .
The Indian Markets open at 9:15am and closes at 3:30pm .
The 'time_cond' specifies the time at which Entries should happen .
"Close All" function closes all the trades at 3pm, at the open of the next candle.
To change the time to close all trades , Go to Pine Editor → Edit the line 103 .
All open trades get closed at 3pm , because some brokers don't allow you to place fresh intraday orders after 3pm .
NSE:RELIANCE
// ═══════════════════════════════════════════════ //
// ————————> BACKTEST RESULTS ( 128 CLOSED TRADES )<————————— //
// ═══════════════════════════════════════════════ //
INPUTS can be changed for better back-test results.
The strategy applied to NIFTY ( 5 min Time-Frame and contract size 60 ) gives us 60% profitability y , as shown below
It was tested for a period a 6 months with a Profit Factor of 1.45 ,net Profit of 21,500Rs profit .
Sharpe Ratio : 0.311
Sortino Ratio : 0.727
The graph has a Linear Curve with consistent profits .
The INPUTS are as follows,
1) Leftbars ————————> 3
2) Rightbars ————————> 5
3) Price Cross Ema ——————> 150
4) ATR LONG ————————> 2.7
5) ATR SHORT ———————> 2.9
6) RISK —————————> 2500
7) Default qty size ——————> 60
NSE:RELIANCE
Save it to favorites.
Apply it to your charts Now !!
↓
FOLLOW US FOR MORE !
Thank me later ;)
EMA + Bullish Engulfing Candle Pattern StrategyHello Guys! Nice to meet you all!
This is my first open source script!
### Long Condition
1. Bullish Engulfing Candle
2. No doge Candle
3. Present volume should be bigger than the previous volume (20%)
4. Trend filter (with 2 EMAs)
### Close Condition
1. When trend Changes
2. When Bearish Engulfing Candle appears
###
No stop loss and take profit.
My StrategyThis is for educational purpose. Strategy is a test strategy to take long and short position
Forex Midpoint Stratejisi For Nasdaq English Knowledge:
Midpoint Strategy;
The general calculation method is a strategy that helps determine direction by the intersection of a MA line and the value obtained by dividing the lowest and highest price in the specified length range.
Başlangıç Periyodu: The data length of the Midpoint Line.
Kaydırma Seviyesi: The number of steps forward or backward of the Midpoint Line.
Yüzde Seviyesi: the amount of vertical scrolling.
Uzunluk: The length of the MA line
represents.
This strategy is prepared for the Nasdaq 5-minute period. It needs to be optimized for use on other instruments.
There are take profit and stop loss levels within the codes. Friends who want to use it can remove the invisibility from the relevant sections. Also, I removed the midpoint and the MA line so that it does not crowd the image, you can add it if you want.
Thank you.
Turkish Knowledge:
Midpoint Stratejisi;
Genel hesaplama yöntemi, belirlenen uzunluk aralığındaki en düşük ve en yüksek fiyatın ikiye bölümü ile elde edilen değer ve bir ortalama çizgisinin kesişimleriyle yön belirlemeye yardımcı bir stratejidir.
Başlangıç Period: Midpoint Çizgisinin veri uzunluğunu.
Kaydırma Seviyesi: Midpoint Çizgisinin ileri veya geri adım sayısını.
Yüzde Seviyesi: dikey kaydırma miktarını.
Uzunluk: Ortalama çizgisinin uzunluğunu
temsil etmektedir.
Bu strateji Nasdaq 5 dakikalık periot için hazırlanmıştır. Diğer enstrümanlarda kullanılması için optimize edilmesi gerekir.
Kodların içinde Kar alma , zarar durdurma seviyeleri mevcuttur. Kullanmak isteyen arkadaşlar ilgili bölümlerden görünmezliği kaldırabilirler. ayrıca midpoint ve ortalama çizgisinide görüntü kalabalığı yapmaması için ben kaldırdım isterseniz siz ekleyebilirsiniz.
Teşekkürler.