OPEN-SOURCE SCRIPT
Aktualisiert

External Signals Strategy Tester

2 460
External Signals Strategy Tester
This strategy is designed to help you backtest external buy/sell signals coming from another indicator on your chart. It is a flexible and powerful tool that allows you to simulate real trading based on signals generated by any indicator, using input.source connections.

🔧 How It Works
Instead of generating signals internally, this strategy listens to two external input sources:

One for buy signals

One for sell signals

These sources can be connected to the plots from another indicator (for example, custom indicators, signal lines, or logic-based plots).

To use this:

Add your indicator to the chart (it must be visible on the same pane as this strategy).

Open the settings of the strategy.

In the fields Buy Signal and Sell Signal, select the appropriate plot (line, value, etc.) from the indicator that represents the buy/sell logic.

The strategy will open positions when the selected buy signal crosses above 0, and sell signal crosses above 0.
This logic can be easily adapted by modifying the crossover rule inside the script if your signal style is different.

⚙️ Features Included
âś… Configurable trade direction:
You can choose whether to allow long trades, short trades, or both.

âś… Optional close on opposite signal:
When enabled, the strategy will exit the current position if an opposite signal appears.

âś… Optional full position reversal:
When enabled, the strategy will close the current position and immediately open an opposite one on the reverse signal.

âś… Risk Management Tools:
You can define:

Take Profit (TP): Position will be closed once the specified profit (in %) is reached.

Stop Loss (SL): Position will be closed if the price drops to the specified loss level (in %).

BreakEven (BE): Once the specified profit threshold is reached, the strategy will move the stop-loss to the entry price.

đź“Ś If any of these values (TP, SL, BE) are set to 0, the feature is disabled and will not be applied.

🧪 Best Use Cases
Backtesting signals from custom indicators, without rewriting the logic into a strategy.

Comparing the performance of different signal sources.

Testing external indicators with optional position management logic.

Validating strategies using external filters, oscillators, or trend signals.

đź“Ś Final Notes
You can visualize where the strategy detected buy/sell signals using green/red markers on the chart.

All parameters are customizable through the strategy settings panel.

This strategy does not repaint, and it processes signals in real-time only (no lookahead bias).
Versionshinweise
Added time range.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.