Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home QuickStart Equihack Language Special Variables

Special Variables

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

affirm_*

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


draftmode

A special true/false used in Backtest.
Whether to prevent the positions table from being generated. Degrades the summary report, but is faster.
frequency:common


order_by

A special number used in Backtest.
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 used in Backtest.
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 used in Backtest.
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 used in Screener, Watchlist.
the score used to evaluate stocks in the heatmap views.
frequency:common


stop_gain

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


stop_loss

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


time_max_hold

A special number used in Backtest.
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 used in Backtest.
Prevents 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 used in General.
Used to turn off look ahead bias prevention. Don't use unless you know exactly what you are doing!
frequency:dangerous


unit_cheat

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


initial_cash

A special number 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 used in Backtest.
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 used in Backtest.
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 used in Backtest.
When to reset stop gains for all stocks, if the stock has gone up. Used to update trailing stop gains.
frequency:occasional


rebalance_stop_losses

A special true/false used in Backtest.
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 used in Backtest.
Sets the weight of the given security. Ex spy_weight sets the weight of SPY. If no security exists, looks for a numeric var of that name, and uses it as a price series. So if 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 used in Simulator Backtest.
The account stops making any trades, and sells all stocks, if PortfolioValueTotal falls below this amount
frequency:rare


buy_price

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


cache_hint

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


cash_weight

A special number used in Backtest.
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 Backtest.
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 used in Backtest.
What dividends are given to share holders. Normally unset or 0 to simulate eaten dividends
frequency:rare


evaluate

A special true/false 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 used in Screener, Watchlist, Backtest.
Used in conjunction with order_by to limit holdings.
frequency:rare


mtm_price

A special number used in Backtest.
Calculation to define today's price for each stock, normally Close.
frequency:rare


num_montes

A special number used in Backtest.
How many montes to run
frequency:rare


num_tries

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


orders

A special number used in Simulator Backtest.
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 used in Backtest.
The weight to give each position. These are added up 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 offet the cash generated with cash_weight, or else the results are wrong
frequency:rare


rebalance_stop_losses_up

A special true/false used in Backtest.
When to reset stop losses for all stocks, if the stock has gone up. Used to update trailing stop losses.
frequency:rare


screener_honor_rebalance

A special true/false used in Screener, Watchlist.
Makes the screener behave like a watchlist and show results from the last rebalance date before the screen date supplied
frequency:rare


sell_price

A special number 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 used in Backtest.
Prevents rebuying of sold stocks until the time since sale is met. Any numeric expression is fine
frequency:rare


trading_cost

A special number used in Backtest.
provides a default modeling for slippage. Is overriden by buy_price and sell_price
frequency:rare


try_delay

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


try_goal

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


try_interval

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


universe

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


which_montes

A special number used in Backtest.
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 used in Backtest.
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 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 used in Backtest.
Only include still holding positions in the positions table
frequency:scaffolding


meta_ignore_cash

A special true/false used in Simulator Backtest.
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 used in General.
Prevents any part of the term from being cached. Slows everything down!!!
frequency:scaffolding


holding_cost

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


tabulate_details

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