The topics that follow provide four simple guided Tutorials that can be used when getting to know RealTest.
There is also a series of tutorial videos on the mhptrading YouTube channel.
The Examples folder (C:\RealTest\Scripts\Examples) contains the following:
Tutorial Scripts
•sample1.rts - simple moving average crossover strategy for SPY (see Tutorial 1)
•sample2.rts - a parameterized version of sample1, allowing for optimization (see Tutorial 2)
•sample2a.rts - a three-parameter version of sample2, also used in the same tutorial
•sample_scan.rts - introduces the Data section and the scanner (see Tutorial 3)
•sector_efts.rts - implements a monthly rotational strategy for the S&P 500 sector ETFs (see Tutorial 4)
Import Examples
•import_csv.rts - a hypothetical example of how to specify CSV data import (data not provided)
•import_ms.rts - a hypothetical example of how to specify MetaStock data import (data not provided)
•import_multi.rts - an example of how to combine data from multiple sources into a single RTD file
•import_norgate.rts - shows how to import data directly from Norgate NDU, and how to access Norgate's index constituency data
•import_tiingo.rts - shows how to import data from Tiingo, if you have an API key
•import_yahoo.rts - shows how to import all the SPX components from Yahoo (see Tutorial 3)
•djia_earnings.rts - an example of how to use an Event List File to include earnings dates in your imported data
•djia_make_syminfo.rts - shows how to create a Symbol Information File with Norgate metadata for use with other data sources
•djia_use_syminfo.rts - shows how to use a symbol information file to add metadata to a Yahoo import
•actual_trades.rts - shows how to "test" a list of actual trades using an Imported Trade List file, includes templates for various trade list formats
Scanning Examples
•breadth.rts - illustrates use of cross-sectional formulas in the Data Section to calculate and chart market a breadth indicator
•ibd_rs.rts - shows how to calculate IBD's relative strength ranks for any universe of stocks
•index_breadth.rts - shows the best way to calculate breadth statistics using only historical index constituents each day
•industry_indices.rts - shows how to use Norgate's "Corresponding Industry Index" features to know the industry relative strength of any stock
•multi_filter_scan.rts - shows how to write a scan that creates multiple rows per symbol per date with different data in them
•sctr.rts - shows how to calculate "StockCharts Trend Rank" for any universe of stocks
•stockbee_mm.rts - calculates current and historical values for all of the "Stockbee Market Monitor" breadth indicators
Indicators and Techniques
•anchored_vwap.rts - shows how to calculate volume-weighted average price anchored to a specific past date
•beta_indicator.rts - shows how to calculate "beta" of individual stocks vs. an index
•dividend_yield_series.rts - shows how to calculate the dividend yield series for all stocks
•ehlers_windows.rts - implements a set of indicators presented by John Ehlers in the Sept. 2021 issue of TASC
•fundamentals.rts - shows how to import and scan for Norgate current fundamentals
•martingale.rts - shows how to allow multiple positions in one symbol within a single strategy
•oc_all_actual.rts - shows how to structure a script to play back OrderClerkTrades.csv with multiple strategies (possibly from different scripts)
•scale_in.rts - shows how to scale in to a position as price moves in your favor, keeping risk smaller
•supertrend.rts - shows how to calculate and plot the "supertrend" indicator (dual trailing stops)
•trail_half.rts - shows how to divide a strategy into two half-allocation strategies to implement "take half off at a target and trail the rest"
•yield_rank.rts - shows how to calculate annualized dividend yield from actual dividends and rank stocks by their yields
Single-Strategy Systems
•cii_rotate.rts - shows how to use Norgate's Corresponding Industry Index capability to hold the top 3 stocks of the top 5 industries each month
•clenow_stocks_on_move.rts - a simple implementation of this strategy from a well-known book
•dividend_capture.rts - shows how to use Norgate dividend data and a slightly unusual approach to capturing dividends
•dynamic_sizing.rts - a minimal strategy showing the mechanics of dynamic position sizing in one stock
•dynamic_sizing_multi.rts -expands the above to the multi-stock portfolio level
•fliper.rts - a simple implementation of the Nick Radge "Flipper" strategy idea
•higher_lows.rts - a trend-following strategy that uses a series of higher pivot lows as an entry signal
•hybrid_asset_allocation.rts - implements this Keller and Keuning monthly ETF rotational strategy
•keller_baa.rts - implements the Keller "Bold Asset Allocation" monthly ETF rotational strategy
•keltner_pullback.rts - a pullback-after-momentum strategy based on the work of Adam Grimes, uses risk-based position sizing
•ndx_rotate.rts - a simple momentum-based rotational strategy using Nasdaq 100 component stocks
•ndx_rotate_factor_test.rts - shows how to loop through a set of completely different formulas using the optimizer
•ndx_rotate_weekly_reduce.rts - a variation of ndx_rotate that reduces position size during drawdowns
•simple_day_trade.rts - implements a simple long-only "day trading strategy" that enters with limit orders and exits at MOC
•simple_day_trade_basket_orders.rts - shows how easy it is to to generate a daily IB Basket Trader order file for this strategy
•simple_day_trade_basket_scan.rts - shows how produce the same order list using a Scan, in case you ever needed to
•spy_tlt_uis.rts - demonstrates using Walk-Forward optimization to implement a SPY/TLT strategy from an article
•vigilant_asset_allocation.rts - implements this Keller and Keuning monthly ETF rotational strategy
•vxx_long_short.rts - be long or short the VXX ETF depending on VIX term structure
•weekly_moc_asx - a simplified weekly mean-reversion strategy
•weekly_moc_asx_daily_weekly.rts - the above implemented as a weekly strategy within a daily script
•weekly_moc_asx_daily_daily.rts - the above implemented as weekly logic in a daily strategy
•weekly_trend_following.rts - a weekly Russell 1000 trend-following strategy similar to the Nick Radge "Weekend Trend Trader"
Multi-Strategy Systems
•bensdorp_book.rts - an implementation of the strategies described in Automated Stock Trading Systems by Laurens Bensdorp
•combined.rts - demonstrates how to combine strategies that use different symbol universes
•combined_multi_bar_size.rts - shows how strategies in a script can each use their own bar size and refer to external bar sizes
•combined_rebalance.rts - a version of combined.rts that models running each strategy in its own account with periodic transfers
•goal_30_15.rts - a response to a challenge to show a set of strategies with > 30% ROR and < 15% MaxDD (from 2014-2021)
•goal_30_15_asx.rts - a version of the above tailored for the Australian market ($XAO constituents)
•goal_30_15_tsx.rts - a version of the above tailored for the Canadian market ($SPTSXconstituents)
•mhp_classic.rts - provided for those who might be curious about the kinds of strategies Marsten traded in the early 2000s
•multi_moc_top_down.rts - combine four variations of simple_day_trade.rts using top-down setup selection
•oex_tf_top_down.rts - combined three OEX trend-following strategies using top-down setup selection
Mean Reversion Theme and Variations
•mr_sample.rts - presents a somewhat sophisticated long/short mean-reversion strategy pair using Norgate data (and an example of "tail risk" in January 2021)
•mr_sample_benchmark.rts - adds a benchmark strategy to the mr_sample example
•mr_sample_cash.rts - adds a strategy to the MR long/short pair to sweep unused capital into a "cash equivalent" ETF
•mr_sample_common.rts - contains the common elements of the following three examples, each of which includes this script
•mr_sample_debug.rts - demonstrates use of strategy debugging formulas to look under the hood of a running test, and also demonstrates the usefulness of the Library script section
•mr_sample_hedged.rts - adds an index ETF hedge to the mr_sample strategy pair
•mr_sample_orders.rts - shows how to configure this pair of strategies for OrderClerk order generation
•mr_sample_orders_alera.rts - shows how to configure the strategy pair for daily Alera Portfolio Manager signal file generation
•mr_sample_orders_basket.rts - shows how to configure the strategy pair for daily IB Basket Trader order file generation
•mr_sample_scan.rts - demonstrates a possible Daily Setups Scan that could be used with the mr_sample strategy pair
•mr_sample_scan_basket.rts - shows how to configure a scan to create an IB Basket Trader CSV file
•mr_sample_test_scan.rts - shows how to run a test+scan to generate a set of daily orders
•mr_sample_tracking.rts - shows how to test a strategy that only takes trades when its own equity curve is above a moving average (avoided above mentioned "tail risk"...)
•mr_sample_tracking_alloc.rts - shows how to test a strategy that reduces its allocation when its drawdown increases
Futures Examples
•es_compare.rts - using Norgate futures data, tests buy and hold of two continuous contract series (adjusted and unadjusted) vs. rolling through each individual contract
•futures_calendar_spread.rts - shows two ways to construct calendar spreads using Norgate futures data
•futures_trend_follow_simple.rts - simplest trend-following strategy using continuous back-adjusted contract data only
•futures_volume_rank.rts - trend-following strategy that uses #Rank #ByMkt to trade the most active individual contract from each market and roll as needed
•gc_kelly.rts - demonstrates how to model Kelly Criterion position sizing using a simple trend-following strategy for gold futures
•turtles.rts - an approximation of the original "Turtles" futures system, as documented by Curtis Faith
•vx_futures.rts - be long or short the front-month VX futures contract depending on the term structure
•vx_term_structure.rts - illustrates how to plot the entire VX futures term structure in the indicator pane of a $VIX chart
Files Used by Examples Scripts
•actual_trades.csv - the list of trades used in the actual_trades.rts example
•chartist_api_template.csv - order list template file for "The Chartist Smart API" (Nick Radge) output format
•djia_earnings.csv - a sample list of earnings dates for the DJIA components since 1/1/2019 (not guaranteed to be accurate)
•djia_info.csv - a detailed symbol information metadata file for the DJIA components
•djia_syms.txt - symbols of the current DJIA components
•holidays.txt - example HolidayList file, to facilitate order list generation for weekly or monthly strategies
•ib_basket_template.csv - order list template file for IB Basket Trader output format
•spx_syms.txt - symbols of the current S&P 500 components
|