Shark_AlgoGram_IndicatorHello traders!
I have been developing Shark trading indicator over the last year. This algorithm indicator is based on a set of different strategies, each with its own weight (weighted strategy). The set of strategies that I currently use are 6:
MACD
Stochastic RSI
RSI
Supertrend
MA crossover
Donchin Channel
Moreover, this indicator includes STOP losses criteria and a taking profit strategy. this indicator must be optimized for the desired asset to achieves its full potential.
Best Time-Frame :
The 30 & 31 Minutes Time frame give good results. The algo has been tested for several asset (same dataframe, different optimization values).
When to Buy & Sell :
Buy Entry & Exit : Take entry when Green Arrow or Buy Trigger on screen & Exit when Purple Arrow or exit trigger on screen
Sell Exit & Exit : Take entry when Red Arrow or Sell Trigger on screen & Exit when Purple Arrow or exit trigger on screen
Important note:
Backtest the algorithm with different data stamps to avoid overfitting results
How it works:
The algorithm is based on a combination of well-documented indicators. First, the algorithm calculated the weight_strategy, which represents a value from 0 to 5 of the number of strategies that are fulfilled (in case the weight of each strategy is the same). To open a position, the value of weight_strategy must be greater than the value of weight_signal, by default 2. Modify the indicator parameters for the desired asset and data frame. Set stop-loss and take profit criteria.
Features:
* The algorithm allows to trade with long, short or both positions.
* Backtest the algorithm over a defined interval (data stamp), e.g., from 2022
* stop loss (SL) orders based on movement of the previous candle source, e.g., close or candle volatility. Only close the position after the candle is close!
* It can moves the stop loss when this indicator takes profit (TP) & Market true such condition where trailing SL Activate
* Take profit based on market movement and once 3 condition true out of 6 True they push exit order
* Define delays to evaluate the strategies of more previous candles:
+ Candle Delay is for MACD strategy
+ Candle delay Stoch RSI is for the Stochastic RSI strategy.
+ RSI Candle Delay is for the RSI strategy.
+ Candle delay Exit is the number of candles the algorithm waits to open a new position.
* Choose if you want to use the weighted strategy or just some of them.
* Choose the weight (relevance) of each strategy.
* Customize the well-documented MACD strategy.
* Customize the well-documented Stochastic RSI strategy.
* Customize the well-documented RSI strategy.
* Customize the well-documented Supertrend strategy.
* Customize the well documented MA cross strategy.
Disclaimer :
AlgoGram Script,Indicator,Strategy,Trading Idea & presentations are only for educational & Research purposes and are not intended as investment advice. I cannot guarantee the accuracy of any information provided above , please take trade with help of your Financial adviser or on your own risk
Cheers! & Best Of Luck
By AlgoGram
Cari dalam skrip untuk "stop loss"
3 Candle Strike StretegyMainly developed for AMEX:SPY trading on 1 min chart. But feel free to try on other tickers.
Basic idea of this strategy is to look for 3 candle reversal pattern within trending market structure. The 3 candle reversal pattern consist of 3 consecutive bullish or bearish candles,
followed by an engulfing candle in the opposite direction. This pattern usually signals a reversal of short term trend. This strategy also uses multiple moving averages to filter long or short
entries. ie. if the 21 smoothed moving average is above the 50, only look for long (bullish) entries, and vise versa. There is option change these moving average periods to suit your needs.
I also choose to use Linear Regression to determine whether the market is ranging or trending. It seems the 3 candle pattern is more successful under trending market. Hence I use it as a filter.
There is also an option to combine this strategy with moving average crossovers. The idea is to look for 3 candle pattern right after a fast moving average crosses over a slow moving average.
By default , 21 and 50 smoothed moving averages are used. This gives additional entry opportunities and also provides better results.
This strategy aims for 1:3 risk to reward ratio. Stop losses are calculated using the closest low or high values for long or short entries, respectively, with an offset using a percentage of
the daily ATR value. This allows some price fluctuation without being stopped out prematurely. Price target is calculated by multiplying the difference between the entry price and the stop loss
by a factor of 3. When price target is reach, this strategy will set stop loss at the price target and wait for exit condition to maximize potential profit.
This strategy will exit an order if an opposing 3 candle pattern is detected, this could happen before stop loss or price target is reached, and may also happen after price target is reached.
*Note that this strategy is designed for same day SPY option scalping. I haven't determined an easy way to calculate the # of contracts to represent the equivalent option values. Plus the option
prices varies greatly depending on which strike and expiry that may suits your trading style. Therefore, please be mindful of the net profit shown. By default, each entry is approximately equal
to buying 10 of same day or 1 day expiry call or puts at strike $1 - $2 OTM. This strategy will close all open trades at 3:45pm EST on Mon, Wed, and Fri.
**Note that this strategy also takes into account of extended market data.
***Note pyramiding is set to 2 by default, so it allows for multiple entries on the way towards price target.
Remember that market conditions are always changing. This strategy was only able to be back-tested using 1 month of data. This strategy may not work the next month. Please keep that in mind.
Also, I take no credit for any of the indicators used as part of this strategy.
Enjoy~
Supertrend StrategyThis Supertrend strategy will allow you to enter a long or short from a supertrend trend change. Both ATR period and ATR multiplier are adjustable. If you check off "Change ATR Calculation Method" it will base the calculation off the sma and give you slightly different results, which may work better depending on the asset. Be sure to enter slippage and commission into the properties to give you realistic results.
I've also built in backtesting date ranges and the ability to trade only within certain times of day and have it close all trades at the end of that time frame. This is especially useful for day trading stocks. If you check off "Enter First Trade ASAP" then when using the time frame option it will enter the current trade. If however you uncheck that box and instead check off "Wait To Enter First Trade" it will wait for the trend to change and then enter.
You can also specify a % based take profit and stop loss. In most cases the stop loss is not needed because of the atr based stop that supertrend provides so you could check only take profit and see if it works best to take profit or to let supertrend trend change get you out. Also keep in mind that if you have "Enter First Trade ASAP" checked off and use the stop loss and/or take profit then it will re-enter the current trend again.
Finally there's custom alert fields so you can send custom alert messages for strategy entry and exit for use with automated trading services. Simply enter your messages in the fields within the strategy properties and then put {{strategy.order.alert_message}} in your alert message body and it will dynamically pull in the appropriate message.
3Commas Visible DCA StrategyThis strategy consists of the following elements and can all be set by the user.
1. Entry by moving average cross.
1) Selection of moving average line.
- SMA(Simple Moving Average)
- EMA(Exponential Moving Average)
- HMA(Hull Moving Average)
2) Selection of Cross over / Cross under
2. Add Entry by DCA(Dollar Cost Averaging)
- A DCA strategy is the practice of investing into a currency at preset intervals to reduce the entry price of a position over time and mitigate volatility risk.
For example,
Base Order = 10 Dollar at Price 100%
Safety Order1 = 20 Dollar at Price 90%
Safety Order2 = 40 Dollar at Price 80%
Average Price => Price 80~90%
thereby getting a better average price for your position and greatly reducing risks from the consequences of volatility.
3. Target Price and Stop Loss.
1) Target Price : Realize profits at % set from the average unit price.
2) Stop Loss : Stop Loss % set from the last safety order.
You can easily find out what's related by changing the setting value after setting the strategy.
This strategy has the following Good characteristics.
1. It informs you of the assets required according to DCA settings.
If you are short of assets, a warning sign will appear.
2. Amount of assets invested in each long entry and long entry close.
3. Visibility of the lowest purchase price line and DCA purchase location according to DCA setting.
easily check the values set in the backtest.
I hope it will help you. Thank you.
Trend Strategy by zdmreThis Strategy is a trend following indicator. It is plotted on price and the current trend can be determined by its placement vis-a-vis price. It is constructed with just three parameters: Period, Multiplier and Entry/Exit Point with Superformula.
The default parameters are 14 for Average True Range (ATR) and 4 for its multiplier. The average true range (ATR) plays a key role in ‘Trend’ as the indicator uses ATR to compute its value and it signals the degree of price volatility. You should note that any changes to these numbers can affect the use of the Trend indicator.
While you using this indicator, you should not avoid putting your stop loss.
For a long position, you can put stop loss right at the red indicator line. For a short position, you can put it at the green indicator line. You can insert your own settings as well.
Using Trend Strategy along with a stop loss pattern is the best way for earning the best wealth in trading.
There is no best setting for any trading indicator.
Price Change Scalping Strategy v1.0 - 3Commas EditionIntroduction
This strategy implements the Price Change Scalping (PCS) strategy specifically for the 3Commas platform. The Input settings have been redesigned to match the same inputs as the 3Commas My Bot Settings page. Only the "Deal Start Condition" section will echo the required PCS-related settings found in the original Price Change Scalping Strategy v1.0 to successfully implement the strategy.
The strategy uses a price rate of change (ROC) momentum calculation to determine the percent change in price between a defined range of bars. The calculated ROC value is then compared to the Upper Threshold and Lower Threshold values to determine if a trade setup is to be activated. If the threshold is crossed, a trade setup will occur based on the indicator settings. Entry, Take Profit, and Stop Loss prices are calculated and displayed on the chart. Once the Entry Price is crossed, a long or short position is created (depending on the direction) and once the Take Profit price is crossed, the position is closed. If the Entry Price is not crossed within a specific number of bars, the trade setup is canceled, and it will proceed to monitor price changes for the next set up.
How is it original and useful?
This strategy is unique in that the strategy version fully supports the TradingView backtester, which will enable you to perform experiments with various settings to evaluate performance using the historical chart data. The study version implements the "Start Deal" and "Close Deal" alerts for you to integrate with 3Comma's "Trading View Custom Signal" start condition. Both script versions will provide the same configuration abilities. The following list is a brief description of its usefulness:
Full support for all possible 3Commas bot settings.
Define a short or long trading strategy.
Price change data source and offset settings.
Your layering placement relative to the entry price.
Your trading parameters like take profit and stop loss offsets, trailing take profit support, exchange commission rates, trading start time, and order size multiplication for each layer.
Flexible trade eligibility rules that can use other chart indicators, like RSI or EMA, to exclude the selection of entry prices for trading.
The visibility of detailed statistics from the chart history pertaining to trading sessions started and closed, session durations, win rate, price action drops and bounces, as well as layer utilization.
The visibility of detailed Used Amount for Each Step table that details how each layer will be allocated for trading.
How does it compare to other scripts in the Public Library?
The strategy offers a very detailed, comprehensive settings to address all types of markets found on TradingView where you can implement the price change scalping strategy. The strategy version can be considered the first of its kind on TradingView to leverage the backtester to provide informative, detailed performance measurements surrounding this unique trading strategy. The study version will implement the latest alert framework called "Any Alert() Function" where you can create a single alert to handle multiple events, which include:
Deal Start
Deal Close
Strategy Results
The default settings are designed to define a "loose" price change settings to ensure that the indicator will render chart elements when first loaded as well as to allow the backtester to gather order executions and display performance summary. The strategy version is using $10,000 initial capital, a commission rate of 0.1% for both entries and exits, and a 1 tick slippage setting. It is also using 3.4881% of the equity for the Base Order Size, 4.7097% of equity for the first Safety Order Size. The Maximum Safety Trade Count is 7 with a Safety Order Volume Scale of 1.33, and a take profit of 2% with no stop loss. All other settings are defaults.
It is recommended that the indicator be "tuned" for your specific market to best implement the price change strategy and obtain better desirable results. You do so by scrolling through the chart's history and observing moments when prices tend to move rapidly. Measure the number or bars it typically takes for the price to change at a specific rate. Using this information, you can adjust the Price Change Settings accordingly to configure the indicator for the chart.
Always keep in mind that past performance may not be indicative of future results. Settings that seem favorable for one market may be found to be disastrous in another. Therefore, do take the time needed to understand how the settings will behave with the given chart symbol.
Enjoy! 😊👍
How to obtain access to the script?
You have two choices:
Use the "Website" link below to obtain access to this indicator, or
Send us a private message (PM) in TradingView itself.
Price Change Scalping Strategy v1.0Introduction
This strategy uses a price rate of change (ROC) momentum calculation to determine the percent change in price between a defined range of bars. The calculated ROC value is then compared to the Upper Threshold and Lower Threshold values to determine if a trade setup is to be activated. If the threshold is crossed, a trade setup will occur based on the indicator settings. Entry, Take Profit, and Stop Loss prices are calculated and displayed on the chart. Once the Entry Price is crossed, a long or short position is created (depending on the direction) and once the Take Profit price is crossed, the position is closed. If the Entry Price is not crossed within a specific number of bars, the trade setup is canceled, and it will proceed to monitor price changes for the next set up.
How is it original and useful?
This strategy is unique in that the strategy version fully supports the TradingView backtester, which will enable you to perform experiments with various settings to evaluate performance using the historical chart data. The study version implements numerous custom alerts for you to build TradingView notifications around specific price action events and stay informed with market activity in real-time. Both script versions will provide the same configuration abilities where you can define:
Define a short or long trading strategy.
Price change data source and offset settings.
Your layering placement relative to the entry price.
Your trading parameters like take profit and stop loss offsets, exchange commission rates, trading start time, and order size multiplication for each layer.
Flexible trade eligibility rules that can use other chart indicators, like RSI or EMA, to exclude the selection of entry prices for trading.
The visibility of detailed statistics from the chart history pertaining to trading sessions started and closed, session durations, win rate, price action drops and bounces, as well as layer utilization.
How does it compare to other scripts in the Public Library?
The strategy offers a very detailed, comprehensive settings to address all types of markets found on TradingView where you can implement the price change scalping strategy. The strategy version can be considered the first of its kind on TradingView to leverage the backtester to provide informative, detailed performance measurements surrounding this unique trading strategy. The study version will contain numerous custom alerts to aid in your notification preferences and stay informed on the indicator's activities:
Price Crossed Above Threshold
Price Crossed Below Threshold
Enter Long Position
Exit Long Position
Enter Short Position
Exit Short Position
Price Crossed DCA Layer 1 (Long)
Price Crossed DCA Layer 2 (Long)
Price Crossed DCA Layer 3 (Long)
Price Crossed DCA Layer 4 (Long)
Price Crossed DCA Layer 5 (Long)
Price Crossed DCA Layer 6 (Long)
Price Crossed DCA Layer 7 (Long)
Price Crossed DCA Layer 8 (Long)
Price Crossed DCA Layer 1 (Short)
Price Crossed DCA Layer 2 (Short)
Price Crossed DCA Layer 3 (Short)
Price Crossed DCA Layer 4 (Short)
Price Crossed DCA Layer 5 (Short)
Price Crossed DCA Layer 6 (Short)
Price Crossed DCA Layer 7 (Short)
Price Crossed DCA Layer 8 (Short)
Strategy Results
The default settings are designed to define a "loose" price change settings to ensure that the indicator will render chart elements when first loaded as well as to allow the backtester to gather order executions and display performance summary. The strategy version is using $10,000 initial capital, a commission rate of 0.1% for both entries and exits, and a 1 tick slippage setting. It is also using 2.74506% of the equity with a Order Size Multiplier of 1.33, using 8 total DCA layers, and a take profit of 2% with no stop loss. All other settings are defaults.
It is recommended that the indicator be "tuned" for your specific market in order to best implement the price change strategy and obtain better desirable results. You do so by scrolling through the chart's history and observing moments when prices tend to move rapidly. Measure the number or bars it typcially takes for the price to change at a specific rate. Using this information, you can adjust the Price Change Settings accordingly to configure the indicator for the chart.
Always keep in mind that past performance may not be indicative of future results. Settings that seem favorable for one market may be found to be disastrous in another. Therefore, do take the time needed to understand how the settings will behave with the given chart symbol.
Enjoy! 😊👍
How to obtain access to the script?
You have two choices:
Use the "Website" link below to obtain access to this indicator, or
Send us a private message (PM) in TradingView itself.
EMA pullback strategyA solid EMA pullback strategy for cryptos 15 min chart that uses EMA crossing as signal and pullback as stop loss.
EMA1: shortest period for finding crossing (I find period = 33 profitable for BTCUSD, you can adjust it for other cryptos)
EMA2: 5x period of EMA1, for filtering out some trend reversals
EMA3: 11x period of EMA1, for determining trend direction
Rules are:
Long:
close price > EMA3
EMA1 > EMA3
close price pullbacks below EMA1 and then crosses up EMA1, enter at the first close price above EMA1
lowest pullback close price < EMA2 at the cross up
Short:
close price < EMA3
EMA1 < EMA3
close price pullbacks above EMA1 and then crosses down EMA1, enter at the first close price below EMA1
highest pullback close price > EMA2 at the cross down
Stop-loss at lowest/highest pullback price for long/short
Take profit = 2x stop-loss
Risk management: risk range can be set in the inspector. If the risk is lower than the range, the trade is not taken. if the risk is higher than the range, the position size is adjusted to keep the risk within range.
8 Whittle DownThe system is designed to short on directionally negative instruments like VXX & SQQQ
The system only shorts, no longs
It enters a pilot position if the system has no trades open at the time is in the late afternoon
It uses a 200-day moving average as a filter and will only short if the price is below the 200 day moving average
The pilot position will only enter with 1/3 ( one third ) of the total expected position size
StopLossPerc sets the stop loss, (1.15) means it is set to a 15% stop loss. -- The Red Line
The system will buy additional shares for a full position if the pilot piston profit target was not reached
The full shares position is set to purchase at a higher price. T2EntTrgPerc sets the buy percentage target for the additional shares. -- The Yellow Line
Each entry has different settable profit targets. T1ProfTrgPerc sets the profit target for the first trade (0.95) is basically set to a 5% profit.
T2ProfTrgPerc sets the profit target for the second trade (0.90) is basically set to a 10% profit. -- The White Line
RED LINE == STOP LOSS LINE
GREENLINE == PROFIT TARGET FOR THE 1ST TRADE
YELLOW LINE == ADD ON SHARES TO THE TRADE
WHITE LINE == PROFIT TARGET FOR THE 1st & 2nd TRADE COMBINED
Let me know if you have any questions and I'll try to clarify
M8 BUY @ END OF DAYI've read a couple of times at a couple of different places that most of the move in the market happens after hours, meaning during non-standard trading hours.
After-market and pre-market hours and have seen data presented showing that systems which bought just before end normal market hours and sold the next morning had really amazing resutls.
But when testing those I found the results to be quite poor compared to the pretty graphs I saw, and after much tweaking and trying different ideas I gave up on the idea until I recently decided to try a new position management system.
The System
Buys at the end of the trading day before the close
Sells the next morning at the open IF THE CLOSE OF THE CURRENT BAR IS HIGHER THAN THE ENTRY PRICE
When the current price is not higher, the system will keep the position open until it EITHER gets stops out or closes on profit <<< this is WHY it has the high win %
The system has a high win ratio because it will keep that one position open until it either reaches profit or stops out
This "system" of waiting, and keeping the trade open, actually turned out to be a fantastic way to kind of put the complete trading strategy in a kind of limbo mode. It either waits for market failure or for a profit.
I don't really care about win % at all, almost always high win % ratio systems are just nonsense. What I look for is a PF -- profit factor of 1.5 or above, and a relatively smooth equity curve. -- This has both.
The Stop Loss setting is set @ .95, meaning a 5% stop loss. The Red Line on the chart is the stop loss line.
There is no set profit target -- it simply takes what the market gives.
Non-Repainting System
This does use a 200D Simple Moving Average as a filter. Like a Green Light / Red Light traffic light, the system will only trade long when the price is above its 200 Moving average.
Here is the code: "F1 = close > sma(security(syminfo.tickerid, "D", close ), MarketFilterLen) // HIGH OF OLD DATA -- SO NO REPAINTING"
I use "close ", so that's data from two days ago, it's fixed, confirmed, non-repainting data from the higher timeframe.
-- I would only suggest using this on direction tickers like SPY, QQQ, SSO, TQQQ, market sectors with additional filters in place.
NIKI MSS BANKNIFTYThis is the strategy version of my old indicator NIKI BANKIFTY. It is more suitable for day trading with a 5 min chart. It is more profitable in BANKNIFTY future. It is based on multiple Supertrend, moving average, Donchain channel, and linear regression. The background color indicates the main trend and the color of the candle represents a short-term trend. The label with TA and SL represents more profitable entry positions. The label RE: LE and RE: SE stands for re-entry positions or signals with less accuracy. Consider the direction of the linear regression line to take trades on re-entry positions. The yellow candle indicates the entry and the blue candle represents the target or stop-loss.
The backtest results are based on BANKNIFTY last year's data. It has an initial capital of 100000 and the size of the lot is 1. The target is 0.3% and stop-loss is 1.5%. It exactly not following the stop loss, the trade will exit based on the Donchain channel breakout. It appears on the chart as a blue candle. The commission paid is 20 cash per trade and the slippage is 5 ticks per trade. Some of the Indian broker's commission is only 10 cash per trade. Adjust the commission as per your broker. Trades are conducted based on the intraday time in India set from 9.20 am to 2.25 pm. All positions will get square off at 3.00 pm. It will execute a maximum of 4 trades per day. All other parameters are suitable for Robo trading with Indian stock brokers.
Contact us using the link given below to obtain access to this indicator.
Ultimate Strategy TemplateHello Traders
As most of you know, I'm a member of the PineCoders community and I sometimes take freelance pine coding jobs for TradingView users.
Off the top of my head, users often want to:
- convert an indicator into a strategy, so as to get the backtesting statistics from TradingView
- add alerts to their indicator/strategy
- develop a generic strategy template which can be plugged into (almost) any indicator
My gift for the community today is my Ultimate Strategy Template
Step 1: Create your connector
Adapt your indicator with only 2 lines of code and then connect it to this strategy template.
For doing so:
1) Find in your indicator where are the conditions printing the long/buy and short/sell signals.
2) Create an additional plot as below
I'm giving an example with a Two moving averages cross.
Please replicate the same methodology for your indicator wether it's a MACD, ZigZag, Pivots, higher-highs, lower-lows or whatever indicator with clear buy and sell conditions
//@version=4
study(title='Moving Average Cross', shorttitle='Moving Average Cross', overlay=true, precision=6, max_labels_count=500, max_lines_count=500)
type_ma1 = input(title="MA1 type", defval="SMA", options= )
length_ma1 = input(10, title = " MA1 length", type=input.integer)
type_ma2 = input(title="MA2 type", defval="SMA", options= )
length_ma2 = input(100, title = " MA2 length", type=input.integer)
// MA
f_ma(smoothing, src, length) =>
iff(smoothing == "RMA", rma(src, length),
iff(smoothing == "SMA", sma(src, length),
iff(smoothing == "EMA", ema(src, length), src)))
MA1 = f_ma(type_ma1, close, length_ma1)
MA2 = f_ma(type_ma2, close, length_ma2)
// buy and sell conditions
buy = crossover(MA1, MA2)
sell = crossunder(MA1, MA2)
plot(MA1, color=color_ma1, title="Plot MA1", linewidth=3)
plot(MA2, color=color_ma2, title="Plot MA2", linewidth=3)
plotshape(buy, title='LONG SIGNAL', style=shape.circle, location=location.belowbar, color=color_ma1, size=size.normal)
plotshape(sell, title='SHORT SIGNAL', style=shape.circle, location=location.abovebar, color=color_ma2, size=size.normal)
/////////////////////////// SIGNAL FOR STRATEGY /////////////////////////
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Basically, I identified my buy, sell conditions in the code and added this at the bottom of my indicator code
Signal = buy ? 1 : sell ? -1 : 0
plot(Signal, title="🔌Connector🔌", transp=100)
Important Notes
🔥 The Strategy Template expects the value to be exactly 1 for the bullish signal , and -1 for the bearish signal
Now you can connect your indicator to the Strategy Template using the method below or that one
Step 2: Connect the connector
1) Add your updated indicator to a TradingView chart
2) Add the Strategy Template as well to the SAME chart
3) Open the Strategy Template settings and in the Data Source field select your 🔌Connector🔌 (which comes from your indicator)
From then, you should start seeing the signals and plenty of other stuff on your chart
🔥 Note that whenever you'll update your indicator values, the strategy statistics and visual on your chart will update in real-time
Settings
- Color Candles : Color the candles based on the trade state (bullish, bearish, neutral)
- Close positions at market at the end of each session : useful for everything but cryptocurrencies
- Session time ranges : Take the signals from a starting time to an ending time
- Close Direction : Choose to close only the longs, shorts, or both
- Date Filter : Take the signals from a starting date to an ending date
- Set the maximum losing streak length with an input
- Set the maximum winning streak length with an input
- Set the maximum consecutive days with a loss
- Set the maximum drawdown (in % of strategy equity)
- Set the maximum intraday loss in percentage
- Limit the number of trades per day
- Limit the number of trades per week
- Stop-loss: None or Percentage or Trailing Stop Percentage or ATR
- Take-Profit: None or Percentage or ATR
- Risk-Reward based on ATR multiple for the Stop-Loss and Take-Profit
This script is open-source so feel free to use it, and optimize it as you want
Alerts
Maybe you didn't know it but alerts are available on strategy scripts.
I added them in this template - that's cool because:
- if you don't know how to code, now you can connect your indicator and get alerts
- you have now a cool template showing you how to create alerts for strategy scripts
Source: www.tradingview.com
I hope you'll like it, use it, optimize it and most importantly....make some optimizations to your indicators thanks to this Strategy template
Special Thanks
Special thanks to @JosKodify as I borrowed a few risk management snippets from his website: kodify.net
Additional features
I thought of plenty of extra filters that I'll add later on this week on this strategy template
Best
Dave
TradingView Alerts to MT4 MT5 - Forex, indices, commoditiesHowdy Algo-Traders! This example script has been created for educational purposes - to present how to use and automatically execute TradingView Alerts on real markets.
I'm posting this script today for a reason. TradingView has just released a new feature of the PineScript language - ALERT() function. Why is it important? It is finally possible to set alerts inside PineScript strategy-type script, without the need to convert the script into study-type. You may say triggering alerts straight from strategies was possible in PineScript before (since June 2020), but it had its limitations. Starting today you can attach alert to any custom event you might want to include in your PineScript code.
With the new feature, it is easier not only to execute strategies, but to maintain codebase - having to update 2 versions of the code with each single modification was... ahem... inconvenient. Moreover, the need to convert strategy into study also meant it was required to rip the code from all strategy...() calls, which carried a lot of useful information, like entry price, position size, and more, definitely influencing results calculated by strategy backtest. So the strategy without these features very likely produced different results than with them. While it was possible to convert these features into study with some advanced "coding gymnastics", it was also quite difficult to test whether those gymnastics didn't introduce serious, bankrupting bugs.
//////
How does this new feature work? It is really simple. On your custom events in the code like "GoLong" or "GoShort", create a string variable containing all the values you need inside your alert and this string variable will be your alert's message. Then, invoke brand new alert() function and that's it (see lines 67 onwards in the script). Set it up in CreateAlert popup and enjoy. Alerts will trigger on candle close as freq= parameter specifies. Detailed specification of the new alert() function can be found in TradingView's PineScript Reference (www.tradingview.com), but there's nothing more than message= and freq= parameters. Nothing else is needed, it is very simple. Yet powerful :)
//////
Alert syntax in this script is prepared to work with TradingConnector. Strategy here is not too complex, but also not the most basic one: it includes full exits, partial exits, stop-losses and it also utilizes dynamic variables calculated by the code (such as stop-loss price). This is only an example use case, because you could handle variety of other functionalities as well: conditional entries, pending entries, pyramiding, hedging, moving stop-loss to break-even, delivering alerts to multiple brokers and more.
//////
This script is a spin-off from my previous work, posted over a year ago here: Some comments on strategy parameters have been discussed there, but let me copy-paste most important points:
* Commission is taken into consideration.
* Slippage is intentionally left at 0. Due to shorter than 1 second delivery time of TradingConnector, slippage is practically non-existing.
* This strategy is NON-REPAINTING and uses NO TRAILING-STOP or any other feature known to be causing problems.
* The strategy was backtested on EURUSD 6h timeframe, will perform differently on other markets and timeframes.
Despite the fact this strategy seems to be still profitable, it is not guaranteed it will continue to perform well in the future. Remember the no.1 rule of backtesting - no matter how profitable and good looking a script is, it only tells about the past. There is zero guarantee the same strategy will get similar results in the future.
Full specs of TradingView alerts and how to set them up can be found here: www.tradingview.com
Multi Time Frame Buy&Sell V4.0 [BACKTEST]Hi guys,this indicator Developed for Intraday and multi Time Frame Trading. Note: Invite only Script.Request to me Access permission to test this.
*** THIS IS STUDY VERSION ***
Time Frame : can use for 15 min / 30 min / 1h / 4h time
15 min configuration is best result for bitcoin and ethereum .
This can be used : Crypto Currency/ Bitcoins / ethereum ,Forex,currencies ,Index ,Commodity Gold / silver , Oil Market and in Equity / Futures
ETHUSDT Futures 15min
BTCUSDT Futures 15min:
GOLD /USD FOREX 15min:
HOW IT WORKS:
this indicator analyze EMA&SMA support and resistance then combine with pivot point and fibo levels is used to calculate the signals.and finally show entry label on
chart with target point and stop loss
HOW TO USE:
Creating a signal is as simple as adding the indicator called to your chart(buy or sell)label and background color change ( green=buy / red = sell)
green line is target and black line is stop loss.
in top of setting page you can see noise filter option . that can change it to get better result and reduce noise. in setting can set 3 target level and stoploss
NOT:all information show to info panel in chart.
strategy tester : enabled .All you can test this in live market in any segment.
NOT: can to change noise filter in setting setup until to get best result.
Choose any Date Month Year to Current Date and check the results below in the Strategy Tester.
REPAINT/NO REPAINT : No Repaint ,entery labal(buy or sell) and Background Color wont change. In the current candle position wait for the candle to close to see the
stability.
"Set alert": Select "Once per bar close" for your alert options.
There are 5 alerts:
- BUY
- SELL
- BUY OR SELL (for free TV users)
- take profit
- stop loss
Review and Feedback.Thank you!
Any issues report to me to Fix.Thank you!
how To Get access : Use the link below to obtain access to this indicator or PM us to obtain access.
Support/ Resistance with H1 ATR - strategy mainline versionThis script using ATR (average true range) with source hl2 for create Support/ Resistance line
The color meaning:
- Green = Support line
- Red = Resistance line
Signal:
- If close price breakout Resistance line -> LONG signal will been active.
- If close price breakout Support line -> SHORT signal will been active.
Input setting:
Recommended default setting.
- Factor: amplitude for create Support/ Resistance line.
- Length: length of ATR.
- Offset: number of bar for check sideway or choppy market.
- Take profit: if you want test close position by profit.
- Stop loss: should not be missed.
- Open Position with Stop-Market type:
+ Open LONG position with high price and type Stop-Market.
+ Open SHORT position with low price and type Stop-Market.
Strategy setting:
Recommended default setting if you trade on Binance Futures or change Comission if you trade on another exchange.
Best backtest if:
- Max drawdown less than 10%.
- Min backtest time: 6 month.
- Avg profit: 10%/ month when no leverage is used.
Alert version:
1 - Select create new alert
2 - Condition:
+ eb BUY -> LONG signal
+ eb BUY close -> close LONG position
+ eb SELL -> SHORT signal
+ eb SELL close -> close SHORT position
3 - Option: recommended using only. Because the signal will be more accurate if the price close breakout successfully.
+ Always put stop loss position to avoid PUMP/ DUMP market.
// Note: alert version not free, send for me a private message on TradingView to get price and gain access.
Recommended:
- Using in M30, M45, H1 timeframe with default setting.
- Symbol: BTC
- Exchange: Binance Futures
- Order size: 10% wallet balance, maximum 25% wallet balance.
- Leverage: X2-X5, maximum X10.
---> I using 10% wallet balance and X2 only.
RSI and Smoothed RSI Bull Div Strategy [BigBitsIO]This strategy focuses on finding a low RSI value, then targeting a low Smoothed RSI value while the price is below the low RSI in the lookback period to trigger a buy signal.
Features Take Profit, Stop Loss, and Plot Target inputs. As well as many inputs to manage how the RSI and Smoothed RSI are configured within the strategy.
Explanation of all the inputs
Take Profit %: % change in price from position entry where strategy takes profit
Stop Loss %: % change in price from position entry where strategy stops losses
RSI Lookback Period: # of candles used to calculate RSI
Buy Below Lowest Low In RSI Divergence Lookback Target %: % change in price from lowest RSI candle in divergence lookback if set
Source of Buy Below Target Price: Source of price (close, open, high, low, etc..) used to calculated buy below %
Smoothed RSI Lookback Period: # of candles used to calculate RSI
RSI Currently Below: Value the current RSI must be below to trigger a buy
RSI Divergence Lookback Period: # of candles used to lookback for lowest RSI in the divergence lookback period
RSI Lowest In Divergence Lookback Currently Below: Require the lowest RSI in the divergence lookback to be below this value
RSI Sell Above: If take profit or stop loss is not hit, the position will sell when RSI rises above this value
Minimum SRSI Downtrend Length: Require that the downtrend length of the SRSI be this value or higher to trigger a buy
Smoothed RSI Currently Below: Value the current SRSI must be below to trigger a buy
Scripting Tutorial B - TManyMA - Commission/FeesThis script is for a triple moving average strategy where the user can select from different types of moving averages, price sources, lookback periods and resolutions.
Features:
- 3 Moving Averages with variable MA types, periods, price sources, resolutions and the ability to disable each individually.
- Crossovers are plotted on the chart with detailed information regarding the crossover (Ex: 50 SMA crossed over 200 SMA )
- Forecasting available for all three MAs. MA values are forecasted 5 values out and plotted as if a continuation to the MA.
- Forecast bias also applies to all forecasting. Bias means we can forecast based on an anticipated bullish , bearish or neutral direction in the market.
- To understand bias, please read the source code, or if you can't read the code just send me a message on here or Twitter . Twitter should be linked to my profile.
- Ribbons added and on by default. Optional setting to disable the ribbons. 5 ribbons between MA1 and MA2 and another 5 between MA2 and MA3.
- Ribbons are alpha-color coded based on their relation to their default MAs.
- Ribbons are only visible between MAs if the MAs being compared share the same Type, Resolution, and Source because there is no way to consolidate those three in a simple manner.
- Ribbon values are calculated based on calculated MA Periods between the MAs.
- Converted the existing study into a strategy.
- Strategy only enters long positions with a market order when MA crossovers occur.
- Strategy exits positions when crossunders occur.
- Trades 100% of the equity with one order/position by default.
- Ability to disable trading certain crosses with input checks.
- Ability to exit trades with a take profit or stop loss.
- User input to allow quick changes to the take profit or stop loss percentages.
- Strategy now calculates on every tick
- Strategy also includes fixed commission values based on Coinbase standard order fees
This script is meant as an educational script with well-formatted styling, and references for specific functions.
*** PLEASE NOTE - THIS STRATEGY IS MEANT FOR LEARNING PURPOSES. DEPENDING ON IT'S CONFIGURATION IT MAY OR MAY NOT BE USEFUL FOR ACTUAL TRADING. THE STRATEGY IS NOT FINANCIAL ADVICE ***
Support/Resistance Algo-Tradeing StrategyThis strategy Automates Support and resistance trading and a tight trailing stop loss technique. The support and resistance levels are calculated from previous highs and lows; these levels are used to make two types of trades:
1. Break out trades, taking a trade if the market is able to push through a support or resistance level.
2. Liquidity pool rejection, also known as a stop loss hunt. When the market is brought past a key level (to take out stop losses) which traders (usually institutions) use to enter, which then reverses back through the support/resistance level where the strategy enters a trade.
An optional "volatility filter" may be used when on a suitable market. This means that trades are only entered when there is suitable volatility.
A tight stop loss is kept so most trades lose, but winning trades are left to run much further. So this is a very reliable profitable strategy on many markets.
For a limited time I will provide access to this strategy for free as it is not yet complete, there is still testing to do and I would appreciate any feedback.
Strategy - Bobo's Pivot ATR SwingHi there, welcome to my pivot ATR swing bot. I put this out there with source code hidden to see what ideas others have to use it. Also if there are any coders of trading systems out there who wanted to work with me to put this into a form that could trade automatically we could both use... I'd welcome that kind of collaboration and will happily share the underlying rules of this and the more highly developed version that isn't public.
But as it is, the signals are free for all, use them as you wish and at your own risk. If you want to discuss the code, strategy or ideas, I'm around fairly regularly just message.
The bot is fairly simple design that will give you signals for long and short intraday/week on equity futures / CFDs / ETFs. You'll see it backtests fairly well on an hourly SPX500 chart as configured. You will need to set up certain parameters to account for any different timeframes and markets you wish to trade. For me it's most effective pick out a few good swing trades per week in equity futures. However part of the idea of putting this in the public domain is to see if other people will have good but different ideas how to use it. Please share with me if so :).
The basic concept is a series of 3 lines that define the area and movement we wish to trade. The daily pivot is the central line (blue). We are looking to capture reversions to this middle line from extremes (red and green). Therefore the bot will signal exit at the close of every candle that has passed through the pivot.
Entry is decided by the outer bands around the blue line. Red is the top band, green the bottom. As configured, these are simply placed a daily ATR value apart, centred around the pivot. You can change this quite a lot though, so let's go through the settings:
Pivot Timeframe - simple, a daily pivot is calculated from the previous day's values (high + low + close)/3 . BUt the same calculation can be applied to any length candle, day, minute, month or whatever. This makes the middle target line more or less responsive to recent price action.
ATR Band Timeframe - When we calculate the average range, we need to know what candle length makes up our series. Daily candles is the default, but you can change that here.
ATR Lookback - When we calculate the average range, we need to know how many instances of the timeframe (day, minute, hour etc) we look back to create an average. The lower the lookback value, the more the width of the bands (the distance from pivot) will change quickly based on the volatility of previous candles. The higher the lookback value, the more stable the band width will be to recent volatility.
ATR divisor - The ATR value above is divided by this value, before being added or subtracted to the pivot to create the red and green lines. Default value is 2, and this means the distance from the red band to the green band will be equal to 1 ATR, as calculated according to the parameters above. Setting this to 1 would mean that each band is one ATR away from pivot (ie the bands got wider apart). Set this to 4, and it means that it is only 1/2 an ATR from green to red.
Take Profit / Stop Loss. - We know what a stop and profit target are, but worth nothing that a 0 value disables stop loss or profit targets. The bot will still close positions when crossing pivot.
Also, note the mintick value of the instrument you apply this to. For example for the CFD chart SPX500 the mintick value is 0.1. So a 100 value for stop loss = 10 points on SPX500. but if you were to trade the same thing basically, but the emini future ES, the mintick value is 0.25. So for a 10 point stop on the ES chart, you would need a value of 40 in this bot. US30 and YM have convenient mintick values of 1. Currencies can be a bit of a nightmare :).
Forex Master (EUR/USD)ATTENTION:
This is a symmetrical algorithm designed only for trading EUR/USD on the 1h time frame. For other currency pairs and time frames, you need to re-calibrate the RSI-EMAs as well as the profit targets and stop losses.
BACKTEST CONDITIONS:
Initial equity = $100,000 (no leverage)
Order size = 100% of equity
Pyramiding = disabled
TRADING RULES:
Long entry = EMA20(RSI10) cross> 50
Profit limit = 50 pips
Stop loss = 50 pips
Short entry = EMA30(RSI30) cross< 50
Profit limit = 50 pips
Stop loss = 50 pips
Long entry = Short exit
Short entry = long exit
DISCLAIMER: None of my ideas and posts are investment advice. Past performance is not an indication of future results. This strategy was constructed with the benefit of hindsight and its future performance cannot be guaranteed.
Dumb Money ConceptUse in 1 minute timeframe
1. Strategy setup
Name & sizing: Trades 25% of your account on each signal, assumes 0.04% commission + 2‑tick slippage, starts with a notional 10 million.
Timing: Only makes decisions at each 1‑minute bar close, and processes orders at bar‑close.
2. Optional filters (both default to off)
Volatility filter : when on, requires that yesterday’s ATR (average true range) ≥ your threshold before even placing an entry.
Trend filter : when on, only allows a “long” if yesterday’s close was above its daily MA, or a “short” if below.
You can toggle each filter on/off and adjust ATR period, ATR threshold, and MA length through the inputs at the top.
3. Signal logic (“dumb money” wicks)
At today’s first minute, the script pulls yesterday’s open, high, low, close, ATR and MA—using only completed daily bars so nothing repaints.
It measures the size of yesterday’s upper wick (close→high) vs. lower wick (open→low).
If the upper wick was longer, that sets a long bias (“dumb money” got shaken out at the top). Otherwise it sets a short bias.
4. Calculate where to place orders
On that same first minute of day:
Entry: a limit order at half of yesterday’s range away from today’s open (below the open for longs, above for shorts).
Stop‑loss: one full‑range (×1.0) below today’s open for longs (and above for shorts).
Take‑profit: 1.236× yesterday’s range above today’s open for longs (and below for shorts).
5. Apply filters before sending entry
Before actually placing that limit order, it checks:
Volatility: if enabled, requires yesterday’s ATR ≥ your “Min Daily ATR.”
Trend: if enabled, requires yesterday’s close to lie on the same side of its daily MA as your signal.
If either filter fails, no order is sent.
6. Give the limit order up to 24 hours to fill
The code remembers the bar‑index when the order went live.
If 1440 one‑minute bars pass (≈24 h) without a fill, it automatically cancels the unfilled entry—so stale orders don’t hang around.
7. Once filled, TP/SL manage the trade
As soon as your limit order executes, two opposite orders are placed:
A take‑profit at the 1.236× range level
A stop‑loss at the –1.0× range level
One cancels the other when triggered.
8. No overnight risk
On the very first minute of the next daily bar, any position still open is force‑closed (“Time Exit”)
Fibonacci + TP/SL Strategy [Backtest]✅ Key Features Added and Adjusted:
Fibonacci Retracement Levels:
Automatically calculated based on the last 100 bars' high/low
Plotted levels: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
Extension targets: 161.8%, 261.8%, 423.6%
Buy/Sell Signal Logic:
Buy: Price is between 78.6% and 38.2% levels
Sell: Price is between 61.8% and 23.6% levels
Both depend on a can_trade time filter to avoid overtrading
ATR-based Stop-Loss:
Stop-loss dynamically adapts to market volatility:
SL = Entry - ATR * 1.5 (long)
SL = Entry + ATR * 1.5 (short)
Fixed Take-Profit:
Configurable via input: default is 4%
Can be changed in TradingView UI
Golden/Death Cross Indicator (Visual Only):
EMA 50 crossing EMA 200 plotted on chart:
Golden Cross = Buy signal (green triangle)
Death Cross = Sell signal (red triangle)
Weekly Profit Cap:
Prevents new trades if weekly profit exceeds 15%
Resets at the start of every week
Visual Elements:
All Fibonacci levels are plotted
Buy/Sell signals are labeled on the chart (BUY, SELL)
Stoch RSI Crossover Strategy · HTF RELv2StochRSI Strategy V1.2 | Narrow Bands – Crossover-Based Trading Strategy
This strategy is built around the Stochastic RSI indicator on daily candles, using tight entry and exit bands to capture well-defined turning points in price action.
⚙️ Strategy Logic:
Entry (Long):
When the %K line crosses above the %D line, and both are below a defined lower threshold (default: 20) — indicating potential bullish momentum from an oversold state.
Exit (Close):
When the %K line crosses below the %D line, and both are above an upper threshold (default: 80) — indicating waning momentum from an overbought condition.
Stop-Loss:
A fixed stop-loss percentage is calculated from the entry price (default: 10%).
✅ Key Features:
Full synchronization between visual signals (green/red arrows) and actual trade execution.
Clean, focused logic — no external indicators or moving averages required.
Suitable for momentum-based traders seeking precise entries and exits after strong directional moves or extremes.