fix: replace negligible 0.001 quantity with meaningful sizing guidance
The previous example quantity "0.001" represented <1% of the $10k initial balance for BTC and near-zero exposure for ETH/SOL, making P&L and Sharpe results statistically meaningless. - Update Quantity section with instrument-appropriate reference values (BTC: 0.01 ≈ $800, ETH: 3.0 ≈ $600, SOL: 50.0 ≈ $700) - Replace "0.001" with "0.01" in all four working examples - Explain that 5–10% of $10k initial balance is the sizing target - Explicitly warn against "0.001" as it produces negligible exposure Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -74,14 +74,22 @@ bars_since_entry — complete bars elapsed since position was opened
|
|||||||
balance — free balance of a named asset (e.g. "usdt", "usdc")
|
balance — free balance of a named asset (e.g. "usdt", "usdc")
|
||||||
|
|
||||||
### Quantity
|
### Quantity
|
||||||
Action quantity MUST be a fixed decimal string that parses as a floating-point number,
|
Action quantity MUST be a fixed decimal string that parses as a floating-point number.
|
||||||
e.g. `"quantity": "0.001"`.
|
|
||||||
NEVER use an expression object for quantity — only plain decimal strings are accepted.
|
NEVER use an expression object for quantity — only plain decimal strings are accepted.
|
||||||
NEVER use placeholder strings like `"ATR_SIZED"`, `"FULL_BALANCE"`, `"percent_of_balance"`,
|
NEVER use placeholder strings like `"ATR_SIZED"`, `"FULL_BALANCE"`, `"percent_of_balance"`,
|
||||||
`"dynamic"`, `"all"`, or any non-numeric string — these will be rejected immediately.
|
`"dynamic"`, `"all"`, or any non-numeric string — these will be rejected immediately.
|
||||||
To exit a position, use the SAME decimal string as the entry rule — the backtester matches
|
To exit a position, use the SAME decimal string as the entry rule — the backtester matches
|
||||||
open quantity automatically. There is no "close all" concept; just repeat the entry quantity.
|
open quantity automatically. There is no "close all" concept; just repeat the entry quantity.
|
||||||
|
|
||||||
|
Size your quantity to represent roughly 5–10% of the initial $10,000 USDC balance at
|
||||||
|
approximate current prices. Reference values (adjust if market prices differ significantly):
|
||||||
|
- BTC: `"0.01"` ≈ $800 (8% of $10k)
|
||||||
|
- ETH: `"3.0"` ≈ $600 (6% of $10k)
|
||||||
|
- SOL: `"50.0"` ≈ $700 (7% of $10k)
|
||||||
|
Since strategies run across all instruments with the same quantity string, choose a value
|
||||||
|
appropriate for the primary instrument you are designing for. Avoid `"0.001"` — it produces
|
||||||
|
negligible exposure and makes results statistically meaningless.
|
||||||
|
|
||||||
### Multi-timeframe
|
### Multi-timeframe
|
||||||
Any expression can reference a different timeframe via "timeframe" field.
|
Any expression can reference a different timeframe via "timeframe" field.
|
||||||
Use higher timeframes as trend filters, lower timeframes for entry precision.
|
Use higher timeframes as trend filters, lower timeframes for entry precision.
|
||||||
@@ -194,7 +202,7 @@ Common mistakes to NEVER make:
|
|||||||
{{"kind": "ema_trend", "period": 50, "direction": "above"}}
|
{{"kind": "ema_trend", "period": 50, "direction": "above"}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "buy", "quantity": "0.001"}}
|
"then": {{"side": "buy", "quantity": "0.01"}}
|
||||||
}},
|
}},
|
||||||
{{
|
{{
|
||||||
"comment": "Sell: EMA9 crosses below EMA21, OR 2% stop-loss, OR 72-bar time exit",
|
"comment": "Sell: EMA9 crosses below EMA21, OR 2% stop-loss, OR 72-bar time exit",
|
||||||
@@ -222,7 +230,7 @@ Common mistakes to NEVER make:
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "sell", "quantity": "0.001"}}
|
"then": {{"side": "sell", "quantity": "0.01"}}
|
||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
@@ -245,7 +253,7 @@ Common mistakes to NEVER make:
|
|||||||
{{"kind": "bollinger", "period": 20, "band": "below_lower"}}
|
{{"kind": "bollinger", "period": 20, "band": "below_lower"}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "buy", "quantity": "0.001"}}
|
"then": {{"side": "buy", "quantity": "0.01"}}
|
||||||
}},
|
}},
|
||||||
{{
|
{{
|
||||||
"comment": "Sell: RSI recovers above 55, OR 3% stop-loss, OR 48-bar time exit",
|
"comment": "Sell: RSI recovers above 55, OR 3% stop-loss, OR 48-bar time exit",
|
||||||
@@ -273,7 +281,7 @@ Common mistakes to NEVER make:
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "sell", "quantity": "0.001"}}
|
"then": {{"side": "sell", "quantity": "0.01"}}
|
||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
@@ -300,7 +308,7 @@ Common mistakes to NEVER make:
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "buy", "quantity": "0.001"}}
|
"then": {{"side": "buy", "quantity": "0.01"}}
|
||||||
}},
|
}},
|
||||||
{{
|
{{
|
||||||
"comment": "Sell: 2-ATR stop-loss below entry price, OR 48-bar time exit",
|
"comment": "Sell: 2-ATR stop-loss below entry price, OR 48-bar time exit",
|
||||||
@@ -335,7 +343,7 @@ Common mistakes to NEVER make:
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "sell", "quantity": "0.001"}}
|
"then": {{"side": "sell", "quantity": "0.01"}}
|
||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
@@ -375,7 +383,7 @@ The MACD line is `EMA(12) - EMA(26)`; the signal line is `EMA(9)` of the MACD li
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "buy", "quantity": "0.001"}}
|
"then": {{"side": "buy", "quantity": "0.01"}}
|
||||||
}},
|
}},
|
||||||
{{
|
{{
|
||||||
"comment": "Sell: MACD crosses below signal, OR 2% stop-loss, OR 72-bar time exit",
|
"comment": "Sell: MACD crosses below signal, OR 2% stop-loss, OR 72-bar time exit",
|
||||||
@@ -420,7 +428,7 @@ The MACD line is `EMA(12) - EMA(26)`; the signal line is `EMA(9)` of the MACD li
|
|||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}},
|
}},
|
||||||
"then": {{"side": "sell", "quantity": "0.001"}}
|
"then": {{"side": "sell", "quantity": "0.01"}}
|
||||||
}}
|
}}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
@@ -440,8 +448,8 @@ always compose it as `bin_op(sub, func(ema,12), func(ema,26))` as shown above.
|
|||||||
- Don't ignore fees — a strategy needs to overcome 0.1% per round trip
|
- Don't ignore fees — a strategy needs to overcome 0.1% per round trip
|
||||||
- Always gate buy rules with position state "flat" and sell rules with "long"
|
- Always gate buy rules with position state "flat" and sell rules with "long"
|
||||||
- Never add a short-entry (sell when flat) rule — spot markets are long-only
|
- Never add a short-entry (sell when flat) rule — spot markets are long-only
|
||||||
- Never use an expression object for `quantity` — it must always be a plain decimal string like `"0.001"`
|
- Never use an expression object for `quantity` — it must always be a plain decimal string like `"0.01"`
|
||||||
- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected. Use `"0.001"` or similar.
|
- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected. Use `"0.01"` or similar.
|
||||||
"##
|
"##
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user