Trendoscope

Strategy Template

Trendoscope Wizard Cập nhật   
Trying to include few basic things which is needed for strategy which can be used as template.

Few important components

Strategy parameters

Few important parameters include - initial_capital, default_qty_type, default_qty_value, commission_type, pyramiding and commission_value. All my strategies will have similar settings with initial captial set to 20000 to 100000. 100% of equity per trade with no pyramiding (set to 1) and minimal commission.

margin_long and margin_short can be used for leveraged trading. But, since we are not using pyramiding, it will make no effect.

Trade Limiting parameters

Two types of limiting is available in the scripts
  • Limiting trading direction : this is done through method strategy.risk.allow_entry_in and input parameter tradeDirection
  • Limiting trades to particular time window : This is achieved through adding start time and end time parameters of type input.time and check whether time is within this window

Custom Methods

  • customized security method to get higher timeframe data
  • customized moving average method to get moving average of any type

Custom Parameters

  • Moving average Type option list which I use quite often. Any strategy where there is need to use moving average, I try to scan through different moving average types and lengths to see which one is more appropriate for the given strategy. Hence, keeping this parameter in template to make it readily available when I start with new strategy
  • waitForCloseBeforeExit - this is used if trailing stop need to activated as soon as price hits the stop or only on close price. This is again something I switch quite often based on strategy. Hence, keeping this as part of the template.

Entry and Exit statements for long and short

These statements from line (57 to 62) can remain as is even with new strategy. Only thing to be set are variables - buyCondition, sellCondition, closeBuyCondition and closeSellCondition

Last but not the least

In pinescript, a long and short position cannot coexist in a strategy at any point of time. Any short positions created will automatically stop long positions and vice versa. Hence, it is important make short and long trades mutually exclusive. In this example, I have used 200 weekly moving average as trend bias. No short positions are taken when price is trading above 200 weekly moving average low/close and no long positions are taken when price is less than 200 weekly moving average high/close. Any rule built on top of this (In this case a simple supertrend rules) ensures that there are no conflicting signals and hence avoids confusing trades on the stratgy.

Phát hành các Ghi chú:
Updated
  • strategy margin parameters. Set 90 as default
  • Qty set to 90 to avoid margin calls (Which I think is a bug)
  • Added groups to default strategy trade filters

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 đồ?