Trendoscope

Strategy Template

Trendoscope Wizard Mis à jour   
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.

Notes de version:
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

Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?