输入/搜索内容

Adaptive Zero Lag EMA Strategy

通用策略
创建日期: 2023-09-08 16:24:02
最后修改: 3 年前
复制: 0
点击次数: 860
1
关注
1830
关注者

The script you've provided is based on the Adaptive Zero Lag EMA (AZLEMA) strategy. This script uses the principles of John Ehlers' signal processing research and a method known as Cosine Instantaneous Frequency Measurement (IFM) for determining the dominant cycle period, i.e., the length of time between two identical points in successive cycles in your trading data.

Here's a brief overview of what the trading script does:

  1. Initially, it sets up the strategy using a configuration of default inputs like period, adaptive mode, gain limit, threshold, stop loss points and take profit points. The currency is set to USD and the initial capital to 1000.

  2. It then sets up calculations for the adaptive mode using a combination of differential equations and Ehlers' method (used when the 'Adaptive?' setting is set to true).

  3. It calculates the average value (EMA) of the selected source of data over the selected period.

  4. It performs a loop operation to find the Gain and Error Correlation (EC) values that minimize the absolute Error.

  5. Using these values, it calculates the final EC value and plots the value of EC and EMA on the chart.

  6. It creates potential buy and sell conditions based on the crossover and crossunder of EC and EMA above a certain defined threshold.

  7. It sets up rules for entering and exiting long and short positions based on the buy and sell conditions determined earlier. For each position, it calculates the lot size and enters a position when the respective condition (buy/sell) is true. It sets a stop loss and a trailing take profit for each position.

This script seems quite comprehensive and versatile as it allows you to change multiple parameters to adapt to different trading styles and market conditions. As always, it's recommended to backtest this strategy using historical data before using it in live trading.

策略源码
Pine
/*backtest
start: 2023-08-08 00:00:00
end: 2023-09-07 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy(title="Adaptive Zero Lag EMA", shorttitle="AZLEMA", overlay = true, initial_capital=1000, currency="USD", commission_type=strategy.commission.cash_per_contract, commission_value=0.000005, slippage = 5, pyramiding=1, calc_on_every_tick=true)

src = input(title="Source",  defval=close)
策略参数
策略参数
Source
Period
Adaptive?
Gain Limit
Threshold
SL Points
TP Points
Risk
评论
全部评论 (0)
暂无数据
暂无数据
  • 1
社区
回测系统
APP 下载
iPhone 下载
© 2015 - ∞ INVENTOR PTE LTD (SG)