Alex trading stragedyOverview
This script, named "ALEX TRADING STRATEGY", is a technical trading strategy designed for new investing groups. It uses a combination of various technical indicators to identify potential buying and selling opportunities in the market. The script includes the Relative Strength Index (RSI), Simple Moving Averages (SMA), Exponential Moving Averages (EMA), and Higher High Lower Low (HHLL) strategies to create a complete trading solution.
The user can change the position from long to short in the Input Settings. The script uses bar colors to indicate the current trading position. The script also has exit strategies to help manage the open trades. The user can also set the period for the various indicators used in the strategy.
The script provides various technical indicators and entry/exit signals to make the trading decision easier for the user. It also includes pivot lines, resistance and support levels to help the user make a more informed decision.
This Pine script implements a multi-indicator trading strategy that combines several technical analysis techniques for making trading decisions. The script uses the Relative Strength Index (RSI) to determine overbought and oversold conditions in the market and plots the RSI values on the chart. The RSI values above 70 are considered overbought and plotted as red upward triangles, while the RSI values below 30 are considered oversold and plotted as green downward triangles.
The script also calculates Simple Moving Averages (SMAs) with the user-defined period and plots them along with the Exponential Moving Averages (EMAs) of 20, 50, and 100 periods. Based on the crossover of the close price and the moving averages, the script enters long or short trades. The script sets the trade exit conditions as the low or high crossing the lower or upper band, respectively.
In addition to the moving average crossover, the script uses the highest high and lowest low over a user-defined period to determine long and short entries. The script plots the long and short conditions on the chart as green upward and red downward triangles, respectively. The script allows the user to switch between long and short trades by changing the input settings.
Finally, the script changes the bar colors based on the trade direction, with green bars indicating a long trade, red bars indicating a short trade, and blue bars indicating no trade. Overall, this Pine script provides a comprehensive trading strategy that combines several technical analysis techniques to make informed trading decisions.
HOW TO USE
Input Settings: In the Input Settings section, you can change the long to short position. You can also change the period value (default is 10) used to calculate the Simple Moving Average (SMA) for the Keltner channel.
Indicators: The script uses RSI (Relative Strength Index) with 14 periods as well as multiple EMAs (Exponential Moving Averages) with periods 20, 50, and 100 to help in making trading decisions.
Entry Signals: The script uses two main entry signals: (1) Keltner Channel and (2) HHLL (High-Low). When the closing price crosses above the upper band of the Keltner channel, the script generates a long signal, and when the closing price crosses below the lower band of the Keltner channel, the script generates a short signal. The HHLL strategy generates a long signal when the current high crosses above the highest high of the last "nPeriod" bars, and generates a short signal when the current low crosses below the lowest low of the last "nPeriod" bars.
Exit Signals: The script uses two exit signals: (1) Stop Loss based on Keltner channel and (2) Profit Target based on Keltner channel. The script exits the long position when the closing price crosses below the lower band of the Keltner channel, and the script exits the short position when the closing price crosses above the upper band of the Keltner channel.
To use this script, you will need to have access to a trading platform that supports PineScript, such as TradingView, and attach the script to a chart. The script will then automatically generate entry and exit signals based on the rules described above. It's important to note that this script is just a tool and not a guarantee of profit. As with any trading strategy, it's important to thoroughly test and understand the script before using it for live trading.
Portföy Yönetimi
Position Sizer for UltraCap Trading Accreditation PlansWhen you enter a typical trading challenge, you are told that your accreditation assessment demo account is funded up to a certain amount. You are then told that you can only lose a small percentage of that account before you fail the accreditation/challenge. For example, if you are given a $100,000 dollar challenge demo account and are told that you can only lose up to 8% of that account ($8,000), then in reality, you really only have $8,000 to "trade" with before the game is over. That suggests that we need a risk management system that is initially based on the "true" amount of capital that we actually have to work with at the beginning of the assessment rather than an imaginary demo balance the prop firm gives us. Traditional forex risk management principles mandate that you never risk more than 2% of your trading capital on any one trade, the idea being that as long as your win rate is above some abysmally low level, it will take you a (hopefully) long time to run out of trading capital. That’s why the rules for passing an accreditation at the prop firm Ultra Cap mandate that you never risk more than 2% of your balance, or you will fail the assessment. With that in mind, I created this indicator/tool mostly for UltraCap accreditation candidates. In addition to using it to pass a prop firm assessment, you can also use it to increase your chances of surviving in an undercapitalized trading situation with your own money. For example, you could trade an actual $8,000 dollars (money that you really have) as if it were $100,000 (which is basically what any prop firm is asking you to do when they "give" you "$100,000" to trade with but only allow you lose a maximum of $8000). In that particular situation, the algorithm in this pricing model will base your initial risk exposure on an assumed account balance of $8000, and as you increase your balance, it proportionally increases risk exposure in the background until you reach a profit level of 6%, which just so happens to be the profit goal at Ultra Cap that gets you funded! This indicator uses a simple linear equation to progressively increase the risk exposure in the background based on your current stated account balance. Initially, your trade size will seem ridiculously small, but if your win rate holds up, the trade sizes will increase substantially as you get closer to the finish line.
Price Distance RatioThis study plots the ratio between current price and the price N days ago.
With N input that is configurable, users can find optimal long/short entries when price is in an established trend and price has diverge far from a given local peak or all time high.
With many years of stock trading the analysis indicates a connection between the distance of price and subsequent returns.
Portfolios of stocks with lower price to local highes ratios generally underperformed portfolios of stocks with higher prices to peaks reached similar N days ago.
The highest returns to previous peak are recorded when buying at the biggest dip.
For example, the purchase at 20% drawdown could generate 25% when price returns to the peak. The purchase at 50% drawdown could generate bigger, i.e. 100% return, when price returns to the peak. And the purchase at 90% drawdown could generate much bigger, i.e. 900% return, in a case the price returns to the peak.
However, buying very far below local peaks on almost all holding periods produces lower CAGR returns because of "timing adjustment". In simple words, typically the drawdown takes less time vs. further recovery.
For example:
👉 The largest BTC drawdown in 2013-2015 took 410 days (Peak-to-Valley) . And the recovery of BTC to new highs took 771 days (Valley-to-Peak) after that.
👉 The 3rd longest drawdown in BTC took 363 days (observed from December 17, 2017 to December 15, 2018). And further recovery in BTC to its new high took almost two years - 716 days .
👉The 4th longest drawdown in BTC took 162 days (observed from June 08, 2011 to November 17, 2011). And further recovery in BTC to its new high took more than a year - 469 days .
The concept of this study could recognizes at least 4 different modes of action.
👉 In a clearly established upward trend traders should be buying (following the trend) when Ratio is above 100% and reducing the size when Ratio turns below 100%.
👉 Conversely, in a clearly established downward trend traders should be shorted when Ratio is below 100% and covering when the Ratio turns back to 100%.
👉 In a sideways movement traders are advised to wait carefully if the Ratio near 100% for a long time, and take a position the trend is clear.
👉 Chartists can analyze the dynamic of the indicator - both in terms of trends and overall level. For example as it shown at the chart.
The understading of the study and rules of "timing adjustments" could genarate the awesome opportunities for stock options traders also, with strategies of selling uncovered call options and vertical call spreads.
// Many thanks to @HPotter and @Wheeelman wizards for their continious support and assistance.
mex_fundingScript for calculating Bitmex funding based on the Premium tickers Bitmex submits to Tradingview
Make sure you add the correct Bitmex Interest Base and Quote Symbols in the input settings
For example for www.bitmex.com the inputs are:
Chart ticker: XBTUSDPI8H
Input Settings
Interest Base: XBTBON8H
Interest Quote: USDBON8H
Spot Index Generator - The Quant Science Create your own spot index and compare returns with a benchmark. With this tool you will be able to quickly check if your portfolio management is better than the benchmark. It is a professional tool suitable for medium to long-term investors who need to create a personal and custom index with only spot assets and need to compare it with the return of a specific market.
Features
You can create your own indexes using up to 10 different assets. Through the user interface you can adjust the weight for each asset, and the initial capital with which to build the index.
Quantitative Data
1. Index Return vs. Benchmark Return
Compare your personal index with the benchmark.
2. Index Average Return vs. Index Return
Compare the return of your index with the average of returns. You can adjust the averaging through the user interface.
3. Volatility Index Analysis using Index Return and Average Index Return
Show the volatility of your index move over key levels created using the average of your index returns.
For the example used in the chart, we created a custom index for the crypto market, including 8 different assets:
1. KUCOIN:ETHUSDT , 10%
2. BINANCE:BNBUSDT , 10%
3. BINANCE:MATICUSDT , 20%
4. BINANCE:AVAXUSDT , 5%
5. BINANCE:SOLUSDT , 5%
6. KUCOIN:GODSUSDT , 10%
7. KUCOIN:SANDUSDT , 10%
8. BITGET:SHIBUSDT , 30%
The reference benchmark is KUCOIN:SANDUSDT .
The period of analysis start at January 1, 2023 to today.
Timeframe selected: 5 min
Capital: 1000 USDT
Following the benchmark analysis, the built index (lime color) does not perform better than the benchmark (blue color). As can be seen, the index created a lower return than the benchmark.
Rotational Gravity OscillatorMade using elements from two Cheatcountry scripts:
Includes a Bollinger Band for bounds that forms a trend follower based on the 0 point.
Includes CheatCountry color code signals, different color scheme. Bright colors are strong signals, ark are weak, green bull, red bear, the basics.
Switches for Bollinger Band color codes, which can actually be useful signals.
This oscillator can be used for divergences, trends, signal strength, confirmation, volatility readings, you name it.
It is a comparative oscillator, that compares adaptively smoothed, weighted modified Change of Gravity oscillators between 2 symbols and multiple lengths to determine directional momentum as one asset compares to another.
The default uses the Crypto TOTAL market cap to help trade cryptocurrencies. You will notice that BTC will give sell signals in uptrends at times. That is because it is being compared to an index of the total Crypto market cap, and since alt-coins move faster, BTC will lag behind this index.
Give CheatCountry a follow, hes one of the MVPs of Tradingview Pinescripters, constantly giving us access to novel new concepts as they are published by professionals.
Lots / Leverage / Margin [JoseMetal]============
ENGLISH
============
- Description:
This is a utility indicator, it prints a table with ATR, Volatility, Lotage and Margin for 3 custom timeframes, using the ATR of basis, it calculates volatility (%) and a recommended lotage depending on your risk settings.
A few months ago i fled from crypto exchanges to regulated brokers, and working with lots instead of plain margin was a bit of headache, i also trade with crypto, currencies, metals and indexes, each with different volatility, leverage... so this tool was a MUST for me to code.
So basically, this tool allows to keep the same RISK for every single asset, no matter if they have different volatility.
- Visual:
The indicator shows a table with all the info explained, ATR, Volatility...
For each timeframe it also prints 3 periods, short, long and average, you can show/hide timeframes and the different periods.
- Customization:
Colors in the table are custom, as well as the font size.
The risk management settings start with the margin you want to use as average, then you can customize your asset leverage, the risk (which is a value you HAVE to keep the same for all assets to balance the results correctly) and units per lot.
You can increase/decrease risk if you want to, i personally take DAILY values with a 18-20 risk to trade on a 4H chart.
For the "units per lot" take in mind that usually that value is ONE, but in some assets with really low value like currencies or some crypto your broker can set 1 lot to xxxx units, that's why you have that option.
- Usage and recommendations:
As i said i trade from 4H to daily, that's why my risk setting is 18-20, i use the lots plotted in the table on DAILY.
If you're more a scalper, just adjust the timeframes to your needs :)
Enjoy!
============
INGLÉS
============
- Descripción:
Este es un indicador de utilidad, imprime una tabla con ATR, Volatilidad, Lotaje y Margen para 3 temporalidades personalizadas, usando el ATR de base, calcula la volatilidad (%) y un lotaje recomendado dependiendo de tu configuración de riesgo.
Hace unos meses cambié de intercambios crypto (exchanges) a brokers regulados, y trabajar con lotes en lugar de margen simple era un poco dolor de cabeza, también tradeo con crypto, divisas, metales e índices, cada uno con diferente volatilidad, apalancamiento... así que esta herramienta era IMPRESCINDIBLE para mí de programar.
Básicamente, esta herramienta permite mantener el mismo RIESGO para cada activo, sin importar si tienen diferente volatilidad.
- Visual:
El indicador muestra una tabla con toda la información explicada, ATR, Volatilidad...
Para cada temporalidad también imprime 3 períodos, corto, largo y medio, puedes mostrar/ocultar los marcos temporales y los diferentes periodos.
- Personalización:
Los colores de la tabla son personalizados, así como el tamaño de la fuente.
La configuración de la gestión del riesgo comienza con el margen que deseas utilizar como promedio, a continuación, puedes personalizar el apalancamiento del activo, el riesgo (que es un valor que TIENE que mantener igual para todos los activos para equilibrar los resultados correctamente) y las unidades por lote.
Puedes aumentar/disminuir el riesgo si quieres, yo personalmente tomo valores DIARIOS con un riesgo de 18-20 para operar en un gráfico de 4H.
Para las "unidades por lote" ten en cuenta que normalmente ese valor es UNO, pero en algunos activos con valor realmente bajo como divisas o algunas criptomonedas tu broker puede poner 1 lote a xxxx unidades, por eso agrego esa opción.
- Uso y recomendaciones:
Como dije yo opero de 4H a diario, por eso mi ajuste de riesgo es de 18-20, uso los lotes graficados en la tabla en DIARIO.
Si eres más un scalper, sólo tienes que ajustar las temporalidades a tus necesidades :)
¡Que lo disfrutes!
Live Portfolio ScreenerThe live portfolio screener indicator is a tool that help users to track the performance of their investments in real-time. The indicator provides a detailed breakdown of the user's portfolio, including the current profit and loss (P&L) for each stock that is invested in. This allows users to quickly and easily see how their portfolio is performing and make informed decisions about their investments on charts. Overall, this tool is an essential tool for anyone looking to stay on top of their investments and make data-driven decisions.
This indicator can load any symbol globally usable.
How to use this indicator ?
in this indicator firstly
you have add script name. (For example if you want to add symbol you have add in 's01 ' means the first symbol)
after that
you have to add price for each (For example if you want to add buy price for the first symbol then add the buy price in ' Bp01 ')
then the quantity comes in picture which is below price list and named here as Bq01 which means 'Buy quantity for first symbol'
Basic Position Calculator (BPC)In trading, proper position sizing is essential to managing risk and maximizing returns. The script provided is a Basic Position Calculator that allows traders to quickly and easily calculate their position size, stop loss, take profit, and risk reward ratio for a given trade.
The script starts by defining several inputs for the user to customize the calculations. The first input is the "Account Size", which specifies the total amount of funds available for the trade. The next input is "Risk Amount %", which is the percentage of the account size that the trader is willing to risk per trade. The "Stop Loss" input specifies the maximum amount of loss that the trader is willing to accept, while the "Reward" input is the desired profit target for the trade. Finally, there is a "Position" input that allows the user to specify where on the chart the table of calculations will be displayed.
The script then calculates the position size, stop loss, take profit and risk reward ratio using the user-specified inputs. The position size is calculated by dividing the risk amount by the stop loss. The stop loss is calculated by multiplying the stop loss percentage by the close price, and the take profit is calculated by multiplying the stop loss percentage by the close price and the reward. Risk-reward ratio is the ratio of amount of profit potential to the amount of risk in a trade.
The script then creates a table and displays the calculated values on the chart at the specified location. The table includes the following information: account size, position size, account risk %, stop loss, stop loss %, take profit, take profit % and risk reward ratio. This allows the trader to quickly and easily see all the key calculations for their trade in one place.
Overall, the Basic Position Calculator script is a valuable tool for any trader looking to quickly and easily calculate their position size, stop loss, take profit, and risk reward ratio for a given trade. The ability to customize the inputs and display the calculations on the chart makes it a useful and user-friendly tool for managing risk and maximizing returns.
Cuban's Pair Trading IndexThe purpose of this indicator is to visually simplify the relationship between two assets when searching for pair trades or higher beta opportunities.
With highly correlated pairs, it can be a blessing or a curse during volatility when you're somehow stuck in the only lower beta pairs, or maybe you're market neutral and the wrong leg starts nuking.
This indicator was built as a visual way to track pair relationships.
Fundamentally, this script does the following:
Plots the relative performance of the relationship between two assets across multiple time horizons
Uses a consistent measurement of historical performance, regardless of asset -- currently standard deviations, may add log difference in the future
Plots a custom Average Directional Index on the current chart ticker for current asset contextual momentum
Plots the average 'rotation' of both the ADX and Pair Delta independently, over n numbers of rotations -- able to be specified using the 'Rotation Lookback' variable
If you've never pair traded crypto before (i.e. long $DYDX, short $ETH), you might not be aware that most highly correlated alt asset returns tend to oscillate on a low timeframe rolling basis around the performance of the majors -- and more recently, predominantly $ETH. With this in mind and using this oscillator, we can track that relationship.
Users are given the ability to adjust the following:
Comparison Asset
Fast and Slow Delta Lookbacks
Whether to wait for one bar delay during security calls
Rotation Lookback
Rotation Threshold for Pair Delta and ADX independently
ADX Lookback
Whether to utilize the ADX on the current chart ticker or also net that off against the ADX of the comparison asset
TO DO:
Aesthetic update to Pair Delta plot
Permanent fix for security call forced delay
Cuban's Asset ScreenerCuban's Asset Screener is a tool designed to view the health of the entire market in a single charting window, using a multi-timeframe, real-time heatmapped asset screener built natively within Tradingview.
You can use this tool to aggregate and display critical information required to identify your favorite trade ideas using other Cuban's Edge tools. Although the screener currently uses pre-built lists for over 200+ Binance and Bybit Futures pairs, the tool comes with custom watchlist support, allowing you to add as many additional assets as your screen and browser will support.
Currently tracking range positions and a custom cross asset delta function from Cuban's Pair Trading Index, the screener has an in-built sorting function which orders assets by similar market structure and colors them relative to their performance against the user's comparison asset -- their current chart ticker.
Cuban's Asset Screener is also valuable as a tool to monitor performance of your portfolio against any benchmark asset, by using the 'Asset Redenomination' option within the settings. This allows the user to redenominate the entire screener easily using their current chart ticker.
In order to setup the Asset Screener, the user will need to select an 'Asset List' and a 'Screen Location' value. This will load the screener into a set position on screen, from right to left. In order to add additional assets, multiple instances of the asset screener will need to be loaded on screen.
With this indicator, users get the option to adjust the following:
range positioning lookback
asset redenomination for range positioning
asset sorting order
screen location
multi-timeframe support
live pricing for PTI values
in-built asset lists for 200+ assets
TO DO:
add market filters to the coloring
add tradfi asset lists
Strategy Developer ToolSolar Strategies: Strategy Developer Tool Complete Guide
This guide provides full explanation of the intended purpose of our script along with individual explanation of each input and the logic behind them coupled with general knowledge which we find useful in using our tool regarding elements of risk and strategy. Use this information wisely and understand we are not providing financial advise, this is a learning tool meant to help advance traders knowledge of the markets and their strategies which are formed as such.
Basics
Before getting into the specifics of how to use our strategy developer tool, it's important to understand a few basic fundamental things about it. The purpose of the tool is to allow the user to optimize a strategy through back testing with our strategy tracker and 50+ user inputs. The way you optimize your strategy depends on a couple things:
The state of the current and recent previous market.
The timeframe you trade on.
The types of trades you prefer. (swings, scalps, etc.)
How much risk you are willing to take on.
Risk Basics:
Going off the last bullet point on the list above, risk plays a huge part in how you optimize your strategy, with that being said here are a few general rules of risk as they relate to trades:
The more trades you take on, the more risk you are opening your strategy up to.
If done correctly, more trades will often result in more profit with slightly lower accuracy, and more risk.
The less trades you take on, the easier it is to have higher accuracy because ideally by rooting out the losing trades, you are left with fewer overall trades but mostly winning trades.
Less trades with higher accuracy often result in less profit but will 100% be less risky than the opposite. (More trades, less accurate, more profit, MORE RISK)
Input Basics:
More trades, less trades, more risk, less risk, what does this all mean as it relates to our tool?
The 50+ user inputs that allow you to optimize and create your strategy all effect when the script takes a trade.
Many of the inputs are essentially conditions. By changing these inputs, what you are doing is changing how specific the conditions need to be in order to take a trade.
This is how the inputs tie into the bullet point list above regarding risk and the number of trades you take on. By raising or lowering certain inputs, you are making the conditions more or less specific on when to trade.
Making conditions more specific will allow for less trades to be taken and will often result in a higher win rate, and less associated risk.
Making conditions less specific will allow for more trades to be taken and depending on the state of the market, could result in more profit being realized, but at the same time opens you up to more risk because you are stating a more general set of conditions in order to take a trade.
How does it work?
Our strategy developer tool is based on two simple factors in order to identify specific areas in the market deemed good for trade. They are as follows:
Directional momentum to identify when a move might happen.
A confirmation of the desired move.
Indicators:
The tool gets its information on these two factors from two custom built indicators which are hard coded into the script. These two indicators and the inputs which affect them can be found labeled with Indicator 1 or Indicator 2 in the tool's settings.
When the conditions are met based on the factors of both indicators, it then decides your stop losses and take profits using pivot points.
Indicator 1 is the momentum indicator.
Indicator 2 looks for confirmation of the move.
Hedges:
Since nothing is ever certain when trading, our tool also aims to minimize potential loss before it can happen by incorporating hedges when a signal prints in the opposite direction of the trade you are currently in.
To identify when to hedge, the candles will appear with the opposite color of your original trade. Candles, while in a long trade, appear as green and candles while in a short trade appear as red. While in a long trade the only time red candles will appear is when a hedge occurs and vice versa for shorts.
Example: If you just took a long trade based on a long signal that the script gave off, but a short signal prints off while you are in the long, you are directed to sell half your long position and enter that half into a short position. Since there is now more uncertainty in the long because of the short signal, minimizing your position size and having a smaller position in the opposite direction allows you to cover your bases if the trade moves against you. If it doesn’t move against you and ends up going long as originally intended, you are not to lose any money, likely a small profit or break even when all is said and done.
In order to give the hedges a greater change of hitting, the take profits are smaller than a normal trade, this way even if your hedge wasn’t necessary and the original trade does not move against you, it's likely that your hedge will still win, and you can just consider it a small scalp to further your profits on the original trade.
Doubles:
Besides minimizing loss, we also aim to maximize the potential gain. When a second signal prints off in the direction of the trade you are currently already in, the tool directs you to double your position size.
The signal for doubling is a label with “2x” written inside.
The logic here is similar to hedging but in the opposite way. Just as a signal in the opposite direction creates uncertainty, a signal in the same direction indicates more certainty hence doubling your position size.
Example: If you are currently in a long position and you get a second long signal, you would then double your existing position since two long signals printing off before the first one has a chance to play out indicates a stronger chance of movement in the intended direction of your trade.
User Inputs
Upon opening the tools settings tab, you will find all the user inputs which can then be modified to fit your desired strategy. In this section of our guides, you will find individual explanations and use cases for each input so you can correctly use them to your best advantage.
Strategy Tracker Table:
By ticking this input on, the strategy tracker table will be visible to the user. (Default is on)
Indicator 1 Greater Than: Long:
By ticking this input on, you are adding a condition the script will then look for in order to take a long. (Default is on)
This condition is that an average of indicator 1, which searches for momentum, must fall above a certain level, which is determined in the next input.
The purpose of this is to ensure that the average momentum is not too low because this would indicate prolonged downwards movement on the timeframe of the market being observed, making a long position riskier.
Indicator 1 Greater Than Input: Long:
This input correlates to the previous input directly above.
If Indicator 1 Greater Than: Long is ticked on, then one of the conditions in order to take a long position will be that the average of indicator 1 must fall above the level which you set in this input.
max level 100, min level 0
Indicator 1 Less Than: Long
By ticking this input on, you are adding a condition the script will then look for in order to take a long position. (Default is on)
This condition is that an average of indicator 1, which searches for momentum, must fall below a certain level, which is determined in the next input.
The purpose of this is to ensure that the average momentum is not too high, because this would indicate a prior significant upwards movement or trend on the timeframe of the market being observed.
Taking a long position while the average momentum is at higher levels exposes the risk of longing as the market has started to pull back from a peak or when the market has just reached a peak.
Indicator 1 Less Than Input: Long
This input correlates to the previous input directly above.
If Indicator 1 Less Than: Long is ticked on, then one of the conditions in order to take a long position will be that the average of indicator 1 must fall below the level which you set in this input.
max level 100, min level 0
Indicator 1 Greater Than: Short
By ticking this input on, you are adding a condition the script will then look for in order to take a short. (Default is on)
This condition is that an average of indicator 1, which searches for momentum, must fall above a certain level, which is determined in the next input.
The purpose of this is to ensure that the average momentum is not too low because this would indicate prolonged downwards movement or trend on the timeframe of the market being observed.
Taking a short position while the average momentum is at lower levels exposes the risk of shorting as the market has started to recover from a bottom or when the market has just reached a bottom.
Indicator 1 Greater Than Input: Short
This input correlates to the previous input directly above.
If Indicator 1 Greater Than: Short is ticked on, then one of the conditions in order to take a short position will be that the average of indicator 1 must fall above the level which you set in this input.
max level 100, min level 0
Indicator 1 Less Than: Short
By ticking this input on, you are adding a condition the script will then look for in order to take a short position. (Default is on)
This condition is that an average of indicator 1, which searches for momentum, must fall below a certain level, which is determined in the next input.
The purpose of this is to ensure that the average momentum is not too high, because this would indicate a prior significant upwards movement or trend on the timeframe of the market being observed.
Taking a short position while the average momentum is at higher levels exposes the risk of shorting as the market is currently in a strong uptrend.
Indicator 1 Less Than: Short
This input correlates to the previous input directly above.
If Indicator 1 Less Than: Short is ticked on, then one of the conditions in order to take a short position will be that the average of indicator 1 must fall below the level which you set in this input.
max level 100, min level 0
Summary of Input Group: Indicator 1 Greater/Less Than Long/Short
This grouping of inputs is best used as a filter of sorts, much like many of the other inputs which are also essentially filters of the market to find areas ripe for trade. Specifically, however, this group of inputs is especially powerful because if used correctly, it can specify a range for the average momentum to fall in when looking for either long or short trades. Think of it like a sweet spot where the average is not too high nor too low. In combination with the numerous other inputs which will shortly be explained, this sweet spot can be a great indication. Keep in mind that once you find a working range, this will not last forever. Conditions in the market are ever changing and as such your inputs, in this case the range the average momentum must fall in, will also need to change with the market conditions.
Bars Since Crossover:
This input simply describes a crossover of the momentum indicator (indicator 1) and its average.
In the category How does it work? Two main factors are discussed, the first being directional momentum to determine when an upwards move might happen. The crossover correlated to this input is the directional momentum as mentioned earlier.
As also mentioned in How does it work? The second factor is a confirmation of the desired upwards move. This confirmation is a crossover of the current price and indicator 2 which will be further addressed later on.
What's important to understand about the two key factors at play in regard to Bars Since Crossover is that this input is determining a condition which looks for a certain number of bars prior to the confirmation of indicator 2 which the crossover of momentum and its average has happened on indicator 1.
Example: Bars Since Crossover input is set to 10. This means that the crossover of momentum and its average from indicator 1 must be within 10 bars prior to the confirmation from indicator 2. If this happens then this condition is met for a long position.
Bars Since Crossunder:
This input simply describes a crossunder of the momentum indicator (indicator 1) and its average.
In the category How does it work? Two main factors are discussed, the first being directional momentum to determine when a downwards move might happen. The crossunder correlated to this input is the directional momentum as mentioned earlier.
As also mentioned in How does it work? The second factor is a confirmation of the desired downwards move. This confirmation is a crossunder of the current price and indicator 2 which will be further addressed later on.
What's important to understand about the two key factors at play in regard to Bars Since Crossunder is that this input is determining a condition which looks for a certain number of bars prior to the confirmation of indicator 2 which the crossunder of momentum and its average has happened on indicator 1.
Example: Bars Since Crossunder input is set to 10. This means that the crossunder of momentum and its average from indicator 1 must be within 10 bars prior to the confirmation from indicator 2. If this happens then this condition is met for a short position.
Summary of Input Group: Bars Since Crossover/Crossunder
These two inputs can have a large effect on the types of trades being taken and the risk which your strategy opens up to. The idea is that in order for the two key factors described in How does it work? to be correlated and therefore indicate a strong directional move, the two events must happen within a somewhat small period of time. If the period of time between the two events taking place is too large, then it's riskier for your strategy due to a delay in directional momentum and the necessary confirmation. It's important to note that this “small period of time” is relative to the security you're trading and the timeframe its being trades on. Small could mean 5 bars in some cases or 20 bars in others, this is why our custom back tester exists. So that the process of optimization on different securities and different timeframes is smooth and only requires adjustments to inputs then your own analysis of the back test results.
Indicator 1 Input Long
Defines how strong the upwards momentum needs to be in order to take a long position.
When optimizing your strategy, this input is likely to have some of the most effect on when the script takes a long position.
The reasoning for this is because the level you set for this input is the level which indicator 1 must close above following the crossover of its average.
Example: Indicator 1 Input Long set to 50, this means that when the momentum crosses over its average from indicator 1, upon the close of this crossover the momentum must be above the level 50 in order for this condition to be met to take a long position.
The higher the level, the stronger the upwards momentum must be, and therefore by using higher levels for this input, the script will search for stronger directional moves leaving less chance for the trade to move against you.
Indicator 1 Input Short
Defines how strong the downwards momentum needs to be in order to take a short position.
When optimizing your strategy, this input is likely to have some of the most effect on when the script takes a short position.
The reasoning for this is because the level you set for this input is the level which indicator 1 must close below following the crossunder of its average.
Example: Indicator 1 Input Short set to 40, this means that when the momentum crosses under its average from indicator 1, upon the close of this crossunder the momentum must be below the level 40 in order for this condition to be met to take a short position.
The lower the level, the stronger the downwards momentum must be, and therefore by using lower levels for this input, the script will search for stronger directional moves leaving less chance for the trade to move against you.
Summary of Input Group: Indicator 1 Input Long/Short
These two inputs are so important to your strategy because at the end of the day no matter how you set it up, it's still a momentum-based strategy. With that being said the level of momentum or the strength needed in order to take trades is of course going to be a key decider in the successfulness of the strategy. When optimizing these two inputs make sure to take into account what the overall market conditions are, meaning if it’s a bull market maybe make the momentum needed to take a long slightly less comparatively to the amount needed to take a short, in other words make long conditions less specific and short conditions more specific. Slight variations of this input can have very big effects, even changing it by 1 or 2 can make a major difference. In might even be good to consider starting optimization with these inputs and then work the rest of the strategy out from there. A lot could be said about these inputs and more docs will be added in order to further explain more strategy approaches revolving around them, for now don’t hesitate to ask any questions.
Indicator 2 Red
This input is used as a sort of chop filter at its base level, however if used correctly it can be a much broader filter for what areas of the market you want to trade in.
Indicator 2 shows as either red or green and is used as a confirmation when price crosses over it following the crossover of momentum and its average from indicator 1 to take a long position.
If ticked on, Indicator 2 Red states a condition in order for the script to take a long position. (Default is on)
The condition is that upon the crossover of the current price and Indicator 2, 10 bars ago indicator 2 must have been red.
The reason for this input is because the current color of indicator 2 upon the crossover must also be red. However, this condition is hard coded in and cannot be changed by any input.
This is because the type of trade being targeted is that of a type of reversal or continuation.
If indicator 2 showed green 10 bars ago and is currently red this would indicate that a top was just reached, and price is reversing downwards making this not a good area to take a long.
Another scenario if indicator 2 showed green 10 bars ago and is currently red is that there is currently a sideways trend going on or otherwise known as chop, also not an ideal area to take a long
However, if 10 bars ago indicator 2 was red and it's currently red this would indicate a more prolonged pullback.
If all conditions are met and we know that price has been pulling back, now we can enter a long with more knowledge pointing to price reversing upwards from a downwards trend, or continuing its upwards trend after a pullback.
Indicator 2 Green
This input is used as a sort of chop filter at its base level, however if used correctly it can be a much broader filter for what areas of the market you want to trade in.
Indicator 2 shows as either red or green and is used as a confirmation when price crosses under it following the crossunder of momentum and its average from indicator 1 to take a short position.
If ticked on, Indicator 2 Green states a condition in order for the script to take a short position. (Default is on)
The condition is that upon the crossunder of the current price and Indicator 2, 10 bars ago indicator 2 must have been green.
The reason for this input is because the current color of indicator 2 upon the crossunder must also be green. However, this condition is hard coded in and cannot be changed by any input.
This is because the type of trade being targeted is that of a type of reversal or continuation.
If indicator 2 showed red 10 bars ago and is currently green this would indicate that a bottom was just reached, and price is reversing upwards making this not a good area to take a short.
Another scenario if indicator 2 showed red 10 bars ago and is currently green is that there is currently a sideways trend going on or otherwise known as chop, also not an ideal area to take a short.
However, if 10 bars ago indicator 2 was green and it's currently green this would indicate a more prolonged upwards movement.
If all conditions are met and we know that price has been moving up, now we can enter a short with more knowledge pointing to price reversing downwards from an upwards trend, or continuing its downwards trend after a bounce up.
Summary of Input Group: Indicator 2 Red/Green
Similar to Indicator 1 Greater/Less Than Long/Short, the goal of these inputs is to try to get a picture of what the previous recent market has been doing. By getting this picture it's easier to find different areas of the market more ideal for trades. Different from Indicator 1 Greater/Less Than Long/Short though, Indicator 2 Red/Green is directly correlated to the price action in the market rather than the momentum. By switching these on or off you are setting more or less specific conditions for taking trades. Some markets require this extra condition to lower your risk in your strategy, however others may not.
Pivot Low
This input is used to define the number of bars the script will look back to grab a pivot low when taking a long position.
This pivot low is then used to set the stop loss when entering a long position.
This input is very important and optimizing it correctly can be extremely crucial to your strategies success.
The Strategy Developer tool uses a 1:1 risk to reward ratio when setting your first take profit point, so when the script looks back to get a pivot low based on the input you set, it will then set your first take profit at an equal ratio to the stop loss found from the pivot low.
The goal in optimizing this input is to give enough lookback to find real pivot points where price has reversed off of, but not to give too much lookback where its grabbing previous pivot points unrelated to the current move of momentum the script is giving a long signal from.
Consider the type of trades you're looking for in your strategy and what timeframe you are trying to trade on.
Longer swing trades which aim to catch bigger moves in the market, possibly on higher time frames, may require a further lookback in order to get your take profits in the correct positioning to catch the desired move, and not exit early before the trade has fully played out.
Shorter scalp trades may aim to catch smaller moves and therefore you don’t want to allow for too much risk by having a large stop loss and large take profits as a result.
Pivot Low 2
Pivot low 2 can be thought of as a backup lookback in order to get the correct pivot low.
In an input which will be discussed shortly called Pivot Low Minimum, you can set a minimum percentage for your pivot low to be, if the pivot low does not meet the minimum then the script will look to Pivot Low 2’s input to use as a bar lookback in order to get the correct pivot low.
This input is used because you might find a Pivot Low input that works well for the majority of the trades in your back tested strategy, however, there will always be outliers and when this Pivot Low input falls short of getting the correct level to put your stop losses at, Pivot Low 2 is used.
Pivot Low 2’s input should always be higher than Pivot Low’s input, that way you can allow the script to look back further in time to find the correct level when the minimum is not met.
Pivot High
This input is used to define the number of bars the script will look back to grab a pivot high when taking a short position.
This pivot high is then used to set the stop loss when entering a short position.
This input is very important and optimizing it correctly can be extremely crucial to your strategies success.
The Strategy Developer tool uses a 1:1 risk to reward ratio when setting your first take profit point, so when the script looks back to get a pivot high based on the input you set, it will then set your first take profit at an equal ratio to the stop loss found from the pivot high.
The goal in optimizing this input is to give enough lookback to find real pivot points where price has reversed off of, but not to give too much lookback where its grabbing previous pivot points unrelated to the current move of momentum the script is giving a short signal from.
Consider the type of trades you're looking for in your strategy and what timeframe you are trying to trade on.
Longer swing trades which aim to catch bigger moves in the market, possibly on higher time frames, may require a further lookback in order to get your take profits in the correct positioning to catch the desired move, and not exit early before the trade has fully played out.
Shorter scalp trades may aim to catch smaller moves and therefore you don’t want to allow for too much risk by having a large stop loss and large take profits as a result.
Pivot High 2
Pivot high 2 can be thought of as a backup lookback in order to get the correct pivot high.
In an input which will be discussed shortly called Pivot High Minimum, you can set a minimum percentage for your pivot high to be, if the pivot high does not meet the minimum then the script will look to Pivot High 2’s input to use as a bar lookback in order to get the correct pivot high.
This input is used because you might find a Pivot High input that works well for the majority of the trades in your back tested strategy, however, there will always be outliers and when this Pivot High input falls short of getting the correct level to put your stop losses at, Pivot High 2 is used.
Pivot High 2’s input should always be higher than Pivot High’s input, that way you can allow the script to look back further in time to find the correct level when the minimum is not met.
Pivot Low Risk Tolerance
This input is very important in managing the risk associated with your strategy.
Pivot Low Risk Tolerance is defining a maximum percentage the pivot low can be away from your entry.
Since the pivot low that’s found is assigned to your stop loss and directly affects the placement of your take profits when taking a long position, making sure the pivot low isn’t too far down is crucial.
Depending on the types of trades you're aiming to take, the timeframe you choose to trade on, and the leverage you use in your strategy, you may want to assign a higher risk tolerance or a lower one.
Example: Pivot Low Risk Tolerance input set to 3, this means that when all other conditions are met in order to take a long position, when searching for the pivot low in order to set a stop loss, if the script finds the pivot low is greater than 3% away from the entry point, it will not take the trade.
Pivot High Risk Tolerance
This input is very important in managing the risk associated with your strategy.
Pivot High Risk Tolerance is defining a maximum percentage the pivot high can be away from your entry.
Since the pivot high that’s found is assigned to your stop loss and directly affects the placement of your take profits when taking a short position, making sure the pivot high isn’t too far up is crucial.
Depending on the types of trades you're aiming to take, the timeframe you choose to trade on, and the leverage you use in your strategy, you may want to assign a higher risk tolerance or a lower one.
Example: Pivot High Risk Tolerance input set to 3, this means that when all other conditions are met in order to take a short position, when searching for the pivot high in order to set a stop loss, if the script finds the pivot high is greater than 3% away from the entry point, it will not take the trade.
Pivot Low Minimum
Sometimes when searching for the pivot low, the script's defined lookback may not be enough to find the proper pivot point.
This can cause improper placement of stop losses and take profits and may cause trades to be exited early before they can fully play out in your favor.
Pivot Low Minimum is an input used to combat this problem, when the script finds a pivot low that does not meet the minimum percentage away from the entry point, it will then turn to Pivot Low 2 input in order to gain a further lookback and grab the correct pivot point to set your stop loss and take profits with.
When reading and setting this input, understand that setting it to 1 means there is no minimum, setting it to 0.9 would mean the minimum is a 10% difference between the pivot low and your entry point.
Think of it in terms of decimals and their equivalent percentage, 0.1 is equal to 10%, 0.01 is equal to 1%.
Whatever percentage you want to set for a minimum, convert it to a decimal, then simply subtract it from 1.
Example: Say you desire a 1.5% minimum pivot low and as a result an equivalent stop loss of 1.5% below your long entry and furthermore a take profit 1.5% above your long entry since the script uses a 1:1 ratio. Converting 1.5% to a decimal would give you 0.015, then subtracting it from 1 would give you 0.985, this would be the input assigned to Pivot Low Minimum.
Pivot High Minimum
Sometimes when searching for the pivot high, the script's defined lookback may not be enough to find the proper pivot point.
This can cause improper placement of stop losses and take profits and may cause trades to be exited early before they can fully play out in your favor.
Pivot High Minimum is an input used to combat this problem, when the script finds a pivot high that does not meet the minimum percentage away from the entry point, it will then turn to Pivot High 2 input in order to gain a further lookback and grab the correct pivot point to set your stop loss and take profits with.
When reading and setting this input, understand that setting it to 1 means there is no minimum, setting it to 0.9 would mean the minimum is a 10% difference between the pivot high and your entry point.
Think of it in terms of decimals and their equivalent percentage, 0.1 is equal to 10%, 0.01 is equal to 1%.
Whatever percentage you want to set for a minimum, convert it to a decimal, then simply subtract it from 1.
Example: Say you desire a 1.5% minimum pivot high and as a result an equivalent stop loss of 1.5% above your short entry and furthermore a take profit 1.5% below your short entry since the script uses a 1:1 ratio. Converting 1.5% to a decimal would give you 0.015, then subtracting it from 1 would give you 0.985, this would be the input assigned to Pivot High Minimum.
Summary of Input Group: Pivot Low/High - Pivot Low/High 2 – Pivot Low/High Risk Tolerance – Pivot Low/High Minimum
The first key takeaway from all these inputs is that your stop losses and take profits will be directly affected through optimizing any of them. The second key takeaway is that these inputs are crucial in managing the risk in your strategy, and while this has been said many times throughout the guide for various inputs, when it comes to stop losses and take profits it is especially true. Having a stop loss which is too high opens up the possibility for much bigger losses, and as a result your take profits will also be too high, minimizing the chance of any of them being hit. Having a stop loss which is too low increases the chance that your trade will get stopped out preemptively, before the trade can mature and move in your favor because remember that trades will not always move immediately in the intended direction, a good amount of patience is often involved in creating consistent successful trades and a successful strategy as such. On the same note, too low of a stop loss could also mean you are missing out on unrealized profit since your take profits are a direct result of the stop loss which is found. When optimizing your pivot low/high risk tolerance, think not about how much you are willing to lose on a single trade, but how much your portfolio can actually afford to lose not just on a single trade but multiple trades, sometimes even in a row. Obviously, the goal in creating a strategy is that you avoid losing trades and especially multiple in a row, however, there are many things that can’t be accounted for. The only way to manage this unaccounted risk is to use proper risk management and not open yourself up to big losses even in the worst most unlikely scenarios. Even if you don’t lose multiple trades in a row, ask yourself, could I afford to lose multiple trades with the risk tolerance I have set if everything were to go to $hit, (hopefully it would not), but in the off chance it did, instead of beating yourself up over what you did wrong, you’ll be patting yourself on the back for what you did right.
TP2-4 Long Placement
The first thing to understand about the take profit placement is that our system of stop losses and take profits uses a 1:1 risk to reward ratio for the first stop loss and first take profit.
This means that if your stop loss falls 2% below your long entry, your first take profit will be 2% above your long entry, hence 1:1.
As for take profits 2-4, they are just extensions of that ratio. This means that if TP2 Long Placement is set to 1.5, the ratio for your second take profit is 1:1.5.
Using the same percentage from the second bullet point being 2%, we can now gather that with a 1:1.5 ratio our second take profit would be at 3% above our long entry.
The same applies for the rest of the take profits, meaning whatever the take profit is set at regardless of which one, apply that number to the second placeholder of the ratio.
Example: First stop loss falls 2% below long entry. TP2 Long Placement input set to 1.5; risk to reward ratio is 1:1.5; corresponding percentage would be a 3% gain. TP3 Long Placement input set to 2; risk to reward ratio is 1:2; corresponding percentage would be a 4% gain. TP4 Long Placement input set to 2.5; risk to reward ratio is 1:2.5; corresponding percentage would be a 5% gain.
The next key thing to understand about the trailing take profits system is the position size being sold at each take profit and therefore how the strategy tracker calculates your strategy's profit.
At the first take profit, 50% of your position is being calculated as sold, locking in good profits off the bat.
At TP2, 20% of your position is being calculated as sold, leaving a remaining 30% open to gain more profit.
At TP3, another 20% of your position is being calculated as sold, leaving 10% to collect any additional possible gains.
At TP4 the remaining 10% of your position is sold and the trade will be fully closed out.
SL2-4 Long Placement
Our system of trailing stop losses is completely similar to that of our trailing take profits.
Just like the trailing take profits, the inputs for stop losses 2-4 are also used as the second placeholders in the risk to reward ratio.
This may be confusing since generally stop losses are associated with a loss on your position, however, the only stop loss which results in a loss on your position is the first one, not stop losses 2-4.
This is because once your first take profit is hit on your long, your stop loss will automatically move up to the price equivalent to the ratio which you set using these inputs that lies in profit.
Example: Since your first take profit will always be at a 1:1 risk to reward ratio with your stop loss, your second take profit could be at a 1:0.8 ratio. So, to clarify, once your first take profit is hit at a 1:1, your original first stop loss will now be moved up in profits to just below your first take profit at a 1:0.8 risk to reward ratio. This only happens AFTER the first take profit is hit.
For stop losses 3 and 4, the same logic is true, once TP2 is hit, your second stop loss will now be moved up to the placement of SL3 which will fall somewhere below TP2. Once TP3 is hit, your third stop loss will now be moved up to the placement of SL4 which will fall somewhere below TP3. If stop loss 4 does not get hit, then the only thing left to happen is for TP4 to hit and the trade will fully close out.
The one major difference between our system of trailing stop losses and take profits is that no matter what stop loss is hit, the entire remainder of your position will be calculated as sold.
So, if your first take profit hits and sells 50% of your long position, but the trade does not continue upwards and moves down to your second stop loss, the remaining 50% of your position will be calculated as sold.
The same applies to SL3 and SL4, so at SL3 the remaining 30% of your position will be calculated as sold, and at SL4 the remaining 10% will be calculated as sold.
Your trailing stop loss placement is dependent on what types of trades you desire. For shorter scalps on smaller timeframes, it's recommended to place each stop loss just below each corresponding take profit for long trades.
This way you leave just enough room for the trade to continue upwards if there is enough momentum, but you don’t open yourself up to losing your unrealized profit if it does not make this continuation.
If you desire longer swing trades on higher timeframes, it might be a good idea to leave more room in between the take profit and corresponding stop loss.
This way you leave more room for the trade to mature and move in your favor since when trading longer moves, often they will not shoot straight up but rather have a series of small pullbacks throughout the more general upwards trend.
Note that when a long trade is first entered the only stop loss and take profit in play are your original stop loss found by the pivot low which would result in a loss, and the first take profit at a 1:1 risk to reward ratio from that pivot low.
TP2-4 Short Placement
The first thing to understand about the take profit placement is that our system of stop losses and take profits uses a 1:1 risk to reward ratio for the first stop loss and first take profit.
This means that if your stop loss falls 2% above your short entry, your first take profit will be 2% below your short entry, hence, 1:1.
As for take profits 2-4, they are just extensions of that ratio. This means that if TP2 Short Placement is set to 1.5, the ratio for your second take profit is 1:1.5.
Using the same percentage from the second bullet point being 2%, we can now gather that with a 1:1.5 ratio our second take profit would be at 3% below our short entry.
The same applies for the rest of the take profits, meaning whatever the take profit is set at regardless of which one, apply that number to the second placeholder of the ratio.
Example: First stop loss falls 2% above short entry. TP2 Short Placement input set to 1.5; risk to reward ratio is 1:1.5; corresponding percentage would be a 3% gain. TP3 Short Placement input set to 2; risk to reward ratio is 1:2; corresponding percentage would be a 4% gain. TP4 Short Placement input set to 2.5; risk to reward ratio is 1:2.5; corresponding percentage would be a 5% gain.
The next key thing to understand about the trailing take profits system is the position size being sold at each take profit and therefore how the strategy tracker calculates your strategy's profit.
At the first take profit, 50% of your position is being calculated as sold, locking in good profits off the bat.
At TP2, 20% of your position is being calculated as sold, leaving a remaining 30% open to gain more profit.
At TP3, another 20% of your position is being calculated as sold, leaving 10% to collect any additional possible gains.
At TP4 the remaining 10% of your position is sold and the trade will be fully closed out.
SL2-4 Short Placement
Our system of trailing stop losses is completely similar to that of our trailing take profits.
Just like the trailing take profits, the inputs for stop losses 2-4 are also used as the second placeholders in the risk to reward ratio.
This may be confusing since generally stop losses are associated with a loss on your position, however, the only stop loss which results in a loss on your position is the first one, not stop losses 2-4.
This is because once your first take profit is hit on your short, your stop loss will automatically move down to the price equivalent to the ratio which you set using these inputs that lies in profit.
Example: Since your first take profit will always be at a 1:1 risk to reward ratio with your stop loss, your second take profit could be at a 1:0.8 ratio. So, to clarify, once your first take profit is hit at a 1:1, your original first stop loss will now be moved down in profits to just below your first take profit at a 1:0.8 risk to reward ratio. This only happens AFTER the first take profit is hit.
For stop losses 3 and 4, the same logic is true, once TP2 is hit, your second stop loss will now be moved down to the placement of SL3 which will fall somewhere above TP2. Once TP3 is hit, your third stop loss will now be moved down to the placement of SL4 which will fall somewhere above TP3. If stop loss 4 does not get hit, then the only thing left to happen is for TP4 to hit and the trade will fully close out.
The one major difference between our system of trailing stop losses and take profits is that no matter what stop loss is hit, the entire remainder of your position will be calculated as sold.
So, if your first take profit hits and sells 50% of your short position, but the trade does not continue downwards and moves up to your second stop loss, the remaining 50% of your position will be calculated as sold.
The same applies to SL3 and SL4, so at SL3 the remaining 30% of your position will be calculated as sold, and at SL4 the remaining 10% will be calculated as sold.
Your trailing stop loss placement is dependent on what types of trades you desire. For shorter scalps on smaller timeframes, it's recommended to place each stop loss just above each corresponding take profit for short trades.
This way you leave just enough room for the trade to continue downwards if there is enough momentum, but you don’t open yourself up to losing your unrealized profit if it does not make this continuation.
If you desire longer swing trades on higher timeframes, it might be a good idea to leave more room in between the take profit and corresponding stop loss.
This way you leave more room for the trade to mature and move in your favor since when trading longer moves, often they will not shoot straight down but rather have a series of small bounces throughout the more general downwards trend.
Note that when a short trade is first entered the only stop loss and take profit in play are your original stop loss found by the pivot high which would result in a loss, and the first take profit at a 1:1 risk to reward ratio from that pivot high.
Summary of Take Profit/Stop Loss Placement:
Correctly placed take profits and stop losses are essential in having a successful strategy and proper risk management. With that being said there are also many ways in which to use this system. Deciding how to set them up is really just a matter of determining the trading style you aim to succeed with. Once this has been determined, the placement of take profits and stop losses should be easier to configure. However, if there is any confusion on either of these topics as the ratios and corresponding TP/SL can get confusing, please do not hesitate to ask further questions in our discord!
Leverage Long
Leverage Long input simply defines the leverage used in your long positions, and is used in calculating the profit in Strategy Tracker
A rundown of risk associated with using leverage will not be given here since it should assume that if you're using leverage, you should already understand the risks.
If you are not using any leverage, then set Leverage Long input to 1.
Long Position Size
This input defines the position size you are using in your long trades.
This input is also used in calculating profit in Strategy Tracker.
Long Hedge Position Size
This input is used to define the position size of long hedge positions.
This input is also used in calculating profit in Strategy Tracker.
Important: Your Long Hedge Position Size should always be half of your Long Position Size for accurate profit calculation.
Double Long Position Size
This input is used to define the position size when in a double long.
This input is also used in calculating profit in Strategy Tracker
Important: Your Double Long Position Size should always be double your Long Position Size for accurate profit calculation.
Short Position Size
This input defines the position size you are using in your short trades.
This input is also used in calculating profit in Strategy Tracker.
Short Hedge Position Size
This input is used to define the position size of short hedge positions.
This input is also used in calculating profit in Strategy Tracker.
Important: Your Short Hedge Position Size should always be half of your Short Position Size for accurate profit calculation.
Double Short Position Size
This input is used to define the position size when in a double short.
This input is also used in calculating profit in Strategy Tracker
Important: Your Double Short Position Size should always be double your Short Position Size for accurate profit calculation.
A Message From the Developer PLEASE READ!!!
If you have made it this far in the guide, I applaud you and thank you for sticking with it as I know there is a lot of information here! This is not an exaggeration when I say there are hundreds of millions of possible variations that could be applied throughout all the inputs which is why I much prefer to call this a tool rather than an algorithm. Algorithm is a loaded word in my opinion as it comes with an implication of guarantee in the trades being made. This is not meant to discourage anybody from taking trades based off the tool which is also why I provided the option for automated alerts which through third party software can turn into automated trades; if you have the confidence in your strategy by all means I encourage you to trade it, automated or not. Just please understand that it's highly recommended to also apply your own knowledge and analysis before taking a trade as historical back testing data has its limitations and cannot always account for current market conditions. The real applicability does not fall in what the back tester window is saying you would have made or how accurate your strategy would have been, it's within the sheer number of markets and scenarios this tool can be used in and the information you can get which a human just can’t comprehend all at once; its literally endless. I urge all of you to be creative and think outside the box about what you can do with such a powerful tool at your fingertips. After all this is the reason why so many inputs were provided. Another main goal of this project was to give users a better understanding of risk management. It can be hard to manage your risk when it’s all kept in your head, but when you can modify your strategy to better manage your risk by simply optimizing a few inputs, it’s a lot easier to comprehend and actually apply when trading. The last thing I want to say is have fun working through the possible learning curve in using this tool, it may be a process but enjoy it because the one thing I can guarantee is that you will come out the other side a better trader than before!
Forex Lot Size CalculatorI grew very tired of opening a Forex Calculator Website in the moment I wanted to enter a trade copying and pasting the values as fast as I can to make sure my trade is the correct size like a responsible trader before I hit the buy button :') SO I put together this indicator tool to make the process faster and just better for myself. I have been using it for a bit and I have found it very helpful in my own process so I thought I should share it with the TV community.
The indicator does as it's title suggest. Simply add it to your chart follow to two prompts...Step one select your entry price. Step two select your stop loss price. The indicator will then load the position box for your trade. In the settings you can set your account balance, Risk % per trade and your risk to reward ratio. You also have the option to change the account base currency, the indicator will calculate the lots required to reflect the base currency that you have selected.
Things to note: This calculator is intended to give you a quick idea of an appropriate lot size for your desired trade there are many different factors that many influence the results of the calculations. Please take the time to review the results before entering your trades this tool is intend to add in your process; calculations are not guaranteed. The tool is for the Forex Market obviously.
For the most efficient way to deploy this tool I've found keeping it in my favorites section of my indictors is the best way to use it. I add it to the chart sets my points read the lots then remove it from the chart. You can modify the settings for the entry and stop each time and just leave the indictor on the chart however if you trade many pairs it becomes more tedious to type in manually the new price levels each time. It is far more simpler and fast to grab the tool out of the favs tab click the two points and read the result. Just remember to save your account settings ie: Balance, Risk, Base currency, etc...as the default settings of the indicator so everything is set up when you want to use it( You can save your settings at the bottom of the settings tab). I truly hope this tool helps your process. God bless and happy trading.
Market SnapshotGet a snapshot of the market with the index's last price, distance to selectable moving averages, and breadth data.
Choose to see data based on the Nasdaq or SPX, as well as net highs / lows for the Nasdaq, NYSE or combined.
Snapshot shows:
- Index's (SPX or Nasdaq's) last price
- Put call ratio
- % of stocks above the 50 day moving average for the index of your choice
- % of stocks above the 200 day moving average for the index of your choice
- Distance to or from two selectable moving averages. (negative number means price is below the moving average, positive means price is above)
Configurable options:
- Which moving averages to use
- Where to display the table on your chart
- Table size, background and text colors
Risk Management ToolThis tool is a good way to get quick position sizing. No need to use your calculator and find that your price asset is already out of your range.
It works best with Cryptocurrencies Exchange way to manage position size calculation.
Really useful when scalping. This tool tracks the last high and low following your custom lookback bars number. It also follows the VWAP level.
You also have 4 custom ranges around the current price with the calculated position size. You set the desired percentage distance from the current price and you get the position size you need.
1. You choose the type of order
2. Account balance
3. Leverage if you use the cost base orders type
4. Amount to risk
and you get real-time risk management.
Sessions and news markersHello,
I use this script daily so I thought it might help some of you guys out!
WHAT IS THE SCRIPT
This script can show two custom trading sessions and up to three specific dates and hours to keep in mind while trading (for example a news release).
WHY USE THE SCRIPT
My trading plan tells me to trade from 08:00am to 10:00am (GMT+1) and not to let open trades during a high impact news release, this script allows me to show my trading session and mark the news releases on the chart before trading so I don't forget about them while in the heat of trading.
HOW TO USE THE SCRIPT
It is very straightforward:
How to set up the TRADING SESSIONS:
- Tick the trading sessions that you want to use (one or two)
- Specify the trading hours
- Choose the color of the trading sessions
- Choose the color to fill outside of the trading sessions
- Choose the time zone (GMT, GMT+1, UTC, UTC+2...)
How to set up the NEWS MARKERS:
- Tick the news markers you want to use (up to three)
- Specify the date and hours of the news
- Choose the color of the news markers
- No need to choose the time zone, it will use the timezone of the chart
PS: As you can see in the settings, each session and news marker can have their own color
I hope this helps you out as much as it helps me! If you have any recommendations I would be glad to hear them :)
Market Stop LightThis indicator shows two signals to help gauge the health of the market. The first is where the price of the Nasdaq is in relation to a selectable moving average (default is the 21 ema) and the second is based on the number of net new highs and lows on the Nasdaq.
Price vs MA
Price is above a rising moving average = 🟢
Price below a falling moving average = 🔴
Price above a falling moving average or below a rising moving average = 🟡
Net highs / lows signal
3 days in a row of net new highs = 🟢
3 days in a row of net new lows = 🔴
Between 3 days either way = 🟡
Configurable options:
- Which moving average to use
- Option to show signal history
- Where to display current data on the chart
- Table size
Crypto Index (DXY) CandlesA modification of @loxx's "Dollar Index (DXY) Candles" allowing for a user selected basket of tickers using the same weights as the standard DXY. Ticker Inputs are in descending order so highest weight is at the top by default, although weighting can be changed manually by modifying the symbol's corresponding weight input in the settings. The Idea was to get a bird's eye view of the crypto space using some of the more relevant names in the space. User's can use the toggle in the settings for viewing the default DXY for comparison. Indicator should be used as a confirmation when looking at long term trend changes in the space, shorter time frames may, or may not be as useful.
Financial Data Spreadsheet [By MUQWISHI]The Financial Data Spreadsheet indicator displays tables in the form of a spreadsheet containing a set of selected financial performances of a company within the most recent reported period. Analyzing Financial data is one of the classic methods to evaluate whether the company’s stock price is overvalued or undervalued based on its income statement, balance sheet, and cash flow statement. This indicator might be practical to investors to collect needed data of a company to analyze and compare it with other companies on a TradingView chart or print it in spreadsheet form.
█ OVERVIEW
█ BEST PRACTICES
Due to strict limitations on calling request.financial() function, I tried to develop the table with the best ways to be more dynamic to move and the ability to join multiple tables into a spreadsheet. Users can add up to 20 instruments and 2 financial metrics per table. However, it’s possible to add many tables with other financial metrics, then connect them to the main table.
Credits: The idea of joining multiple tables inspired by @QuantNomad Screener for 40+ instruments
█ INDICATOR SETTINGS
1- Moving Table toward right-left up-down from its origin.
2- Hiding Column Title checkmark. Useful for adding a joined table underneath with additional instruments.
3- Hiding Instruments Title checkmark. Useful for adding a joined table on the right with other financial metrics.
4- Shade Alternate Rows checkmark. I believe it’ll make the table easier to read.
5- Selecting Financial Period. (Year, Quarter).
6- Entering a currency.
7- Choosing a financial ID for each column. There’re over 200 financial IDs. Source: What financial data is available in Pine? — TradingView
8- Optional to highlight values in between.
9- Entering the ticker’s symbol with the ability to activate/deactivate.
█ TIP
For best technical performance, use the indicator in a 1D timeframe.
Please let me know if you have any questions.
Thank you.
Kioseff Trading - AI-Powered Strategy Optimizer Introducing the Kioseff Trading AI-Powered Strategy Optimizer
Optimize and build your trading strategy with ease, no matter your experience level. The Kioseff Trading AI-Powered Strategy Optimizer allows traders to efficiently test and refine strategies with thousands of different profit targets and stop loss settings. Integrated with TradingView's backtester, this tool simplifies strategy optimization, strategy testing, and alert setting, enabling you to enhance your strategy with AI-driven insights.
Key Features:
Comprehensive Testing : Simultaneously test thousands of profit targets and stop losses to fine-tune your strategy.
Dual Strategy Optimization : Adjust and optimize both long and short strategies for balanced performance.
AI Integration : Elevate your strategy with heuristic-based adaptive learning, turning it into a smart, AI-assisted system.
Detailed Analysis : View critical metrics like profit factor, win rate, max drawdown, and equity curve, presented in a strategy script format.
Customizable Alerts : Set alerts for the best version of your strategy.
Flexible Risk Management : Optimize various stop loss types, including profit targets, limit orders, OCO orders, trailing stops, and fixed stops.
Targeted Goals : Choose optimization goals like highest win rate, maximum net profit, or most efficient profit.
Indicator Compatibility : Integrate any strategy/indicator, whether it’s your creation, a favorite author’s, or any public TradingView indicator.
Accessible Design : Navigate a user-friendly interface suitable for traders of all skill levels. No code required.
Precision Lock-In : “Lock” your optimal profit target or stop loss to drill down into precision testing of other variables.
How it works
It's important to remember that merely having the AI-Powered Strategy Optimizer on your chart doesn't automatically provide you with the best strategy. You need to follow the AI's guidance through an iterative process to discover the optimal settings for your strategy.
The Trading Strategy Optimizer is a versatile tool tailored for both non-coding traders and seasoned algorithmic trading professionals. Let's start with no-code-required instructions on how to use the optimizer.
Instructions: How To Optimize Your Strategy Without Code
1. Build your strategy in the settings
The image above shows explanations for each key setting.
Note: This example uses the RSI indicator to initiate a long trade whenever it dips below the 30 mark.
Ensure that the indicator you wish to optimize is already applied to your chart . This enables the Trading Strategy Optimizer to interact with the indicator and finetune profit targets and stop losses effectively.
Because the indicator is plotted on the chart I can access the indicator with the Trading Strategy Optimizer and optimize profit targets and stop losses for it.
2. Leverage AI Recommendations
Optimization Prompt: After you load your strategy, the tool advises you on new TP and SL levels that could be more profitable.
When your strategy is set, the tool gives you tips for where to set your profit goal (TP) and your stop loss to help you optimize your strategy. It'll tell you if there's a better range for these settings based on past results.
Follow Suggestions: Keep updating your TP and SL according to the tool's suggestions until it says "Best Found".
Final Result: The last image shows the best settings found by the indicator.
(Optional Step 3)
3. Lock the profit target or stop loss to further fine tune your strategy
Continue following the AI’s suggestion until “Best Found” is displayed.
Note: you can select lock either your stop loss or profit target for fine tuning. For this demonstration we will lock our profit target.
Code-Required Instructions (Optional)
You can backtest more code-intensive strategies, such as harmonic patterns, traditional chart patterns, candlestick patterns, Elliot wave, etc., by coding the entry condition in your own script and loading it into the Trading Strategy Optimizer. Let's dial in on how to achieve this!
1. You must create an integer variable in your script with an initial value of "0".
2. Define your entry condition in the code. Once complete, assign the value "1" to the variable you created if the entry condition is fulfilled.
3. Plot your variable.
4. Select the plotted variable in the settings for the Trading Strategy Optimizer
The image above shows a coded entry condition for the linear regression channel (which can be any indicator). When price crosses under and closes below the lower line our variable "strategyEntryVariable" is assigned the value "1".
The Trading Strategy Optimizer will treat this change in value from "0" to "1" as an entry signal and enter long/short up to 1000 times at the price where the entry condition was fulfilled.
5. Test Your Strategy
The image above shows the completion of the process! Keep applying the steps we described. Stick with the AI's recommendations until you see “Best Found” show up.
By following these instructions, you can build, test, and optimize almost any trading indicator or strategy!
So, just note that the Trading Strategy Optimizer considers a change in value of a plotted variable from "0" to "1" as an entry signal! So long as you follow this rule you should be able to test and optimize any conceivable, Pine Script compatible strategy!
AI Mode
AI Mode incorporates Heuristic-Based Adaptive Learning to fine-tune trading strategies in a continuous manner. This feature consists of two main components:
Heuristic-Based Decision Making: The algorithm evaluates multiple versions of your strategy using specific metrics such as Profit and Loss (PNL), Win Rate, and Most Efficient Profit. These metrics act as heuristics to assist the algorithm in identifying suitable profit targets and stop losses for trade execution.
Online Learning: The algorithm updates the performance evaluations of each strategy based on incoming market data. This enables the system to adapt to current market conditions.
Incorporating both heuristic-based decision-making and online learning, this feature aims to provide a framework for trading strategy optimization.
Settings
AI Mode Aggressiveness:
Description: The "AI Mode Aggressiveness" setting allows you to fine-tune the AI's trading behavior. This setting ranges from "Low" To "High, with higher aggressiveness indicating a more assertive trading approach.
Functionality: This feature filters trading strategies based on a proprietary evaluation method. A higher setting narrows down the strategies that the AI will consider, leaning towards more aggressive trading. Conversely, a lower setting allows for a more conservative approach by broadening the pool of potential strategies.
Adaptive Learning Aggressiveness:
Description: When Adaptive Learning is enabled, the "Adaptive Learning Aggressiveness" setting controls how dynamically the AI adapts to market conditions using selected performance metrics.
Functionality: This setting impacts the AI's responsiveness to shifts in strategy performance. By adjusting this setting, you can control how quickly the AI moves away from strategies that may have been historically successful but are currently underperforming, towards strategies that are showing current promise.
Additional Settings
Optimization
Trading system optimization is immensely advantageous when executed with prudence.
Technical-oriented, mechanical trading systems work when a valid correlation is methodical to the extent that an objective, precisely-defined ruleset can consistently exploit it. If no such correlation exists, or a technical-oriented system is erroneously designed to exploit an illusory correlation (absent predictive utility), the trading system will fail.
Evaluate results practically and test parameters rigorously after discovery. Simply mining the best-performing parameters and immediately trading them is unlikely a winning strategy. Put as much effort into testing strong-performing parameters and building an accompanying system as you would any other trading strategy. Automated optimization involves curve fitting - it's the responsibility of the trader to validate a replicable sequence or correlation and the trading system that exploits it.
Position Size ToolUpdated - Version 2
This tool is used to calculate the size of a trade.
Settings - Type in total account size and % of capital that can be risked on each trade.
The table will display:
Column 1 - Stop placement based on low, mid or high value of the current candle.
Column 2 - Percent risk on the trade.
Column 3 - Amount of shares that can be traded (calculated from account size, risk and selected stop placement).
Green color is intended for long position, stop at the low of the candle.
Red color is intended for short position, stop at the high of the candle.
Middle value can shift between either color since its measured from open to close.
Price Change AlertsThis purpose of this indicator script is to reduce time traders spend staring on the charts.
For example if you're trading BTCUSD you can set alerts to be trigered by desired delta amount, for example 50. Then you can receive push notifications on your phone (need to install the tradinview app) and on your desktop computer every time price changes by amount of 50. Simple and easy.
To enable alerts do this:
- Click on alerts clock icon in top right corner of the screen
- Click on "Create alert button"
- In Condition dropdown select "alerts"
- In the next dropdown select "Any alert function() call" and click on "Create" button
Script uses repainting on purpose to display daily percentage changes since the previous day's closing and to triger alerts.
Portfolio Chart by fonotoFeatures:
If you are looking for a chart that can project your portfolio value as a whole over time instead of individual stocks, this can be it. This is an indicator overlaid on the main chart of your index/stock selection allowing you to compare your portfolio performance against the main index/stock visually in chart form.
UI:
The settings has UI to input your portfolio stocks and quantities. The setting also has a divide factor which you can set to divide the portfolio value by this value so Y-Axis is offset to show main index/stock chart and your portfolio chart relatively closer. Portfolio chart works on any chosen timeframe. Colors can be customized in the UI.
Limitations:
1. Number of portfolio stocks is limited to 10.
2. Chart Type is limited to Candle.
3. Exponential Moving Averages are limited to 21, 50, 100, 200 & 500.