Special Variables

Special Variables have specific meanings in the Equihack language. Below, we give detail to what those meanings are.

affirm_*

A special true/false that is used in General.
Used to create criteria for homework assignments. If the variable is not true for some value, it is plotted everywhere.
frequency: common


draftmode

A special true/false that is used in Backtesting.
Can prevent the positions table from being generated. It is faster but degrades the summary report.
frequency: common


order_by

A special number that is used in Backtesting.
Used in conjunction with max_holdings to limit holdings. Selects the stock with the largest value first. Ties are included.
frequency: common


rebalance

A special true/false that is used in Backtesting.
When stocks are all sold and rebought. Rebalance expressions cannot be per stock. Rebalance expressions using only dates will all be triggered the day it becomes true.
frequency: common


rebalance_stop_losses_down

A special true/false that is used in Backtesting.
When to reset stop losses for all stocks if the stock has gone down. Used to update trailing stop losses.
frequency: common


score

A special number that is used in Screeners and Watchlists.
the score used to evaluate stocks in the heatmap views.
frequency: common


stop_gain

A special number that is used in Backtesting.
Used to model stop gain orders, also called profit-taking orders. Expressed as Close * multiple, or similar.
frequency: common


stop_loss

A special number that is used in Backtesting.
Used to model stop loss orders. Expressed as Close * multiple, or similar.
frequency: common


time_max_hold

A special number that is used in Backtesting.
Forces sale of stocks after the time is met. Any expression numeric expression is fine. Ex: if change close 10 < 0 0 else 9999
frequency: common


time_min_hold

A special number that is used in Backtesting.
Prevents the sale of stocks until the time is met. Any expression numeric expression is fine. Ex: if change close 10 > 0 9999 else 0
frequency: common


meta_ignore_file_date

A special true/false that is used in General.
Used to turn off look ahead bias prevention. Don’t use it unless you know exactly what you are doing!
frequency: dangerous


unit_cheat

A special true/false that is used in General.
Boolean to disable close > 5 checking. Using this can allow bias
frequency: dangerous


initial_cash

A special number that is used in Simulator Backtest.
Trigger use of Portfolio Backtest. Sets the initial cash at the beginning of the backtest to X
frequency: occasional


rebalance_stop_gains

A special true/false that is used in Backtesting.
When to reset stop gains for all stocks, either up or down. Used for both trailing stop losses and gain.
frequency: occasional


rebalance_stop_gains_down

A special true/false that is used in Backtesting.
When to reset stop gains for all stocks, if the stock has gone down. Used to update trailing stop losses.
frequency: occasional


rebalance_stop_gains_up

A special true/false that is used in Backtesting.
When to reset stop gains for all stocks if the stock has increased. Used to update trailing stop gains.
frequency: occasional


rebalance_stop_losses

A special true/false that is used in Backtesting.
When to reset stop losses for all stocks, either up or down. Used for both trailing stop losses and gain.
frequency: occasional


*_weight

A special number that is used in Backtest.
Sets the weight of the given security. Ex: spy_weight sets the weight of SPY. If no security exists, look for a numeric var of that name and use it as a price series. So if a banana exists and is the price of bananas, banana_weight simulates holding a fixed quantity of bananas in the portfolio.
frequency: rare


account_minimum

A special number that is used in Simulator Backtesting.
The account stops making any trades and sells all stocks if PortfolioValueTotal falls below this amount
frequency: rare


buy_price

A special number that is used in Backtesting.
The price of a stock when it is bought. Normally Close, unless overridden by commissions or other. See Trading Price: Kini for example
frequency: rare


cache_hint

A special true/false that is used in General.
It used to force the system to cache everything, making the current run slower and future runs faster.
frequency: rare


cash_weight

A special number that is used in Backtesting.
The weight of cash. Values other than 0 simulate cash in the portfolio not used for investing. Negative values simulate margin.
frequency: rare


delist_bankrupt

A special true/false used in Backtesting.
A per-stock boolean to decide a delisting is due to bankruptcy rather than a merger. Bankruptcies are assumed to lose everything
frequency: rare


dividend_payments

A special number that is used in Backtesting.
What dividends are given to shareholders. Normally unset or 0 to simulate eaten dividends
frequency: rare


evaluate

A special true/false that is used in Simulator Backtest.
Buys and sells stocks without distributed positions that are still in force. Triggers switching normal Backtest to Simulator Backtest.
frequency: rare


max_holdings

A special number that is used in Screeners, Watchlists, and Backtesting.
Used in conjunction with order_by to limit holdings.
frequency: rare


mtm_price

A special number that is used in Backtesting.
A calculation to define today’s price for each stock, normally Close.
frequency: rare


num_montes

A special number that is used in Backtesting.
How many montes to run
frequency: rare


num_tries

A special integer that is used in Backtesting.
For choose_set/choose_range: How many choices to run for items
frequency: rare


orders

A special number that is used in Simulator Backtesting.
Simulates buy and sell orders in a screener. use maximum TERM1 … TERMN where each TERM is any of Close N at DATE, to simulate adding (or subtracting) the given amount of cash at the given date GE: Close 10000 at DATE, to simulate buying $10,000 of GE stock on the given date 100 GE: Close at DATE, to simulate buying 100 shares of GE stock GE: Close 100 * 13.57 at DATE to simulate buying 100 shares of GE stock for $13.57 each
frequency: rare


position_weights

A special number that is used in Backtesting.
The weight to give each position. These are added and divided to create unit weights, so market_cap is a fine weight. Weights less than zero in old-style portfolios require the user to offset the cash generated with cash_weight, or else the results are wrong
frequency: rare


rebalance_stop_losses_up

A special true/false that is used in Backtesting.
When to reset stop losses for all stocks if the stock has increased. Used to update trailing stop losses.
frequency: rare


screener_honor_rebalance

A special true/false that is used in Screeners and Watchlists.
It makes the screener behave like a watchlist and show results from the last rebalance date before the screening date supplied.
frequency: rare


sell_price

A special number that is used in Backtest.
The price stocks are sold at. Normally Close, unless overridden by commissions or other. See Trading Price “Kini”, for example.
frequency: rare


time_cooldown

A special number that is used in Backtesting.
Prevents rebuying of sold stocks until the time since the sale is met. Any numeric expression is fine
frequency: rare


trading_cost

A special number that is used in Backtesting.
provides a default modeling for slippage. Is overridden by buy_price and sell_price
frequency: rare


try_delay

A special integer that is used in Backtesting.
For choose_set/choose_range: How far back to offset the test interval
frequency: rare


try_goal

A special number that is used in Backtesting.
For choose_set/choose_range: What are you looking for?
frequency: rare


try_interval

A special integer that is used in Backtesting.
For choose_set/choose_range: How long in trading days should the try screen cover
frequency: rare


universe

A special true/false that is used in General.
Sets the set of securities included in screens, ranks, and backtests. Stocks no longer matching the universe will be sold.
frequency: rare


which_montes

A special number used in Backtesting.
For items containing monte_range or monte_set. Use minimum X1 … XN, where each Xi is between 0 and 1, which monte lines to plot. if -1 is included, plot all
frequency: rare


which_try

A special number that is used in Backtesting.
For choose_set/choose_range: Which of the test tries should be carried forward? Between 0 and 1
frequency: rare


assert_*

A special true/false that is used in General.
Used to test strategies, if assert_ is false, the system throws an error.
frequency: scaffolding


draft_only_current

A special true/false that is used in Backtesting.
Only include still holding positions in the positions table
frequency: scaffolding


meta_ignore_cash

A special true/false that is used in Simulator Backtesting.
Ignore cash when calculating the green line, so the portfolio is scored as if it was fully invested, and no more
frequency: scaffolding


nocache

A special true/false that is used in General.
It prevents any part of the term from being cached. It slows everything down!!!
frequency: scaffolding


holding_cost

A special number that is used in Backtesting.
The cost to hold the current portfolio. Any numeric per stock expression is fine
frequency: speculative


tabulate_details

A special true/false that is used in Backtesting.
Experimental: tabulate all plot variables into a table for attribution analysis.
frequency: speculative