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.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.