Trendoscope

Strategy Template

Trendoscope Wizard アップデート済   
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.

リリースノート:
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

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?