OPEN-SOURCE SCRIPT

ProfitView Strategy Template

Hello traders,

This script took me a full week of coding/testing, sweat, and tears - and I’m too nice as I’m giving it for free to the community.

If you're tired of manual trading and looking for a solid strategy template to pair with your indicators, look no further.
This Pine Script v5 strategy template is engineered for maximum customization and risk management.
Best part?
This Pine Script v5 template facilitates the dynamic construction of ProfitView alerts, sparing users the time and effort of mastering the ProfitView syntax and manually creating alert commands.

This powerful tool gives much power to those who don't know how to code in Pinescript and want to automate their indicators' signals via the ProfitView Chrome extension.

IMPORTANT NOTES

ProfitView is a trading bot software that forwards TradingView alerts to your brokers (examples: Binance, Oanda, Coinbase, Bybit, etc.) for automating trading.
Many traders don't know how to dynamically create ProfitView-compatible alerts using the data from their TradingView scripts.

Traders using trading bots want their alerts to reflect the stop-loss/take-profit/trailing-stop/stop-loss to break options from your script and then create the orders accordingly.

This script showcases how to create ProfitView alerts dynamically.

TRADINGVIEW ALERTS

1) You'll have to create one alert per asset X timeframe = 1 chart.
Example: 1 alert for EUR/USD on the 5 minutes chart, 1 alert for EUR/USD on the 15-minute chart (assuming you want your bot to trade the EUR/USD on the 5 and 15-minute timeframes)

2) Select the Order fills and alert() function calls condition

3) For each alert, the alert message is pre-configured with the text below
{{strategy.order.alert_message}}

Please leave it as it is.
It's a TradingView native variable that will fetch the alert text messages built by the script.

4) ProfitView doesn't use webhook technology, so setting a webhook URL from the alerts notifications tab is unnecessary.

KEY FEATURES

I) Modular Indicator Connection
* plug your existing indicator into the template.
* Only two lines of code are needed for full compatibility.

Step 1: Create your connector

Adapt your indicator with only 2 lines of code and then connect it to this strategy template.

To do so:

1) Find in your indicator where the conditions print the long/buy and short/sell signals.
2) Create an additional plot as below

I'm giving an example with a Two moving averages cross.

Please replicate the same methodology for your indicator, whether a MACD , ZigZag, Pivots , higher-highs, lower-lows or whatever indicator with clear buy and sell conditions.



II) BOT Risk Management:

- Max Drawdown:
Mode: Select whether the max drawdown is calculated in percentage (%) or USD.
Value: If the max drawdown reaches this specified value, set a value to halt the bot.

- Max Consecutive Days:
Use Max Consecutive Days BOT Halt: Enable/Disable halting the bot if the max consecutive losing days value is reached.

- Max Consecutive Days: Set the maximum number of consecutive losing days allowed before halting the bot.

- Max Losing Streak:
Use Max Losing Streak: Enable/Disable a feature to prevent the bot from taking too many losses in a row.

- Max Losing Streak Length: Set the maximum length of a losing streak allowed.
Margin Call:

- Use Margin Call: Enable/Disable a feature to exit when a specified percentage away from a margin call to prevent it.
Margin Call (%): Set the percentage value to trigger this feature.

- Close BOT Total Loss:
Use Close BOT Total Loss: Enable/Disable a feature to close all trades and halt the bot if the total loss is reached.

- Total Loss ($): Set the total loss value in USD to trigger this feature.
Intraday BOT Risk Management:

- Intraday Losses:
Use Intraday Losses BOT Halt: Enable/Disable halting the bot on reaching specified intraday losses.
Mode: Select whether the intraday loss is calculated in percentage (%) or USD.

- Max Intraday Losses (%): Set the value for maximum intraday losses.
Limit Intraday Trades:

- Use Limit Intraday Trades: Enable/Disable a feature to limit the number of intraday trades.

- Max Intraday Trades: Set the maximum number of intraday trades allowed.
Restart Intraday EA:

- Use Restart Intraday EA: Enable/Disable a feature to restart the bot at the first bar of the next day if it has been stopped with an intraday risk management safeguard.

III) Order Types and Position Sizing

- Choose between market, limit, or stop orders.
- Set your position size directly in the template.

Please use the position size from the “Inputs” and not the “Properties” tab.
I know it's redundant. - the template needs this value from the "Inputs" tab to build the alerts, and the Backtester needs it from the "Properties" tab.

IV) Advanced Take-Profit and Stop-Loss Options

- Choose to set your SL/TP in either pips or percentages.
- Option for multiple take-profit levels and trailing stop losses.
- Move your stop loss to break even +/- offset in pips for “risk-free” trades.

V) Miscellaneous
Retry order openings if they fail.

Order Types:
Select and specify order type and price settings.

Position Size:
Define the type and size of positions.

Leverage:
Leverage settings, including margin type and hedge mode.

Session:
Limit trades to specific sessions.

Dates:
Limit trades to a specific date range.

Trades Direction:
Direction: Specify the market direction for opening positions.

VI) Notifications (Telegram/Discord/Email/IFTTT/Twilio/SMS)
Customize notifications sent to Telegram, Discord, Email, IFTTT, Twilio, and ProfitView Logger.

VII) Logger

The ProfitView commands are logged in the TradingView logger.
You'll find more information about it in this TradingView blog post.

WHY YOU MIGHT NEED THIS TEMPLATE

1) Transform your indicator into a ProfitView trading bot more easily than before
Connect your indicator to the template
Create your alerts
Set your EA settings

2) Save Time
Auto-generated alert messages for ProfitView.
I tested them all and checked with the support team what could/couldn’t be done.

3) Be in Control
Manage your trading risks with advanced features.

4) Customizable
Fits various trading styles and asset classes.

REQUIREMENTS

* Make sure you have your ProfitView account and do the settings correctly in your Chrome extension. If you don't know how to do it, read the documentation + ask for help in the ProfitView Discord support channel.
* If there is any issue with the template, ask me in the comments section - I’ll answer quickly.

BACKTEST RESULTS FROM THIS POST

1) I connected this strategy template to a dummy Supertrend script.
I could have selected any other indicator or concept for this script post.
I wanted to share an example of how you can quickly upgrade your strategy, making it compatible with ProfitView.

2) The backtest results aren't relevant for this educational script publication.
I used realistic backtesting data but didn't look too much into optimizing the results, as this isn't the point of why I'm publishing this script.
This strategy is a template to be connected to any indicator - the sky is the limit. :)

3) This template is made to take 1 trade per direction at any given time.
Pyramiding is set to 1 on TradingView.

The strategy default settings are:

* Initial Capital: 100000 USD
* Position Size: 1%
* Commission Percent: 0.075%
* Slippage: 1 tick
* No margin/leverage used

Best regards,
Dave
educationalPine utilitiesprofitviewTrend Analysis

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?


⭐️ Listed as an Official TradingView Trusted TOP Pine Programmer

📧 Coding/Consulting Inquiries: dave@best-trading-indicator

Telegram: Daveatt

⏩ Course: best-trading-indicator.com

Twitter: twitter.com/bti_trading
更多:

免责声明