Strategy Builder [Cometreon]The Strategy Builder is an advanced indicator that allows you to create customized trading strategies directly on TradingView. With the ability to define up to five entry conditions and two exit conditions, this tool offers unprecedented flexibility in creating complex strategies.
Key Features:
Creation of strategies with 5 entry conditions and 2 exit conditions
Use of any indicator available on TradingView, including private indicators
Advanced options for signal and condition management
Technical Details and Customizable Inputs:
Activate Signal: Option to activate or deactivate the Long or Short condition
Special Condition:** It's possible to activate a "Special" condition, choosing from:
1) Precedent Signal: Searches for the condition in a previous candle. For example, entering 4 will check the condition in the fourth previous candle.
2) Check Signal: Verifies if the condition has occurred in a certain number of candles. For example, entering 6 will check if the condition has occurred in at least one of the 6 previous candles.
3) Multiple Signal: Checks multiple consecutive conditions. For example, with 3 the condition must occur in all 3 previous candles, unlike the "Check Signal" where a single occurrence is sufficient.
4) Confirm Signal: Checks that the condition has not occurred previously. For example, entering 5 verifies that the condition has not been activated in any of the 5 previous candles.
Source Long and Short: Allows choosing the first value to create the condition, using any indicator on TradingView, including our private indicators with derived signals
Type Long and Short":** Defines the type of condition, with a wide range of intuitive options including:
1) Cross Over Value: Source Long/Short crosses upward the second value.
2) Cross Under Value: Source Long/Short crosses downward the second value.
3) Greater Than: Source Long/Short is greater than the second value.
4) Lower Than: Source Long/Short is less than the second value.
5) Equal To: Source Long/Short is equal to the second value.
6) Increase: Source Long/Short is greater than the previous candle.
7) Decrease: Source Long/Short is less than the previous candle.
8) No Change: Source Long/Short is equal to the previous candle.
9) Change Value: Source Long/Short is different from the previous candle.
Only First: Avoids multiple or repeated signals, excluding a signal if the condition was active in the previous candle.
Type Value: Allows choosing the type of the second value:
1) Normal: allows manually entering a value (for example, 20 or 50).
2) Choose: allows selecting a value from another indicator, as for the first value.
How to Use The Indicator:
Define entry and exit conditions using desired indicators
Configure signal management options for each condition
Test the created strategy directly on the chart or in combination with the Strategy Tester
Unlock the potential of your trading strategies with TradeLab Beta's Strategy Builder start creating customized strategies optimized for your trading goals.
Don't waste any more time and visit the link to get access to all Cometreon indicators.
Testing
Signal Tester [Cometreon]Signal Tester is a powerful tool that allows you to analyze and visualize up to 100 historical positions directly on the TradingView chart. This indicator is ideal for quickly testing the effectiveness of trading signals from various sources.
Key Features:
Graphical visualization of entry and exit signals
Support for analysis on different timeframes
Ability to test signals from bots, groups, or personal strategies
Technical Details and Customizable Inputs:
Position Selection : Choose up to 100 recent positions, both long and short, to display signals directly on the chart.
Data Entry : Easily select the date and position type (long/short) in the settings.
How to Use the Indicator:
Enter entry and exit signals in the indicator settings.
Analyze the results directly on the chart.
Add the generated signals to the Strategy Tester to verify their effectiveness.
Start testing your trading signals now with TradeLab Beta's Signal Tester access this powerful tool and take your market analysis to the next level!
Don't waste any more time and visit the link to get access to all Cometreon indicators.
FreedX Backtest Plus█ Our new FreedX Backtest PLUS template enhances TradingView backtesting with smart features like Mean Reversion, Flexible Volatility, Liquidation Filter, and Better Trend Filtering, making strategies more effective. It lets users set up automated alerts easily. This guide explains how to make the most of these improved features.
The Trading Date Settings feature in our TradingView script allows you to refine their backtesting parameters by specifying trading dates and hours. This feature enhances the accuracy of the backtest by aligning it with specific time frames and days, ensuring that the strategy is tested under relevant market conditions.
Features:
⚙️ Enable Trading Between Specific Dates:
🎯 Purpose:
→ Allows you to limit the backtesting of their strategy to a specific date range.
💡 How to Use:
→ Input the Start Date and End Date for the backtest period.
→ The script will execute the strategy only within this specified date range.
⚙️ Enable Trading Between Specific Hours:
🎯 Purpose:
→ Allows you to limit the backtesting of their strategy to a specific hour range.
💡 How to Use:
→ Input the start and end hour for in Trading Session section.
→ The script will execute the strategy only within this specified hour range.
⚙️ Enable Trading on Specified Days of the Week:
🎯 Purpose:
→ Gives you the option to conduct backtesting on selected days of the week, tailoring the strategy to particular market behaviours that may occur on these days.
💡 How to Use:
→ Select the days of the week for the backtest.
→ The script will activate the trading strategy only on these chosen days.
█ BUY/SELL TRIGGER SETTINGS
The Buy/Sell Trigger Settings feature is designed to provide users with flexibility in defining the conditions for 'LONG' and 'SHORT' signals based on various indicator types. This customization is crucial for tailoring strategies to different trading styles and market conditions.
Features:
⚙️ Single-Line Plotted Indicators :
🎯 Purpose:
→ Enables you to select a single-line plotted indicator as a source for backtesting. You can define specific levels to trigger 'LONG' or 'SHORT' signals.
💡 How to Use:
→ Choose a Single-Line Plotted indicator as the source.
→ Set the top and bottom levels for the indicator.
→ The script triggers 'LONG' signals at the bottom level and 'SHORT' signals at the top level.
⚙️ Two-Line Plotted Indicators :
🎯 Purpose:
→ Allows backtesting with two-line cross plot sources. Signals are generated based on the crossover of these lines.
💡 How to Use:
→ Select two lines as 'Source 1' and 'Source 2' for the indicator.
→ The script triggers a 'LONG' signal when 'Source 1' crosses above 'Source 2'.
→ Conversely, a 'SHORT' signal is triggered when 'Source 2' crosses above 'Source 1'.
⚙️ Custom Signals :
🎯 Purpose:
→ This setting enables users to define their own criteria for LONG, SHORT, and CLOSE signals based on custom indicator outputs.
💡 How to Use:
→ Select the custom source for your signals.
→ Define the output values that correspond to each signal type (e.g., “1” for 'LONG', “-1” for SHORT, and “0” for CLOSE).
→ The script will trigger signals according to these custom-defined values.
█ TP/SL SETTINGS
The TP/SL (Take Profit/Stop Loss) Settings feature is designed to give users control over their profit securing and risk mitigation strategies. This feature allows for setting custom TP and SL levels, which can be critical in managing trades effectively.
Features:
Custom TP/SL Levels for Long/Short Signals:
🎯 Purpose:
→ Enables users to set specific percentage levels for Take Profit and Stop Loss on long and short signals.
💡 How to Use:
→ In the TP/SL Settings, input the desired percentage for Take Profit (TP) and Stop Loss (SL).
→ For example, to secure a profit at a 10% price increase on LONG signals, set the “Long TP Percentage” to “10”.
█ STRATEGY SETTINGS
Strategy Settings provide a range of options to customize the trading strategy. These settings include leverage, position direction changes, and more, allowing users to tailor their strategy to their risk tolerance and market view.
Features:
⚙️ Enable Reverse Position:
🎯 Purpose:
→ Automatically closes a current position and opens a new one in the opposite direction upon detecting a signal for a market trend change.
🎯 Example:
→ If a LONG signal is received while in a SHORT position, the script will close the SHORT position and open a LONG position.
💡 How to Use:
→ Activate this feature in the Strategy Settings.
⚙️ Enable Spot Mode:
🎯 Purpose:
→ Disables short orders, using short signals only for closing long positions.
💡 How to Use:
→ Select the 'Spot Mode' option in the Strategy Settings.
⚙️ Enable Invert Signals:
🎯 Purpose:
→ Inverts all indicator signals, changing LONG signals to SHORT and vice versa.
💡 How to Use:
→ Opt for the 'Invert Signals' feature in the Strategy Settings.
⚙️ Enable Trailing Stop:
🎯 Purpose:
→ Triggers a trailing stop order on the exchange instead of a standard stop market order.
☢️ Caution:
→ The backtesting of this feature on TradingView may not accurately reflect actual strategy performance due to discrepancies between TradingView and exchange mechanisms.
💡 How to Use:
→ Select 'Trailing Stop' in the Strategy Settings.
⚙️ Enable Realistic TP & SL:
🎯 Purpose:
→ Goal is protect the user from unrealistic stop loss and take profit prices in live exchange trading conditions.
→ That feature continuously checks the take profit, stop loss and move stop loss prices to prevent unrealistic values. It changes their values according to (minimum realistic percent %)
💡 How to Use:
→ Select 'Enable Realistic TP & SL' in the Strategy Settings. Write min allowed percents.
█ LIMITER SETTINGS
Limiter Settings provide a range of options to customize the trading strategy. These settings include drawdown limits,contract limit, tradable ratio, for allowing users to tailor their strategy to their risk tolerance and market view.
⚙️ Leverage :
🎯 Purpose:
→ Allows users to apply leverage to their trades.
☢️ Caution:
→ High leverage can significantly increase the risk of liquidation.
→ High leverage and a high stop-loss price may override your fixed stoploss percentage, adjusting the stop-loss to the liquidation price.
💡 How to Use:
→ Set the desired leverage ratio in the Strategy Settings.
⚙️ Drawdown Limit:
🎯 Purpose:
→ Sets a maximum drawdown limit, automatically halting the strategy if this limit is reached, thereby controlling risk.
💡 How to Use:
→ Input the maximum drawdown limit (default: 100, min: 0, max: 100).
⚙️ Contract Limit:
🎯 Purpose:
→ Sets a maximum contract limit, beyond which the compound effect cannot be used. This is important to prevent market manipulation through large-volume orders.
💡 How to Use:
→ Input the maximum contract limit (min: 0).
⚙️ Tradable Ratio:
🎯 Purpose:
→ Sets a tradable ratio, it uses that ratio calculating entry cost for position. Main purpose is cash-out and cash-in according to balance change.
💡 How to Use:
→ Input the tradable ratio percent (default: 98, min: 0.1, max: 100).
█ CASH-OUT SETTINGS
Cash-Out Settings offer a money-saving mechanism that prevents entering positions with the entire balance due to cashed-out funds. It functions with a webhook alerts, but the 'Override Allocation %' option must be enabled.
⚙️ Cash-out Threshold %:
🎯 Purpose:
→ It is cash-out mechanism, it saves money with a target threshold.
💡 How to Use:
→ Input the threshold (min: 0).
⚙️ Cash-out Per Profitable Trades %:
🎯 Purpose:
→ It is cash-out mechanism, it saves money from every trade with a percent like commission.
💡 How to Use:
→ Input save percent% (min: 0).
█ ADAPTIVE VOLATILITY STRATEGY SETTINGS
Advanced Strategy Settings offer sophisticated methods for managing Stop Loss (SL) and Take Profit (TP) using the Average True Range (ATR). These settings are ideal for traders who want to incorporate volatility into their exit strategies.
Features:
⚙️ Enable ATR Stop Loss:
🎯 Purpose:
→ Automatically sets the Stop Loss price using the Average True Range at the time of entry.
💡 How to Use:
→ Activate 'ATR Stop Loss' to have the SL price calculated based on the current ATR.
⛓ Enable ATR Trailing Stop:
→ Dynamically updates the Stop Loss price with each new bar, according to the Average True Range.
→ Activate 'ATR Trailing Stop'.
→ Set the ATR Period to define the number of bars for ATR calculation.
→ Adjust the ATR SL Multiplier to determine the stop loss distance.
→ Modify the ATR TP Multiplier for setting the take profit distance.
⚙️ Enable ATR Take Profit:
🎯 Purpose:
→ Sets the Take Profit price based on the Average True Range at the time of entry.
💡 How to Use:
→ Choose 'ATR Take Profit' for TP price determination using ATR.
⚙️ Enable ATR Limit Entry:
🎯 Purpose:
→ Trade can not open in candle close price. Price should hit target price that based on average true range value.
💡 How to Use:
→ Choose 'ATR Limit Entry' for entry price determination using ATR.
⛓ Enable ATR Limit Entry Trailing Price:
→ Dynamically updates the entry price with each new bar, according to the Average True Range.
→ Activate 'ATR Limit Entry Trailing Price'.
→ Set the ATR Period to define the number of bars for ATR calculation.
→ Adjust the ATR SL Multiplier to determine the stop loss distance.
→ Modify the ATR TP Multiplier for setting the take profit distance.
█ TREND FILTERING SETTINGS
Trend Filtering Settings are designed to align trading strategies with the prevailing market trend, enhancing the precision of trade entries and exits. These settings utilize moving averages for trend analysis and decision-making.
Features:
⚙️ Enable Moving Average Filtering:
🎯 Purpose:
→ Limits trades based on moving average trends, blocking short trades in an uptrend and vice versa.
💡 How to Use:
→ Enable 'Trend Filtering'.
→ Set Fast and Slow MA Lengths for trend analysis.
→ Select the Timeframe for moving averages.
→ Choose the Moving Average Type for trend filtering.
🎯 Note:
→ Be cautious with timeframe selections; lower timeframes than the base may cause inconsistencies.
⛓ Exit on Trend Reversal:
→ Automatically closes a position when a market trend reversal is detected.
→ Turn on 'Exit on Trend Reversal' in the settings.
⛓ Ignore Counter Signals:
→ Ignores counter signals during trending market way.
→ If the trend way is long. All short signals will ignore and vice versa.
⛓ Enable Drawing On Chart:
→ Visually represents the trend filter directly on the chart for easy reference.
→ Activate 'Drawing On Chart' to see the trend filter overlaid on the trading chart.
⚙️ Enable Adx Filtering:
🎯 Purpose:
→ Limits trades based on adx value, blocking trades if trend strength is not enough or vice versa for invert mode.
💡 How to Use:
→ Enable 'Adx Filtering'.
→ Set Smoothing and Lengths for adx trend analysis.
→ Select level barrier for trend strength.
⚙️ Enable Custom Filtering:
🎯 Purpose:
→ Limits trades based on custom sources, blocking trades according to custom trades.
💡 How to Use:
→ Enable 'Custom Filtering'.
→ Select fast source.
→ Select slow source.
→ Enable lag mode.
█ MEAN REVERSION FILTERING SETTINGS
Mean Reversion Filtering Settings are designed to align trading strategies during accumulation market conditions. They set a distance from a line to permit trading. The purpose is to ensure that when the price strays too far from the mean line, it should revert back. In accumulation markets, price movements are generally horizontal. In such situations, mean reversion will operate like a grid, enabling profitable trades with low drawdown. However, when the market structure begins to trend, mean reversion filters may not be as profitable as in accumulation markets. For instance, let's say the price is rising and we are shorting the market until it reaches the mean price line. As the price goes up and the mean also rises, we will end up closing the position at a higher price, rendering the mean reversion system non-profitable. Therefore, consider this filter wisely; greater distances might work better in trending markets.
Features:
⚙️ Enable Kairi Filter:
🎯 Purpose:
→ Blocks trades based on distance percent between price and moving average.
💡 How to Use:
→ Enable 'Kairi Filter'.
→ Set Length and Distance Percent.
⛓ Enable Trend Drawing On Chart:
→ Visually represents the trend filter directly on the chart for easy reference.
→ Enable 'Drawing On Chart' to see the allowed regions overlaid on the trading chart with arrows.
⚙️ Enable VWAP Filter:
🎯 Purpose:
→ Blocks trades based on distance percent between price and volume weighted average price.
💡 How to Use:
→ Enable 'VWAP Filter'.
→ Set Timeframe as minutes and distance as percent.
⛓ Exit on Crossing with VWAP:
→ Automatically closes a position when the closing price of a candle crosses the VWAP.
→ Choose "Enable", 'Exit on Crossing with VWAP' in the settings.
⛓ Enable Drawing On Chart:
→ Visually represents the trend filter directly on the chart for easy reference.
→ Enable 'Drawing On Chart' to see the allowed regions overlaid on the trading chart with arrows.
█ LIQUIDATION FILTER SETTINGS
Liquidation filter compares the volume data of futures and spot markets.
Large differences in volume indicate unexpected market conditions, such as massive trading activities, which may signal liquidations.
Features:
⚙️ Enable Liquidation Filter:
🎯 Purpose:
→ Blocks trades based on extra ordinary volume differences in spot and futures market.
💡 How to Use:
→ Enable 'Liquidation Filter'.
→ Set behavior to react during that market conditions.
→ Set base amount to filter volume. This amount changes according to timeframe, you should find right amounts.
→ Liquidation candle count means, it is sum of liquidated candle count in last 20 bars.If you set 0, it means feature is disabled.
→ Detection, try to select the spot and perpetual symbols automatically, symbol names varies, it do not support all symbols, you should choose manually in that situation.
█ AUTOMATED ALERT SETTINGS
Automated Alert Settings are designed to integrate your TradingView script with webhook alerts. These settings allow for enhanced strategy execution and management.
Features:
Enable Webhook Alerts:
🎯 Purpose:
→ Trigger BUY, SELL, CHANGE_DIRECTION or MOVE_STOP_LOSS .
💡 How to Use:
→ Enable 'Webhook Alerts' in the settings.
→ Enter your Strategy Key.
→ Optionally, activate 'Override Allocation Percentage' to bypass the preset allocation percentage.
☢️ Caution:
→ Overriding the allocation percentage may result in trade entry errors due to misalignment between entry cost and available balance.
Enable Custom Alerts:
🎯 Purpose:
→ User can produce unique messages for different purposes.
💡 How to Use:
→ Enable 'Custom Alerts' in the settings.
→ Enter your message format type.
█ DEBUGGING SETTINGS
Debugging Settings are crucial for users who want to analyze and optimize their strategies. These settings provide tools for visualizing alerts on charts and accessing detailed data outputs.
Features:
⚙️ Enable Alert Plotting:
🎯 Purpose:
→ Allows users to visualize trading alerts directly on the chart, aiding in strategy analysis and refinement.
💡 How to Use:
→ Activate 'Alert Plotting' to draw alerts on the chart.
☢️ Caution:
→ It is recommended to disable this feature when creating actual trading alerts, as it can cause latency in signal processing.
⚙️ Enable Debugger Mode:
🎯 Purpose:
→ Facilitates strategy debugging by providing detailed data output in the TradingView Data Window.
💡 How to Use:
→ Turn on 'Debugger Mode' to access real-time data and metrics relevant to your strategy.
⚙️ Enable Table:
🎯 Purpose:
→ Facilitates strategy debugging by providing detailed data output in the TradingView Table on chart.
💡 How to Use:
→ Turn on 'Table' to access last closed candle data and metrics relevant to your strategy.
█ ADDITIONAL SETTINGS
⚙️ Enable Bar Magnifier
⚙️ Enable Using standard OHLC
PineUnitPineUnit by Guardian667
A comprehensive testing framework for Pine Script on TradingView. Built with well-known testing paradigms like Assertions, Units and Suites. It offers the ability to log test results in TradingView's built-in Pine Protocol view, as well as displaying them in a compact table directly on your chart, ensuring your scripts are both robust and reliable.
Unit testing Pine Script indicators, libraries, and strategies becomes seamless, ensuring the precision and dependability of your TradingView scripts. Beyond standard function testing based on predefined input values, PineUnit supports series value testing. This means a test can run on every bar, taking into account its specific values. Moreover, you can specify the exact conditions under which a test should execute, allowing for series-based testing only on bars fitting a designated scenario.
Detailed Guide & Source Code
Quick Start
To get started swiftly with PineUnit, follow this minimalistic example.
import Guardian667/PineUnit/1 as PineUnit
var testSession = PineUnit.createTestSession()
var trueTest = testSession.createSimpleTest("True is always True")
trueTest.assertTrue(true)
testSession.report()
After running your script, you'll notice a table on your chart displaying the test results. For a detailed log output, you can also utilize the Pine Protocol view in TradingView.
--------------------------------------------------------------
T E S T S
--------------------------------------------------------------
Running Default Unit
Tests run: 1, Failures: 0, Not executed: 0, Skipped: 0
To further illustrate, let's introduce a test that's destined to fail:
var bullTest = testSession.createSeriesTest("It's allways Bull Market")
bullTest.assertTrue(close > open, "Uhoh... it's not always bullish")
After executing, the test results will reflect this intentional discrepancy:
--------------------------------------------------------------
T E S T S
--------------------------------------------------------------
Running Default Unit
Tests run: 2, Failures: 1, Not executed: 0, Skipped: 0 <<< FAILURE! - in
It's allways Bull Market
Uhoh... it's not always bullish ==> expected: , but was
This shows how PineUnit efficiently captures and reports discrepancies in test expectations.
It's important to recognise the difference between `createSimpleTest()` and `createSeriesTest()`. In contrast to a simple test, a series-based test is executed on each bar, making assertions on series values.
License
This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
@ Guardian667
A Personal Note
As a software developer experienced in OO-based languages, diving into Pine Script is a unique journey. While many aspects of it are smooth and efficient, there are also notable gaps, particularly in the realm of testing. We've all been there: using `plotchar()` for debugging, trying to pinpoint those elusive issues in our scripts. I've come to appreciate the value of writing tests, which often obviates the need for such debugging. My hope is that this Testing Framework serves you well and saves you a significant amount of time, more that I invested into developing this "baby."
Pivots Benchmark For Indicators (MA / OSC) This measures the pivot of your source. the peaks and valleys. and, shows ou some neat statistics if you were to use those as your entry/exit points. I consider it a purist MA designers Acid Test. if you can get good numbers on this, (remember to deduct fees), you probably should feel confident in your indicator's quality. it isn't very forgiving.
170 themes Dark/Light
your choice of highlight colour for Best/Worst achievement values.
compare to open/close average, or a 3 length EMA on close.
display solo bench of your source.
help popup for indicator values, (hideable)
show/hide individual pivot distances, which source to measure as pivot
time to measure historical setting
number of pivots to keep in buffer
it does back test and runs live!
Closed Source for now, as it is a demo version i've made with partial capabilities.
it's part of a set of performance benchmarks i hope to have finished soon.
when i release the major components i've been building up to for 2 years,
this and everything else will be open sourced.
ANTEYA ProfilingThis script allows to compare which code is more efficient by running it inside a loop for a certain time or a certain number of iterations.
Just paste your pieces of code as Option 1 and Option 2 inside the loop (see comments in the script).
Breakout Finder Strategy by The Accumulation ZoneThe Breakout Strategy:
Indicators used:
Least Squared Moving Average by Tradingview
Smoothed Moving Average by Tradingview
MACD Support Resistance by venkatachari_n
About this Strategy:
This strategy is based on spotting a particular activity pattern involving the above listed indicators:
A fast moving average that will track closely with price while still smoothing out some price chop
A slower least squared moving average to help gauge short-term momentum
MACD Support and Resistance to help identify longer-term trends and potentially serve to also guide directional bias
If all entry conditions are met, the strategy enters a position. As well as sending an alert message for the Entry, TP/SL Signals
Long Condition:
Price close above MACD S/R Line
SMMA crossed MACD S/R Line to the upside
LSMA crossed MACD S/R Line to the upside
Short Condition:
Price close below MACD S/R Line
SMMA crossed MACD S/R Line to the downside
LSMA crossed MACD S/R Line to the downside
Strategy Settings
SL based on ATR Bands (0.9 ATR Multiplier recommended*)
TP based on RR (1.5 RR recommended*)
Optional EMA Filter (If set to 0 -> disabled)
Session Filter
Custom Strategy Backtesting Dashboard (Risk = 5%*)
*Recommended for a Daily BTC/USDT Chart
Parabolic SAR Heikin Ashi MTF Candle ScalperThis is scalper strategy designed around parabolic sar indicator, where as an input candle value it uses the heikinashi from a higher timeframe.
This example has been adapted to SPY/SPX chart
In this case ,we are using a 5 min chart, but the calculations are made on a 15 min heikin ashi chart for the PSAR and then on 5 min chart we plot the results.
At the same time we are conditioning the entry to be base on a time/session for daytrading/scalper mentality
In this case we only enter within the first 30 min of SPY opening session , and then we exit after 3-4 hours of staying in the position ( unless we hit a reverse condition).
For long condition we enter when the mtf ha candle close is above the mtf psar and for short condition we enter when the mtf ha candle close is below the mtf psar
This script is made with an educational purpose to show the power of multiple time frame approach compared to a single chart.
If you have any questions, let me know !
Crypto Correlation Strategy based on Technical Ratings This is a swing trading crypto correlation strategy, based initially on technical ratings but adapted to the entire crypto market environment , by using as a source of calculations the candle values from CRYPTOCAP:TOTAL.
So since TOTAL, is the sum of all the crypto currencies, its going to be our leader. We will get the entries and exits , internally from it and input them into the crypto coins(more than 80-90% of the usdt perpetual pairs are following the same direction but with a higher volatility), and with this in general is going to give us as much better risk/reward than just by trading 1 coin alone.
So this means that all coins will enter and exit at the same time forom a trade. With this, since sometimes we have sudden big changes in the price form one side to another, is going to break a little this effect and since the initial movements were bigger, it would make us lose less. At the same time it can also make us lose more if the changes happen to soon.
One of the things of this particular idea is we dont have to worry about particular optimizations for each asset/coin.
This scenario has been adapted for 30min timeframe, using 0.1% comission per entry and 0.1% comission for exit from the trade.
I have tested so far with most USDT Perpetual Pairs from binance, and it seems to give good results with most of the pairs.
If you have any question please let me know !
matrixautotableLibrary "matrixautotable"
Automatic Table from Matrixes with pseudo correction for na values and default color override for missing values. uses overloads in cases of cheap float only, with additional addon for strings next, then cell colors, then text colors, and tooltips last.. basic size and location are auto, include the template to speed this up...
TODO : make bools version
var string group_table = ' Table'
var int _tblssizedemo = input.int ( 10 )
string tableYpos = input.string ( 'middle' , '↕' , inline = 'place' , group = group_table, options= )
string tableXpos = input.string ( 'center' , '↔' , inline = 'place' , group = group_table, options= , tooltip='Position on the chart.')
int _textSize = input.int ( 1 , 'Table Text Size' , inline = 'place' , group = group_table)
var matrix _floatmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 0 )
var matrix _stringmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 'test' )
var matrix _bgcolormatrix = matrix.new (_tblssizedemo, _tblssizedemo, color.white )
var matrix _textcolormatrix = matrix.new (_tblssizedemo, _tblssizedemo, color.black )
var matrix _tooltipmatrix = matrix.new (_tblssizedemo, _tblssizedemo, 'tool' )
// basic table ready to go with the aboec matrixes (replace in your code)
// for demo purpose, random colors, random nums, random na vals
if barstate.islast
varip _xsize = matrix.rows (_floatmatrix) -1
varip _ysize = matrix.columns (_floatmatrix) -1
for _xis = 0 to _xsize -1 by 1
for _yis = 0 to _ysize -1 by 1
_randomr = int(math.random(50,250))
_randomg = int(math.random(50,250))
_randomb = int(math.random(50,250))
_randomt = int(math.random(10,90 ))
bgcolor = color.rgb(250 - _randomr, 250 - _randomg, 250 - _randomb, 100 - _randomt )
txtcolor = color.rgb(_randomr, _randomg, _randomb, _randomt )
matrix.set(_bgcolormatrix ,_yis,_xis, bgcolor )
matrix.set(_textcolormatrix ,_yis,_xis, txtcolor)
matrix.set(_floatmatrix ,_yis,_xis, _randomr)
// random na
_ymiss = math.floor(math.random(0, _yis))
_xmiss = math.floor(math.random(0, _xis))
matrix.set( _floatmatrix ,_ymiss, _xis, na)
matrix.set( _stringmatrix ,_ymiss, _xis, na)
matrix.set( _bgcolormatrix ,_ymiss, _xis, na)
matrix.set( _textcolormatrix ,_ymiss, _xis, na)
matrix.set( _tooltipmatrix ,_ymiss, _xis, na)
// import here
import kaigouthro/matrixautotable/1 as mtxtbl
// and render table..
mtxtbl.matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _tooltipmatrix, _textSize ,tableYpos ,tableXpos)
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _tooltipmatrix, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_textcolormatrix : color
_tooltipmatrix : string
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _textcolormatrix, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_textcolormatrix : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _bgcolormatrix, _txtdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_bgcolormatrix : color
_txtdefcol : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _stringmatrix, _txtdefcol, _bgdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_stringmatrix : string
_txtdefcol : color
_bgdefcol : color
_textSize : int
tableYpos : string
tableXpos : string
matrixtable(_floatmatrix, _txtdefcol, _bgdefcol, _textSize, tableYpos, tableXpos) matrixtable
Parameters:
_floatmatrix : float vals
_txtdefcol : color
_bgdefcol : color
_textSize : int
tableYpos : string
tableXpos : string
debuggerDEBUGGER is a library to help print debug messages to a console.
This library provides an easy-to-use interface to print your debugging messages to a console in the chart. Special attention has been given to printing series and arrays easily.
A debugger is a valuable tool when working on scripts and getting into trouble. Unfortunately, TradingView does not provide an interactive debugger, and does not provide a console to use the oldest trick in the debugging book: print statements. This library provides you with the latter tool, print statements.
As a bonus, the library also provides a way to show labels in the chart next to the pricing action.
For more information and examples of usage, check the description in the header comments.
[UTILS] Unit Testing FrameworkTL;DR
This script doesn't provide any buy/sell signals.
This script won't make you profitable implicitly.
This script is intended for utility function testing, library testing, custom assertions.
It is free and open-source.
Introduction
About the idea: is not exclusive, programmers tend to use this method a lot and for a long time.
The point is to ensure that parts of a software, "units" (i.e modules, functions, procedures, class methods etc), work as they should, meet they design and behave as intended. That's why we use the term "Unit testing".
In PineScript we don't have a lot of entities mentioned above yet. What we have are functions. For example, a function that sums numbers should return a number, a particular sum. Or a professor wrote a function that calculates something or whatever. He and you want to be sure that the function works as expected and further code changes (refactoring) won't break its behaviour. What the professor needs to do is to write unit tests for his function/library of functions. And what you need to do is to check if the professor wrote tests or not.
No tests = No code
- Total test-driven development
Ok, it is not so serious, but very important in software development. And I created a tool for that.
I tried to follow the APIs of testing tools/libs/frameworks I worked or work with: Jasmine (Javascript), Mocha/Chai (Javascript), Jest (Javascript), RSpec (Ruby), unittest (Python), pytest (Python) and others. Got something workable but it would be much easier to implement (and it would look much better) if PineScript had a higher-order functions feature.
API
_describe(suiteName: string)
A function to declare a test suite. Each suite with tests may have 2 statuses:
✔️ Passed
❌ Failed
A suite is considered to be failed if at least one of the specs in it has failed.
_it(specName: string, actual: any, expected: any)
A function to run a test. Each test may have 3 statuses:
✔️ Passed
❌ Failed
⛔ Skipped
Some examples:
_it("is a falsey value", 1 != 2, true)
_it("is not a number", na(something), true)
_it("should sum two integers", _sum(1, 2), 1)
_it("arrays are equal", _isEqual(array.from(1, 2), array.from(1, 2)), true)
Remember that both the 'actual' and 'expected' arguments must be of the same type.
And a group of _it() functions must be preceded by a _describe() declaration (see in the code).
_test(specName: string, actual: any, expected: any)
An alias for _it . Does the same thing.
_xit(specName: string, actual: any, expected: any)
A function to skip a particular test for a while. Doesn't make any comparisons, but the test will appear in the results as skipped.
This feature is unstable and may be removed in the future releases.
_xtest(specName: string, actual: any, expected: any)
An alias for _xit . Does the same thing.
_isEqual(id_1: array, id_2: array)
A function to compare two arrays for equality. Both arrays must be of the same type.
This function doesn't take into account the order of elements in each array. So arrays like (1, 2, 3) and (3, 2, 1) will be equal.
_isStrictEqual(id_1: array, id_2: array)
A function to compare two arrays for equality. Both arrays must be of the same type.
This function is a stricter version of _isEqual because it takes into account the order of elements in each array. So arrays like (1, 2, 3) and (3, 2, 1) won't be equal.
Usage
To use this script to test your library you need to do the following steps:
1) Copy all the code you see between line #5 and #282 (Unit Testing Framework Core)
2) Place the copied code at the very beginning of your script (but below study())
3) Start to write suites and tests where your code ends. That's it.
NOTE
The current version is 0.0.1 which means that a lot of things may be changed on the way to 1.0.0 - the first stable version.
Cosmic BB SRThis script is based on Bollinger Bands/Bandwidth data and displays support and resistance levels (thick horizontal lines), the direction/volatility of the levels (thin dynamic lines), and the testing of the levels (cross markers).
Formula for Day Trading NSEINDAtesting script. please try at your own risk. don't claim if any damage
BB + RSI testThis is a back-test tool for the BB + RSI indikator
- Set your gain percentage and the rest of your parameters and see how does it work on a chart.
- The pyramid buying is on by default you can turn it off in indicator settings/properties
Supertrend V1.0 - Buy or Sell SignalTesting a concept to get a TP and SL based on the ATR at the time of the position entry.
Manual Back Test LinesI created this indicator to primarily manually test other indicators in replay mode.
To use this indicator generally you will:
Select trade type: long or short
Enter your ATR (enter the actual ATR). The indicator will then calculate and plot your SL and targets based on your values
Default Stop Loss is ATR * 1.5
Default Target 1 is ATR * 1.5
Default Target 2 is ATR * 3
Using this indicator on Replay mode is great. What you do is go back in time. Hit play and as the indicator(s) you use provide signals pause.
Pull up options:
Select trade type
Update ATR value
Change date to entry date. Typically if you are trading off the daily timeframe you are going to wait for your current day candle to close to provide signal. That would mean your entry would be on the next day.
Click play and watch, track and record how trade unfolds.
Future updates:
I'd like to be able to have some way to click one button and have it fire that enter trade right now on chart. Also I'm working on figuring out how to calculate the ATR on the entry date so that isn't required to be entered.
Finally, I'd like to have some auto calculation on when targets and SL are hit. I have this partially done but it's more important that I use this indicator than spend time or funds to update it to do that. But I do plan on updating.
PARSEC Bitcoin strategy for testing: SMA + ADX + Fisher transfStrategy using SMA, ADX and modified Fisher transform (I've made linear transformation on original Ehler's Fisher transform) and implemented into Bitcoin trading perspective.
Current strategy is optimized for Bitcoin.
General objectives is to add, remove indicators:
- to further improve the strategy for Bitcoin
- adjust the strategy to be feasible for wider range of cryptocurrencies (preferably for the top 2-5 or top 2-10 ones), without significantly decreasing the current profit factor and profit rates
Experienced technical analysts feel free to PM me if you want to test the strategy (at this stage up to 5 people's participation would be appreciated).
For those ones who significantly contribute, I will give life-long access to both the improved strategy and alerts.
ACM22 not repaintedДелал данный скрипт для FORTS.Идеально подойдет тем,кто использует трейлинг стопы.В основе стратегии лежит RSI.Как по мне,хорошая вещь для проверки стратегии и ее оптимизиации.На скрине 50 контрактов,так что не сильно радуйтесь,а просто делите на 50 и получите показатели на 1 контракт.
Script make for futures on MICEX.U can change paramets of RSI,traling stop and stop loss .On a ps 50 futures USDollar-russian ruble.Use for testing and optimisation.
C320up Strategy Tester Start TimeC320up Strategy Tester Start Time
This is a little snippet you can paste into your Strategy to set the testing start date and time.
It is not a Strategy per se, though is an example with the timestamp script included.
Instructions are fairly straight forward, and are listed in the script.
If for some reason you also wanted an end date, that too is possible. Just leave a note in the comments.
Disclaimer: We searched for a similar script on TV, and could not find anything at this point in time.
You can set your preferred date and time in the input section of the settings.
Enjoy!
Strategy Testing Advanced Buy/Sell SignalsThis is strategy testing my Advanced Buy/Sell Signal script found here
TradingView is limited to strategy testing based on close price, so this is actually buying/selling a day later than each arrow. This does not repaint- arrows appear in realtime on the actual script, which is nice because that makes it useful.
Binary Options Strategy Testing ScriptThis is a script for testing binary options trading strategies. To test a strategy, modify the 'go_down' or 'go_up' booleans. These SHOULD NOT access any current values (for example, 'ohlc4' or 'close '), or the backtesting will not be an accurate representation of the forward values.
Modify the fraction_return input to be the return rate of the option on success. This is assumed to be a true 100 or 0 option- i.e. if the choice is not correct, there is a 100% loss.
The strategy in place is merely an example, and as you can see, has a very negative rate of return when implemented as a strategy.
Please comment in your code if you use this in any future posts. Thanks!