Vix Fix Gold Trend Stats — Strategy by edwinardyanto

By edwinardyanto

Performance Metrics

Description

Vix Fix Gold Trend Stats turns the popular CM_Williams_Vix_Fix by ChrisMoody into a testable strategy and prints a statistics panel that compares two ways of trading it on the same chart.CreditsThe indicator math (Williams Vix Fix = distance of the low from the highest close of the last 22 bars, highlighted green when it is above its Bollinger upper band or near its 50-bar high) is ChrisMoody's open-source "CM_Williams_Vix_Fix Finds Market Bottoms", based on Larry Williams' Vix Fix idea, ported to Pine v6 without changing the formula: All credit for the indicator goes to ChrisMoody (and Larry Williams for the original idea). This script adds the trading rules, trend filter, stop loss / take profit, BUY / EXIT markers and the statistics panel.What is added- Row 1 (default, plain use): buy on the first green bar (possible market bottom), exit when the bar turns gray again. Buy only, like the indicator.- Row 2 (best): same entry, but only when the close is above the 200-period SMA (input). Exit only at a stop loss of 2 x ATR(14) or a take profit of 3R (3 x the stop distance), both measured from the entry price.- BUY / EXIT labels on the price chart and the strategy orders follow row 2.How results are measured (written openly so anyone can check them)- Signals are read on candle close; fills happen at the next candle open. No lookahead, no repainting. Stop loss and take profit are checked inside each candle (stop first if both are touched); a gap through either level fills at the open.- Each trade uses a fixed 1x position (no leverage, no compounding). Trade result = % change minus spread on both sides (input, default 0.02% per side) minus swap/financing per day held (input, default 5% per year).- Panel: closed trades, win rate, sum of trade %, profit factor (gross profit / gross loss), max drawdown of the summed trade curve, and results split into Sample In / Sample Out by the split date input.- Only trades inside the Start / End date inputs are counted; a position still open at the end date is not counted.- The built-in Strategy Tester uses 10% of equity per trade, no swap, and places stop/target from the signal candle close, so its numbers differ from the panel. The panel is the reference.Why the 200 SMA filter, 2 ATR stop, 3R targetAll indicator inputs were kept at their defaults (22 / 20 / 2.0 / 50 / 0.85). Only the way of trading it was varied (entry on the first green bar or the first gray bar after green, trend filter, exit type, holding time, stop/target), chosen on the Sample In period (first half of the data, at least 20 trades, highest profit factor) and then checked on Sample Out. Neighbouring settings (lookback 18 and 28, band multiplier 1.5 and 2.5, percentile 0.80 and 0.90) were also positive in both halves. The plain rule wins often (62.5%) but its average loss is about twice its average win. In this test period gold rose strongly, which helps any buy-only rule.NotesHistorical statistics only. Past results do not guarantee future results. Spread and swap differ between brokers; adjust the inputs to your own conditions.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView