OPEN-SOURCE SCRIPT
Complex Single Trade Strategy

This 'Complex Single Trade Strategy' is a generic trading strategy that features three different types of stops, and four take profits.
It takes a Buy/Sell source input of: [> 0 for Buy, < 0 for Sell, = 0 for Neither]
The first signal will trigger a position to open immediately in that direction, but subsequent signals in the same direction will be ignored whilst the position remains open, as this strategy allows only one position at once.
A signal in the opposite direction to the current position can either be ignored, or it can close the position, or it can close it then immediately open another one in the opposite direction.
It also takes an optional 'Cancel' indicator just to close positions. [> 0 for Buy closes short, < 0 for Sell close long, = 0 no action] Other signals will be ignored.
The three different types of stops, that can be applied individually, or together:
* Regular Stop
* Initial Trailing Stop
* Trailing Stop
The initial trailing stop works like a regular trailing stop until it reaches the cut off level, a percentage of the current asset price above or below the entry level, then it will no longer trail the price, remaining statically at this level.
From here the regular trailing stop can take over trailing the price. This is useful to move the stop to the entry level (or there abouts) fairly quickly. From there you might want to trail the price with a larger trailing stop for the rest of the trade.
0 cut off means it stops trailing the price at your entry level, positive above, negative below, for a long trade. For a short it would be the opposite.
Typically you would want:
Trailing Stop > Initial Trailing Stop >= Stop
The four take profits each specify an amount to reduce the position size by, and at what specified percentage gain in price this is triggered.
My 'Simple Buy/Sell Indicator' and 'Custom Buy/Sell Indicator' (coming soon - watch this space) can be used to combine other indicators together into BUY/SELL strategies, using multiple custom rules. These can then be used as inputs to this strategy.
It takes a Buy/Sell source input of: [> 0 for Buy, < 0 for Sell, = 0 for Neither]
The first signal will trigger a position to open immediately in that direction, but subsequent signals in the same direction will be ignored whilst the position remains open, as this strategy allows only one position at once.
A signal in the opposite direction to the current position can either be ignored, or it can close the position, or it can close it then immediately open another one in the opposite direction.
It also takes an optional 'Cancel' indicator just to close positions. [> 0 for Buy closes short, < 0 for Sell close long, = 0 no action] Other signals will be ignored.
The three different types of stops, that can be applied individually, or together:
* Regular Stop
* Initial Trailing Stop
* Trailing Stop
The initial trailing stop works like a regular trailing stop until it reaches the cut off level, a percentage of the current asset price above or below the entry level, then it will no longer trail the price, remaining statically at this level.
From here the regular trailing stop can take over trailing the price. This is useful to move the stop to the entry level (or there abouts) fairly quickly. From there you might want to trail the price with a larger trailing stop for the rest of the trade.
0 cut off means it stops trailing the price at your entry level, positive above, negative below, for a long trade. For a short it would be the opposite.
Typically you would want:
Trailing Stop > Initial Trailing Stop >= Stop
The four take profits each specify an amount to reduce the position size by, and at what specified percentage gain in price this is triggered.
My 'Simple Buy/Sell Indicator' and 'Custom Buy/Sell Indicator' (coming soon - watch this space) can be used to combine other indicators together into BUY/SELL strategies, using multiple custom rules. These can then be used as inputs to this strategy.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。