PineCoders

Signal for Backtesting-Trading Engine [PineCoders]

PineCoders Mod Cập nhật   
This is a companion script to the PineCoders Backtesting-Trading Engine. It illustrates how to build a signal plot in another script, which can in turn be fed in the Engine to provide entry, exit, filter and stop information.
Connection to the Engine is done through its “External Indicator” input field at the very bottom of the Engine’s Settings/Inputs.
The Engine must be operating in study mode to be able to connect an external indicator to it.
The way this script builds the signal is straightforward, as you will see in the code. Two aspects are worth mentioning:
The “FudgeStop()” function used to fudge the stop value by one tick for the rare cases where it will match one of the protocol reserved values, i.e. 1, 2 or 3.
The priority and exclusivity given to the different types of signals in the signal-building “Signal = …” line. No two signals can be sent simultaneously through the signal plot, except for the entry and stop combination.
You can determine in this script’s Settings/Inputs the type of signals that will go through the signal plot.

This script respects the following protocol:
EXTERNAL SIGNAL PROTOCOL
Only one external indicator can be connected to a script; in order to leverage its use to the fullest, the engine provides options to use it as either an entry signal, an entry/exit signal or a filter. When used as an entry signal, you can also use the signal to provide the entry’s stop. Here’s how this works:
For filter state: supply +1 for bull (long entries allowed), -1 for bear (short entries allowed).
For entry signals: supply +2 for long, -2 for short.
For exit signals: supply +3 for exit from long, -3 for exit from short.
To send an entry stop level with an entry signal: Send positive stop level for long entry (e.g. 103.33 to enter a long with a stop at 103.33), negative stop level for short entry (e.g. -103.33 to enter a short with a stop at 103.33). If you use this feature, your indicator will have to check for exact stop levels of 1.0, 2.0 or 3.0 and their negative counterparts, and fudge them with a tick in order to avoid confusion with other signals in the protocol.
Remember that mere generation of the values by your indicator will have no effect until you explicitly allow their use in the appropriate sections of the Engine’s Settings/Inputs.



Look first. Then leap.

Phát hành các Ghi chú:
Updated links in comments.
Phát hành các Ghi chú:
This is the Pinescripters Backtesting-Trading Engine for which this type of signal is meant to interact with.

Phát hành các Ghi chú:
Cleaned up code. The chart shows the Signal in the pane below the chart, with only the entry signals being transmitted by the signal plot (see this indicator's Inputs).

The signal is also connected to the Backtesting-Trading Engine appearing on the chart. The Engine has been configured so that:
1. The entry strat is set to "External indicator", and
2. This indicator's Signal plot has been selected in the Engine's "Connect your indicator here" field at the very bottom of the Engine's Inputs.

Since only the entries are sent to the Engine through the signal in this particular instance, the trades are exited using the Engine's active stop and exit strats.
Phát hành các Ghi chú:
Fixed comments.

Tools and ideas for all Pine coders: www.pinecoders.com
Our Pine FAQ & Code: www.pinecoders.com/faq_and_code/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?