Strategy file: priceactionpro.js Market: spot
Description
Discretionary-style price-action peer strategy. HTF market structure, order blocks, FVGs, swing-failure detection, anchored VWAP, and session gating. Spot/futures signal generator (not market-making).
How it works
Smart-money concepts (SMC) formalise the price-action heuristics used by institutional desks: a Break of Structure (BOS) confirms continuation of the prior trend by taking out the most recent swing point in its direction; a Market Structure Break (MSB) signals reversal; a Point of Interest (POI) is a price zone (order block or breaker block) where institutions previously transacted heavily; a Fair Value Gap (FVG) is a three-candle imbalance where the wick of candle 1 doesn't overlap the wick of candle 3, marking inefficient price delivery that often gets revisited. The strategy detects these structures on the configured timeframe and enters on retests of POIs/FVGs in the direction of the most recent BOS. There is limited peer-reviewed literature; the references include the foundational technical-analysis works and academic studies that validate the predictive value of structure-based entries.
Allocation
How much of THIS pair’s wallet the strategy may use, what it must start with, and the hard config gate. Trading is BLOCKED until Wallet allocation % is set AND Allocation confirmed is ON. Optional grid splits an order into laddered post-only rungs for better fills.
| Key | Type | Default | Description |
|---|---|---|---|
ALLOC_PCT |
range (range 1..100) | 25 |
Percentage of THIS pair’s wallet balance the strategy may deploy. Effective cap = min(wallet × this %, the absolute Capital allocation). Every order is clamped to it and can never exceed it. REQUIRED — trading is blocked until this is set (>0) and Allocation confirmed is ON. |
ALLOC_CONFIRMED |
boolean | False |
Explicit acknowledgement that the allocation above is correct for this pair. The strategy will NOT place any entry order until this is ON. A clear "ALLOCATION CONFIGURED" line is logged once it is; otherwise an "ALLOCATION NOT CONFIGURED — refusing to trade" line is logged each cycle. |
ALLOC_SPLIT_TOL |
range (range 0..100) | 15 |
How far the starting base/quote split may deviate from what this strategy needs before it refuses to start. Long-only strategies want mostly quote/cash; two-sided market-makers want ~50/50 base/quote; futures want free margin. Mismatch beyond this % blocks trading (unless Enforce start inventory is OFF). |
ALLOC_ENFORCE_SPLIT |
boolean | True |
When ON, the strategy refuses to trade until the starting base/quote split is within tolerance of what it needs (archetype-aware). When OFF, a mismatch is logged as a warning but trading proceeds. |
ALLOC_AUTO_REBALANCE |
boolean | True |
Two-sided market-makers only. ON by default: if the pair starts off the target base/quote split, the strategy places a single bounded market order on start to reach it (e.g. buys ~half the allocation into base for a 50/50 maker), then begins normal trading. Set to OFF to instead stay blocked and log the exact amount to buy/sell manually. Long-only and futures strategies ignore this. |
ALLOC_RESERVE_PCT |
range (range 0..50) | 0 |
A buffer, as % of wallet, kept BELOW the allocation cap and never deployed. Use to leave headroom for fees/slippage. Effective cap = min(wallet × allocation %, absolute cap) − wallet × this %. |
PAP_GRID |
boolean | False |
When ON, an entry order is split into several laddered post-only rungs across a price band instead of one order — often gets better average fills. Cumulative size is still clamped to the allocation. OFF = single order. |
PAP_GRID_LEVELS |
range (range 2..10) | 3 |
Number of laddered rungs to split an entry into when "Split entries into a grid" is ON. More rungs = finer fills but more orders. |
PAP_GRID_SPAN_PCT |
range (range 0.1..5) | 0.5 |
Price band width, as % from the reference price, across which the grid rungs are spread. e.g. 0.5 places rungs from the reference price down to 0.5% below it (for buys). |
Higher Timeframe Structure
The HTF defines bias, range extremes, and the levels used by every downstream module.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_HTF_PERIOD |
select | 720 |
Higher timeframe used for market structure. Must be a whole-number multiple of your chart PERIOD (LTF). Values in minutes: 60=1h, 240=4h, 720=12h, 1440=1d, 2880=2d, 4320=3d, 10080=1w. |
PAP_BREAK_TYPE |
select | MSB |
Conservative (MSB) waits for body close beyond pivot. Aggressive modes use closest opposite pivots — more signals, less filtering. |
PAP_EQUAL_HL_PIVOTS |
boolean | True |
Detects double tops/bottoms by counting up to 3 consecutive equal highs/lows as a single pivot. |
PAP_SHOW_EQ_LINE |
boolean | True |
Renders a dashed line at the midpoint of the HTF range. Above EQ = Premium (short bias). Below = Discount (long bias). |
PAP_HIDE_HISTORICAL |
boolean | False |
On: only show the currently active range. Off: show all historical structure breaks (backtest mode). |
Points of Interest (POIs)
Order Blocks, Breakers, Fair Value Gaps, and Internal Pivots — the levels where trades are sourced.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_POI1_MODE |
select | OB_FVG |
OB Only = all valid order blocks. OB+FVG = only OBs with overlapping Fair Value Gap (higher confluence). |
PAP_POI2_MODE |
select | BREAKER_FVG |
Breaker = failed order block that flipped polarity. Breaker+FVG is the highest-probability setup in the system. |
PAP_POI3_ENABLED |
boolean | True |
Show Fair Value Gaps not already covered by an OB+FVG or Breaker+FVG combo. |
PAP_POI4_ENABLED |
boolean | True |
Mark untested significant H/L pivots within the active range. These are liquidity targets price tends to gravitate toward. |
PAP_EXTEND_POIS |
boolean | True |
Untested POI zones extend to the right of the chart until price tests them. |
PAP_HTF_CLOSE_INVALIDATION |
boolean | True |
Strict mode: a POI is invalidated only when an HTF candle BODY closes completely through it. Wicks never invalidate. |
PAP_MAX_ACTIVE_POIS |
range (range 10..200) | 50 |
Cap on how many Points of Interest stay active. When the count exceeds this, only the most recent N (by formation bar) are kept. Stops POI count from growing unbounded when invalidation rules are loose (e.g. HTF_CLOSE_INVALIDATION off). Set 0 for unlimited. |
Setup Detection
Which of the 4 setup types to scan. Each is independently togglable.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_SETUP_TYPES |
string | RANGE_EXTREME,INTERNAL_LIQ,EARLY_WARNING_MSB,EARLY_WARNING_FVG,FRACTAL_LTF |
RANGE_EXTREME = SFPs at range edges (highest probability). EARLY_WARNING = pre-close signals (faster, higher risk). FRACTAL_LTF = LTF setups inside HTF POIs. — Enter as comma-separated values. Allowed: RANGE_EXTREME, INTERNAL_LIQ, EARLY_WARNING_MSB, EARLY_WARNING_FVG, FRACTAL_LTF. |
PAP_LIQUIDITY_MODE |
select | AT_POIS |
AT_POIS = only setups inside a confirmed POI (A+ quality). ALL = any pivot. ALL_WITH_STRUCTURE = any pivot but only trend-aligned. |
PAP_REQUIRE_SFP |
boolean | True |
On: only fire on liquidity sweeps (wick beyond level + close back inside). Off: breakout / trend-continuation mode (more signals, lower win rate). |
Entry Engine
What confirms a signal on the LTF, and where the resulting order is placed.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_LTF_BREAK_TYPE |
select | MSB |
What price action confirms the signal. MSB is most conservative. Breaker types fire fastest but with less filtering. |
PAP_ENTRY_MODE |
select | MSB_LEVEL |
Where the order is placed. MSB Level = highest fill rate, lowest R:R. Order Block = lowest fill rate, highest R:R. |
PAP_REQUIRE_FVG |
boolean | False |
On: signal must contain an LTF FVG in the impulse leg. Filters out non-displacement moves. |
PAP_LTF_PERIOD |
range (range 1..60) | 15 |
Lower timeframe in minutes. Must equal your Gunbot strategy PERIOD setting exactly. |
BE_GUARD_BLOCK_MARKET_SELLS |
boolean | True |
Default ON (legacy). Set OFF to enable SOFT BE_GUARD: market sells and closeMarket pass through (treated as urgent / stop-loss). Only limit sells below break-even remain blocked. Prevents BE_GUARD from silently swallowing stop-loss exits. |
SCRATCH_LIVENESS_MIN |
range (range 0..120) | 0 |
When >0: if the pair holds inventory and hasn't filled in N minutes AND the bid is at break-even+1bp, force a market exit to rotate capital. 0 = disabled. Typical: 30. |
CONSEC_RESET_CYCLES |
range (range 60..2880) | 480 |
After this many cycles without any order activity, auto-reset consecutiveLosses to 0. Default 480 cycles ≈ 2h at 15s/cycle. Prevents a 3-loss streak from killing the pair for the entire session. |
DRIFT_ATR_FRAC |
range (range 0..0.5) | 0 |
When >0: scale drift-requote threshold to this fraction of the recent 10-candle high-low range (clamped 2-100 bps). 0 = use fixed *_STALE_DRIFT_BPS. Typical: 0.05 = 5% of recent range. Adapts drift detection to per-pair volatility. |
SKEW_QTY_MAX |
range (range 1..5) | 2.5 |
Maximum ask:bid qty ratio when inventory is heavily skewed. 2.5 means a heavily-bagged pair quotes up to 2.5x ask qty vs bid qty to drain inventory faster. Set 1.0 to disable (symmetric quoting). |
SKEW_QTY_TARGET |
range (range 0.1..0.9) | 0.5 |
Target inventory fraction of pair equity. 0.5 = 50/50 balanced base/quote. Skew kicks in proportionally as actual exposure deviates from target. |
PORTFOLIO_INCLUDE |
boolean | True |
When ON (default), this pair participates in the shared PORTFOLIO_EXP_BUDGET — its exposure counts toward portfolio total and bids pause when budget is exceeded. When OFF, the pair stands alone (use PAIR_EXP_BUDGET for own cap). |
PORTFOLIO_EXP_BUDGET |
range (range 0..1) | 0 |
Cap on total portfolio inventory as fraction of total allocated equity (sum across PORTFOLIO_INCLUDE pairs). 0 = disabled. Typical: 0.6 = 60% inventory cap across the included portfolio. When exceeded, bids pause but exits remain active. |
PAIR_EXP_BUDGET |
range (range 0..1) | 0 |
This pair's own exposure cap as fraction of pair equity (inventory / pair allocated capital). Applies independently of portfolio budget. 0 = disabled. Typical: 0.2 = 20% per-pair cap. |
DISABLE_BREAKER_WINDDOWN |
boolean | False |
When OFF (default), an active breaker (3 consecutive losses or daily loss limit) actively frees capital: cancels open orders and scratch-sells inventory IF profitable (bid >= BE+1bp). When ON, legacy halt-and-hold behaviour. |
TRACE_ALL |
boolean | False |
Master switch for the Quantroduction tracer. When ON, writes detailed per-cycle JSONL to gunbot_logs/quantroduction/ AND emits a verbose console summary. Equivalent to setting every |
Signal Filters
Quality gates applied to every candidate signal before an order is placed.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_MAX_TRADE_RISK_PCT |
range (range 0.1..5) | 1 |
Reject signals where |entry − stop| / entry > this %. Prevents oversized risk on wide setups. 0 = disabled. |
PAP_PREMIUM_DISCOUNT_PCT |
range (range 10..90) | 38.2 |
Longs only fire in bottom N% of range, shorts only in top N%. 0 = disabled. 38.2 = OTE zone. 50 = EQ filter. 25 = strict. |
PAP_MAX_OPEN_LONGS |
range (range 0..5) | 1 |
Cap on simultaneous long positions across all signal sources. |
PAP_MAX_OPEN_SHORTS |
range (range 0..5) | 1 |
Cap on simultaneous short positions across all signal sources. |
Exit Engine
How positions are closed: partial take-profits, opposite signals, POI targets, stop loss. Fixed % TP1/TP2/SL mode available below — toggle "useFixedExitsOnly" to bypass everything else.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_EXIT_ON_OPPOSITE_MODE |
select | VALID |
ANY = exit on any opposite-direction signal (most responsive). VALID = only on filtered/valid opposite signals (more selective). |
PAP_EXIT_AT_POI_MODE |
select | CLOSEST_POI |
RANGE_EXTREMES = take profit at opposite range edge. CLOSEST_POI = nearest untested HTF POI (dynamic). |
PAP_BREAK_EVEN_GUARD_ENABLED |
boolean | False |
When ON: blocks ALL non-SL exits (opposite signal, POI target, partial, session auto-close) when current price is BELOW break-even (entry ± round-trip fees ± buffer ticks). Stop loss is NEVER blocked. Useful for traders who want certainty that any closed (non-SL) trade is cash-positive. Trade-off: positions may stay open longer through reversals, tying up capital. |
PAP_BREAK_EVEN_BUFFER_TICKS |
range (range 0..50) | 0 |
Extra ticks above break-even required before the guard releases. 0 = exact BE (entry + fees). Higher values demand a profit cushion before allowing exits. Example: 5 ticks at 0.1 tick size = $0.50 minimum profit per unit before exits are allowed. |
PAP_FIXED_TP_ABOVE_BE_PCT |
range (range 0..20) | 0 |
Take profit at this % above break-even price (NOT entry price). 0 = disabled. Example: 1.5 closes the position when current price reaches BE × 1.015 for a long (or BE × 0.985 for a short). Fires BEFORE partials so it can serve as the final exit. By definition above BE, so safe relative to the BE guard. |
PAP_FIXED_SL_BELOW_BE_PCT |
range (range 0..20) | 0 |
Stop loss at this % below break-even price (NOT entry price). 0 = disabled. Example: 1.0 closes the position when current price drops to BE × 0.99 for a long (or rises to BE × 1.01 for a short). Hard stop — NOT blocked by the BE guard. Useful for active strategies that want a tighter stop than the SFP-wick-based default. |
PAP_USE_FIXED_EXITS_ONLY |
boolean | False |
When ON, the strategy uses ONLY the fixed % TP1, TP2 and SL below. All other exits (partials at R-multiples, opposite-signal exits, POI target exits, session auto-close) are bypassed. Stop loss is always honoured. Use this when you want pure percentage-based exits with no signal-based exits. |
PAP_FIXED_TP1_PCT |
range (range 0..20) | 0 |
Take-profit level 1 as a percentage above break-even price (entry + fees). 0 = disabled. Example: 1.5 = close TP1_SIZE_PCT of the position when price reaches BE × 1.015 for a long. |
PAP_FIXED_TP1_SIZE_PCT |
range (range 0..100) | 50 |
Percentage of the ORIGINAL position size to close when TP1 fires. Example: 50 closes half the position at TP1, leaving the other half to run to TP2 or SL. |
PAP_FIXED_TP2_PCT |
range (range 0..20) | 0 |
Take-profit level 2 as a percentage above break-even (above TP1). 0 = disabled. Example: 3.0 with TP1 at 1.5 means: close TP1 size at +1.5%, then close TP2 size at +3.0%. |
PAP_FIXED_TP2_SIZE_PCT |
range (range 0..100) | 100 |
Percentage of the REMAINING position size to close when TP2 fires. Default 100 fully exits the position at TP2. Lower values leave a runner. |
Stop Loss Management
Stop Loss Management
| Key | Type | Default | Description |
|---|---|---|---|
PAP_SL_TICKS |
range (range 0..50) | 2 |
Number of price ticks beyond the SFP wick. Provides buffer above/below liquidity sweep. |
PAP_USE_BREAK_FOR_SL |
boolean | False |
On: stop placed at LTF breaker extreme (tighter stop, higher R:R). Off: stop at SFP wick (safer). |
PAP_MOVE_SL_TO_ENTRY_AT_R |
range (range 0..5) | 1 |
Once price moves this many R in your favour, SL auto-moves to entry. 0 = disabled. |
Position Sizing & Risk
Fee-aware sizing — realised risk never exceeds your maximum because maker/taker fees are pre-deducted.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_CAPITAL |
range (range 100..100000) | 10000 |
Used only if Gunbot wallet balance is unavailable. Set to your real account size. |
PAP_RISK_TYPE |
select | PCT |
|
PAP_MAX_RISK_PER_TRADE |
range (range 0.1..5) | 1 |
PCT mode: percent of capital risked. FIXED mode: dollar amount. Industry standard: 1% PCT. |
PAP_MAKER_FEE_PCT |
range (range 0..0.5) | 0.02 |
Used for LIMIT order entries. Check your exchange's fee schedule. |
PAP_TAKER_FEE_PCT |
range (range 0..0.5) | 0.05 |
Used for MARKET orders and stop-loss exits. |
PAP_MAX_LEVERAGE |
range (range 1..20) | 1 |
1 = spot trading. >1 = futures leverage. Position size scales with leverage, true risk stays at MaxRisk. |
PAP_USE_TAKER_FOR_ALL_EXITS |
boolean | True |
Conservative: sizes assuming every exit pays the taker rate. Slightly smaller positions, zero risk overshoot. |
PAP_USE_PORTFOLIO_VALUE |
boolean | False |
On: risk % based on (cash + open position value). Off: risk % based on free cash only. |
PAP_MARKET_TYPE |
select | AUTO |
AUTO: detect from Gunbot exchange config (recommended). SPOT: force spot mode — SHORT entries blocked, leverage ignored. FUTURES: force futures mode — shorts allowed, leverage applied. In SPOT mode, SHORT signals still GENERATE (so they can close open longs via the opposite-signal exit) but new short positions are blocked. |
Trading Sessions
Restrict trading to specific days and intraday windows.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_TRADE_DAYS |
string | 2,3,4,5,6 |
Days of the week when signals are allowed. 1=Sun, 2=Mon, ..., 7=Sat. — Enter as comma-separated values. Allowed: 1, 2, 3, 4, 5, 6, 7. |
PAP_SESSION_TIMEZONE |
select | America/New_York |
|
PAP_AUTO_CLOSE_AT_SESSION_END |
boolean | False |
On: all open positions close automatically at session end. Prevents overnight exposure. |
Pre-Entry Invalidation Rules
Conditions that cancel pending (unfilled) limit orders if the market context changes.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_INVALIDATE_ON_OPP_SFP |
boolean | True |
Pending long cancelled if a bearish HTF SFP prints (and vice versa). |
PAP_INVALIDATE_ON_OPP_SETUP |
boolean | True |
Pending order cancelled if a fully-valid opposite-direction signal fires. |
PAP_INVALIDATE_ON_HTF_MSB |
boolean | True |
Pending long cancelled if HTF structure breaks bearishly (and vice versa). |
PAP_INVALIDATE_ON_PIVOT_OUTSIDE_MS |
boolean | True |
If the originating signal pivot falls outside the now-current HTF range, cancel. |
Anchored VWAP Filter
Brian-Shannon-style anchored VWAP × 4 levels × 2 periods. Used as a directional bias filter.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_VWAP_ENABLED |
boolean | True |
Master switch. Off = VWAP not computed at all. |
PAP_VWAP_FILTER_MODE |
select | FILTER |
FILTER: signals must align with VWAP bias (longs only when bull, shorts only when bear). OFF: VWAP computed but not used to filter. |
PAP_VWAP_SHORT_PERIOD_MINS |
select | 1440 |
|
PAP_VWAP_LONG_PERIOD_MINS |
select | 10080 |
Logging
Logging
| Key | Type | Default | Description |
|---|---|---|---|
PAP_LOG_LEVEL |
select | INFO |
DEBUG = everything (verbose). INFO = normal. WARN = problems only. ERROR = failures only. |
PAP_LOG_TO_FILE |
boolean | True |
When on, writes a log file per pair per day under the logs directory. Errors also go to a separate -errors.log file for easy review. |
PAP_LOG_DIR |
string | logs |
Relative to Gunbot working dir, or absolute path. Created automatically if missing. |
PAP_LOG_ROTATE_DAILY |
boolean | True |
On: one log file per day per pair. Off: single rolling file per pair. |
PAP_LOG_COLOR |
boolean | True |
ANSI colour codes in console output for readability. Auto-disabled when stdout is not a TTY (e.g. piped to file). Turn off if your terminal shows raw escape codes. |
PAP_SHOW_STARTUP_BANNER |
boolean | True |
On first cycle, print a config summary banner so the operator can verify the strategy is loaded with the expected settings (pair, market type, timeframes, risk, etc.). |
PAP_VALIDATE_CONFIG |
boolean | True |
Runs the ConfigValidator on first cycle. Catches common misconfigurations (HTF/LTF mismatch, bad risk values, empty session windows, etc.) and emits each issue with an actionable HINT. Highly recommended. |
PAP_ERROR_REPORTING_ENABLED |
boolean | False |
When ON, automatically writes a sanitised diagnostic bundle (config + recent logs + state snapshot, API keys redacted) to the error-report dir whenever a CRITICAL error fires. The file is safe to share with support. |
PAP_ERROR_REPORT_DIR |
string | logs/reports |
Where auto-generated diagnostic bundles get written. Files named pap-error- |
VERBOSE_LOGS |
boolean | False |
When ON, the full Quantroduction × Gunbot dashboard (every config value + state snapshot) re-emits every VERBOSE_INTERVAL_MIN minutes for forensic audit. When OFF (default), the dashboard only fires once per Gunbot restart per pair. |
VERBOSE_INTERVAL_MIN |
range (range 5..240) | 30 |
How often the dashboard re-emits when VERBOSE_LOGS is ON. Lower = more frequent / noisier; higher = quieter. Has no effect when VERBOSE_LOGS is OFF. |
BE_GUARD_BLOCK_MARKET_SELLS |
boolean | True |
Default ON (legacy). Set OFF to enable SOFT BE_GUARD: market sells and closeMarket pass through (treated as urgent / stop-loss). Only limit sells below break-even remain blocked. Prevents BE_GUARD from silently swallowing stop-loss exits. |
SCRATCH_LIVENESS_MIN |
range (range 0..120) | 0 |
When >0: if the pair holds inventory and hasn't filled in N minutes AND the bid is at break-even+1bp, force a market exit to rotate capital. 0 = disabled. Typical: 30. |
CONSEC_RESET_CYCLES |
range (range 60..2880) | 480 |
After this many cycles without any order activity, auto-reset consecutiveLosses to 0. Default 480 cycles ≈ 2h at 15s/cycle. Prevents a 3-loss streak from killing the pair for the entire session. |
DRIFT_ATR_FRAC |
range (range 0..0.5) | 0 |
When >0: scale drift-requote threshold to this fraction of the recent 10-candle high-low range (clamped 2-100 bps). 0 = use fixed *_STALE_DRIFT_BPS. Typical: 0.05 = 5% of recent range. Adapts drift detection to per-pair volatility. |
SKEW_QTY_MAX |
range (range 1..5) | 2.5 |
Maximum ask:bid qty ratio when inventory is heavily skewed. 2.5 means a heavily-bagged pair quotes up to 2.5x ask qty vs bid qty to drain inventory faster. Set 1.0 to disable (symmetric quoting). |
SKEW_QTY_TARGET |
range (range 0.1..0.9) | 0.5 |
Target inventory fraction of pair equity. 0.5 = 50/50 balanced base/quote. Skew kicks in proportionally as actual exposure deviates from target. |
PORTFOLIO_INCLUDE |
boolean | True |
When ON (default), this pair participates in the shared PORTFOLIO_EXP_BUDGET — its exposure counts toward portfolio total and bids pause when budget is exceeded. When OFF, the pair stands alone (use PAIR_EXP_BUDGET for own cap). |
PORTFOLIO_EXP_BUDGET |
range (range 0..1) | 0 |
Cap on total portfolio inventory as fraction of total allocated equity (sum across PORTFOLIO_INCLUDE pairs). 0 = disabled. Typical: 0.6 = 60% inventory cap across the included portfolio. When exceeded, bids pause but exits remain active. |
PAIR_EXP_BUDGET |
range (range 0..1) | 0 |
This pair's own exposure cap as fraction of pair equity (inventory / pair allocated capital). Applies independently of portfolio budget. 0 = disabled. Typical: 0.2 = 20% per-pair cap. |
DISABLE_BREAKER_WINDDOWN |
boolean | False |
When OFF (default), an active breaker (3 consecutive losses or daily loss limit) actively frees capital: cancels open orders and scratch-sells inventory IF profitable (bid >= BE+1bp). When ON, legacy halt-and-hold behaviour. |
TRACE_ALL |
boolean | False |
Master switch for the Quantroduction tracer. When ON, writes detailed per-cycle JSONL to gunbot_logs/quantroduction/ AND emits a verbose console summary. Equivalent to setting every |
Infrastructure
Advanced settings — usually don't need adjustment.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_HTF_CANDLE_HISTORY |
range (range 100..500) | 200 |
How many HTF candles to request per cycle. More = better structure detection but slower. |
PAP_LTF_MIN_CANDLES |
range (range 20..200) | 50 |
Strategy waits for at least this many LTF candles before activating. |
PAP_TICK_SIZE |
range (range 0..1) | 0 |
0 = auto-derive from gb.data.pricePrecision. Set manually if your exchange doesn't expose precision. |
Safety & Tuning (v1.0-beta)
Per-pair safety, breaker resets, and tracing controls. Boolean knobs default false unless noted; ONE-SHOT knobs auto-clear after firing.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_FORCE_EXIT_IF_PROFIT |
toggle | False |
When true, the strategy ignores its normal POI/TP exits and dumps the entire held bag at market the first time bid crosses break-even + PAP_FORCE_EXIT_BUFFER_BPS. Use to free up capital tied in a winning trade you want closed now. |
PAP_FORCE_EXIT_BUFFER_BPS |
number | 10 |
10 = 0.10% above break-even. Force-exit fires only when bid > breakEven * (1 + bps/10000). Lower = tighter exits (closer to BE), higher = wait for more profit. Default 10 (= 0.10%). |
PAP Sizing & Indicator Filters
Optional indicator-based entry filters and position sizing controls.
| Key | Type | Default | Description |
|---|---|---|---|
PAP_USE_FIXED_NOTIONAL |
toggle | False |
When true, every entry is sized at exactly PAP_FIXED_NOTIONAL_USD regardless of stop distance. When false, PAP uses risk-based sizing (PAP_MAX_TRADE_RISK_PCT × capital / stop distance). |
PAP_FIXED_NOTIONAL_USD |
number | 100 |
When PAP_USE_FIXED_NOTIONAL is true, every PAP entry buys exactly this dollar amount. Ignored otherwise. |
PAP_MAX_POSITION_NOTIONAL_PCT |
number | 25 |
Safety cap. Even if risk math says size = 50% of capital, position size is capped at this percent. Default 25 (= 25% of pair capital). |
PAP_INDICATOR_BB_ENABLED |
toggle | False |
When true, PAP entry requires close to be below a percent of the lower Bollinger band, i.e. only enters on dips. Disabled by default. |
PAP_INDICATOR_BB_PERIOD |
number | 20 |
Lookback window for Bollinger Bands. Standard = 20. |
PAP_INDICATOR_BB_STD_DEV |
number | 2 |
Width of the BB envelope in standard deviations. Standard = 2. |
PAP_INDICATOR_BB_MAX_PCT_BUY |
number | 30 |
Only allow entry when price is in the lower N% of the BB envelope. 30 = entry only in the bottom 30% (= dip-buying). Higher = looser filter. |
PAP_INDICATOR_FIB_ENABLED |
toggle | False |
When true, PAP entry requires the price to be at or beyond a specified Fibonacci retracement of the lookback range. Disabled by default. |
PAP_INDICATOR_FIB_LOOKBACK |
number | 50 |
How many candles back to find swing high/low for the Fib retracement. |
PAP_INDICATOR_FIB_MIN_BUY |
number | 0.382 |
Only enter when price has retraced at least this fraction of the swing. 0.382 = 38.2% Fib. Common values: 0.236, 0.382, 0.500, 0.618, 0.786. |
PAP_INDICATOR_RSI_ENABLED |
toggle | False |
When true, entry requires RSI below PAP_INDICATOR_RSI_MAX_BUY. Used to avoid buying in overbought conditions. |
PAP_INDICATOR_RSI_PERIOD |
number | 14 |
Standard RSI period = 14. |
PAP_INDICATOR_RSI_MAX_BUY |
number | 70 |
Block entry if RSI is above this. 70 = block above 70 (overbought), 50 = only buy in lower half. |
PAP_INDICATOR_STOCH_RSI_ENABLED |
toggle | False |
When true, entry requires StochRSI below PAP_INDICATOR_STOCH_RSI_MAX_BUY. Sharper than RSI for catching oversold pivots. |
PAP_INDICATOR_STOCH_RSI_PERIOD |
number | 14 |
Standard StochRSI period = 14. |
PAP_INDICATOR_STOCH_RSI_MAX_BUY |
number | 0.8 |
Block entry if StochRSI is above this. 0.8 = block above 80%. Typical oversold trigger = 0.2. |
Portfolio & Runtime (per-pair overrides)
Per-pair runtime knobs. Override any of these on a single pair without changing the strategy defaults.
| Key | Type | Default | Description |
|---|---|---|---|
NO_CLOSE_MARKET |
boolean | False |
On exchanges that don't expose closeMarket reliably, set this to true to force the compat wrapper to route every close through sellMarket / buyMarket instead. |
NO_POST_ONLY |
boolean | False |
On exchanges that reject post-only orders (e.g. some DEX flavours), force the compat wrapper to fall back to plain limit orders. Increases taker risk; only enable if your exchange genuinely cannot process post-only. |
BE_GUARD |
boolean | False |
When ON, the wrapper refuses any sell priced BELOW the position's break-even. Protects against accidental loss-locking. Stop-losses are still honoured unless you also enable the next knob. |
RESET_BREAKER_ONCE |
boolean | False |
Set to true once to clear any tripped circuit breaker (consecutive-loss / daily-loss). The strategy auto-clears this flag after the reset fires so you don't have to remove it. |
RESET_STATS_ONCE |
boolean | False |
Set to true once to zero out wins, losses, consecutive losses, peak equity, max drawdown, trade count, and daily-loss lock. Total PnL is preserved. The flag auto-clears after the reset fires. |
LOG_LEVEL |
select | NORMAL |
Controls how verbose the strategy's logs are. QUIET only logs errors and trade events. NORMAL adds breaker / state changes. VERBOSE adds per-cycle gate decisions (useful for tuning). |
MIN_ORDER_QUOTE |
range (range 1..50) | 5 |
Minimum notional that the exchange will accept for an order, in quote currency. Set higher than the exchange's true minimum to leave buffer for slippage on validation. |
QUANTRODUCTION_TRACE |
boolean | False |
Master switch for the diagnostic tracer. When on, every gate decision and breaker event is recorded so you can see exactly why the strategy did or did not act this cycle. |
WARMUP_CYCLES |
range (range 0..50) | 5 |
How many cycles the strategy waits at startup before placing any orders. Lets indicators warm up and the strategy compute a baseline before reacting. |
SPREAD_PNL_JUMP_GUARD |
range (range 0.1..1) | 0.5 |
Realized-PnL deltas larger than this fraction of pair equity are treated as deposits/withdrawals/data-glitches and skipped. Default 0.5 means a single delta over 50% of equity is ignored. Lower for tighter glitch detection on small accounts. |
References & further reading
- Murphy, J. J. (1999). Technical Analysis of the Financial Markets. New York Institute of Finance.
- Lo, A. W., Mamaysky, H. & Wang, J. (2000). Foundations of technical analysis: computational algorithms, statistical inference, and empirical implementation. Journal of Finance 55(4), 1705–1765.
- Park, C.-H. & Irwin, S. H. (2007). What do we know about the profitability of technical analysis? Journal of Economic Surveys 21(4), 786–826.
Configuration playbook
- Full Tier 1-3 stack: see
OPERATOR_GUIDE.mdquick-start - Standalone pair (not in portfolio):
"PORTFOLIO_INCLUDE": false, "PAIR_EXP_BUDGET": 0.20 - Clear stuck breaker:
"RESET_BREAKER_ONCE": true - Clear historical loss counters:
"RESET_STATS_ONCE": true(preserves total PnL) - Enable JSONL tracer:
"TRACE_ALL": true - Soft BE_GUARD:
"BE_GUARD": true, "BE_GUARD_BLOCK_MARKET_SELLS": false