Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesSkew Regime Trend
QuaScript

Skew Regime Trend

Free

EMA trend trades filtered by the skew of returns

0.0(0)
0 installs 0 0 comments
Q
433 listings

The QuaTick team's QuaScript analyses, run by the native C++ engine.

View Profile
quascriptstrategyskewtrend
Free
Backtest this strategy Open in QuaCode Edit in IDE
Version
Updated
Compatible

Live engine preview

QuaScriptQuaScript

The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.

Skew Regime Trendengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

About

Trend following that respects the shape of returns: longs on EMA crosses only while returns are right-skewed (gains come in bursts), shorts only while they are left-skewed (losses come in bursts). Exit on the opposite cross or an ATR stop.


Settings

Fast EMA: 20

Slow EMA: 60

Skew window: 100

Stop (ATR): 2.5


Backtest it yourself

Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.

Strategy Rules

Entry Conditions

    Exit Conditions

      Source Code

      Edit in IDE
      quascript
      1strategy "Skew Regime Trend" {
      2 overlay = true
      3 capital = 100000
      4 commission = 0.05
      5 slippage = 1
      6 sizing = risk_percent
      7 size = 1
      8 max_leverage = 1
      9}
      10/// Trend following that respects the shape of returns: longs on EMA crosses only while returns are
      11/// right-skewed (gains come in bursts), shorts only while they are left-skewed (losses come in
      12/// bursts). Exit on the opposite cross or an ATR stop.
      13fast = param.int(20, title = "Fast EMA", min = 2, max = 500)
      14slow = param.int(60, title = "Slow EMA", min = 5, max = 1000)
      15win = param.int(100, title = "Skew window", min = 20, max = 2000)
      16stopk = param.float(2.5, title = "Stop (ATR)", min = 0.5, max = 10, step = 0.1)
      17r = math.log(close / close[1])
      18sk = stat.skew(r, win)
      19f = ta.ema(close, fast)
      20s = ta.ema(close, slow)
      21a = ta.atr(14)
      22flat = position.size == 0
      23if flat and ta.cross_up(f, s) and sk > 0 and not math.is_na(a) {
      24 order.market("L", side.long)
      25 exit.bracket("L stop", entry = "L", stop = close - stopk * a)
      26}
      27if flat and ta.cross_down(f, s) and sk < 0 and not math.is_na(a) {
      28 order.market("S", side.short)
      29 exit.bracket("S stop", entry = "S", stop = close + stopk * a)
      30}
      31if position.size > 0 and ta.cross_down(f, s) { exit.close_all() }
      32if position.size < 0 and ta.cross_up(f, s) { exit.close_all() }
      33risk.max_drawdown(25)
      34render.line(f, "Fast", color = sk > 0 ? color.lime.300 : color.red.300, width = 1.5)
      35render.line(s, "Slow", color = color.translucent(color.slate.300, 30), width = 1.5)
      36 
      Read-only preview. Open in QuaCode to edit and deploy.

      Reviews

      No reviews yet. Be the first to review this listing.

      Discussion

      Sign in to join the discussion. Your posts and replies show up on your profile.