<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AlgoRover Quant]]></title><description><![CDATA[AlgoRover Quant]]></description><link>https://algorover.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Tue, 24 Nov 2026 13:07:17 GMT</lastBuildDate><atom:link href="https://algorover.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Why `value or None` turns a JSON zero into `None`]]></title><description><![CDATA[In Python 3.12.16, value or None returned None for the integer 0 in the position.values array [0] from the EP-0080 paper-trading export. A report that…]]></description><link>https://algorover.hashnode.dev/why-value-or-none-turns-a-json-zero-into-none</link><guid isPermaLink="true">https://algorover.hashnode.dev/why-value-or-none-turns-a-json-zero-into-none</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 24 Nov 2026 10:52:43 GMT</pubDate><content:encoded><![CDATA[<p>In Python 3.12.16, <code>value or None</code> returned <code>None</code> for the integer <code>0</code> in the <code>position.values</code> array <code>[0]</code> from the EP-0080 paper-trading export. A report that treats <code>None</code> as missing data would display the recorded zero position as missing. <a href="https://chatgpt.com/s/cx_6afb219998808191a8f27dadb5360672">EP-0080 paper-trading record</a></p>
<p>This example uses the array from <code>assets/trade-reviews/EP-0080/case.json</code> and runs both expressions from the recorded test.</p>
<pre><code class="language-python">import json
value = json.loads('[0]')[0]
print(value or None)
print(None if value is None else value)
</code></pre>
<p>The recorded run printed the following output.</p>
<pre><code class="language-text">None
0
</code></pre>
<p>Python treats integer zero as false in a Boolean context, so <code>value or None</code> returns its right operand, <code>None</code>. The identity test <code>value is None</code> is false for <code>0</code>, so the conditional expression returns <code>0</code>. If you only need to pass the field through, use <code>value</code> directly. Use <code>value is None</code> when a branch should run only for <code>None</code>.</p>
<p>The example reads the array’s first element before evaluating either expression. The recorded test covered an existing array whose first element was an integer zero. Missing fields, empty arrays, and an explicit JSON <code>null</code> were outside the test.</p>
]]></content:encoded></item><item><title><![CDATA[Why a Python dict keeps one key for two 1:30 a.m. timestamps]]></title><description><![CDATA[On Python 3.12.16, a dictionary keyed by the two occurrences of 1:30 a.m. in Los Angeles on November 3, 2024, held one entry. Converting both keys to UTC…]]></description><link>https://algorover.hashnode.dev/why-a-python-dict-keeps-one-key-for-two-1-30-a-m-timestamps</link><guid isPermaLink="true">https://algorover.hashnode.dev/why-a-python-dict-keeps-one-key-for-two-1-30-a-m-timestamps</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 24 Nov 2026 05:02:18 GMT</pubDate><content:encoded><![CDATA[<p>On Python 3.12.16, a dictionary keyed by the two occurrences of 1:30 a.m. in Los Angeles on November 3, 2024, held one entry. Converting both keys to UTC before insertion yielded two entries.</p>
<p>```python</p>
<p>from datetime import datetime, timezone</p>
<p>from zoneinfo import ZoneInfo</p>
<p>la = ZoneInfo('America/Los_Angeles')</p>
<p>a = datetime(2024, 11, 3, 1, 30, tzinfo=la, fold=0)</p>
<p>b = a.replace(fold=1)</p>
<p>print(len({a: 'first', b: 'second'}))</p>
<p>utc_a = a.astimezone(timezone.utc)</p>
<p>utc_b = b.astimezone(timezone.utc)</p>
<p>print(utc_a.isoformat())</p>
<p>print(utc_b.isoformat())</p>
<p>print(len({utc_a: 'first', utc_b: 'second'}))</p>
<p>```</p>
<p>```text</p>
<p>1</p>
<p>2024-11-03T08:30:00+00:00</p>
<p>2024-11-03T09:30:00+00:00</p>
<p>2</p>
<p>```</p>
<p>`fold=0` selects the first occurrence of the repeated local time, and `fold=1` selects the second. When two aware `datetime` objects share the same `tzinfo` instance, Python ignores `fold` for equality and compares their local date and time fields. Those fields match here, so inserting `b` replaces the value stored under `a`. [Python datetime documentation](<a href="https://docs.python.org/3/library/datetime.html#datetime-objects">https://docs.python.org/3/library/datetime.html#datetime-objects</a>)</p>
<p>When dictionary keys identify instants, convert them with `astimezone(timezone.utc)` before insertion so that repeated local times at different instants compare unequal.</p>
]]></content:encoded></item><item><title><![CDATA[Why Python datetime subtraction returned −10.14 seconds for events nearly an hour apart]]></title><description><![CDATA[This example was tested with Python 3.12.16 using two timestamps from the USGS earthquake catalog. Events `hv74520982` and `av93342608` occurred 3,589.86…]]></description><link>https://algorover.hashnode.dev/why-python-datetime-subtraction-returned-10-14-seconds-for-events-nearly-an-hour-apart</link><guid isPermaLink="true">https://algorover.hashnode.dev/why-python-datetime-subtraction-returned-10-14-seconds-for-events-nearly-an-hour-apart</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 24 Nov 2026 00:48:55 GMT</pubDate><content:encoded><![CDATA[<p>This example was tested with Python 3.12.16 using two timestamps from the USGS earthquake catalog. Events `hv74520982` and `av93342608` occurred 3,589.86 seconds apart. Subtracting their Los Angeles datetimes directly returned −10.14 seconds. [USGS GeoJSON query](<a href="https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&amp;starttime=2024-11-03T08:00:00&amp;endtime=2024-11-03T10:00:00&amp;orderby=time-asc">https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&amp;starttime=2024-11-03T08:00:00&amp;endtime=2024-11-03T10:00:00&amp;orderby=time-asc</a>)</p>
<p>The code uses the original timestamps in milliseconds since the Unix epoch. It creates two timezone-aware datetimes, meaning they both carry time zone information, using the same `ZoneInfo` object for Los Angeles.</p>
<p>```python</p>
<p>from datetime import datetime, timezone</p>
<p>from zoneinfo import ZoneInfo</p>
<p>la = ZoneInfo('America/Los_Angeles')</p>
<p>a = datetime.fromtimestamp(1730621635690 / 1000, tz=la)</p>
<p>b = datetime.fromtimestamp(1730625225550 / 1000, tz=la)</p>
<p>for event in (a, b):</p>
<p>print(event.isoformat(), f'fold={event.fold}')</p>
<p>print((b - a).total_seconds())</p>
<p>print((b.astimezone(timezone.utc) - a.astimezone(timezone.utc)).total_seconds())</p>
<p>```</p>
<p>The run produced this output.</p>
<p>```text</p>
<p>2024-11-03T01:13:55.690000-07:00 fold=0</p>
<p>2024-11-03T01:13:45.550000-08:00 fold=1</p>
<p>-10.14</p>
<p>3589.86</p>
<p>```</p>
<p>When daylight saving time ended, Los Angeles went through the 1 a.m. hour twice. Python’s `fold` value marks which occurrence a datetime belongs to. The first event was in the first occurrence (`fold=0`, UTC−07:00). The second event was in the repeated hour (`fold=1`, UTC−08:00), when the local clock showed an earlier time.</p>
<p>When two timezone-aware datetimes share the same `tzinfo` object, which supplies their time zone rules, Python subtracts the local clock readings and ignores both UTC offsets. Converting each datetime to UTC applies its offset before subtraction, so the result measures the time that actually elapsed. [Python datetime documentation](<a href="https://docs.python.org/3/library/datetime.html#datetime-objects">https://docs.python.org/3/library/datetime.html#datetime-objects</a>)</p>
<p>If your code calculates elapsed time from local timestamps, use this pair as a test case and check the result against the difference between the original timestamps in milliseconds.</p>
]]></content:encoded></item><item><title><![CDATA[A Re-entry Test Needs a Defined Cooldown Clock]]></title><description><![CDATA[Keep the exit rule unchanged and decide what advances the cooldown before building the test. Does it expire after a fixed amount of elapsed time, or after…]]></description><link>https://algorover.hashnode.dev/a-re-entry-test-needs-a-defined-cooldown-clock</link><guid isPermaLink="true">https://algorover.hashnode.dev/a-re-entry-test-needs-a-defined-cooldown-clock</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Mon, 23 Nov 2026 02:58:15 GMT</pubDate><content:encoded><![CDATA[<p>Keep the exit rule unchanged and decide what advances the cooldown before building the test. Does it expire after a fixed amount of elapsed time, or after the strategy observes a set number of eligible bars?</p>
<p>Suppose two runs exit on the same bar at 10:00. Both receive the 10:10 bar, but only one receives the 10:05 bar. Use those timestamps in a tiny fixed fixture and treat each observed bar after the exit as eligible to count toward the cooldown.</p>
<p>With a ten-minute cooldown measured from the exit, both runs are eligible to re-enter at 10:10. With a cooldown of two observed eligible bars, only the run that received the 10:05 bar is eligible at 10:10. At that shared timestamp, compare each run’s eligibility with the expected value for the rule you chose. An eligible strategy can still have no entry signal, so fills tell you little about whether the cooldown expired when expected.</p>
<p>AlgoRover lets you save a separate strategy version.</p>
]]></content:encoded></item><item><title><![CDATA[How to Choose a Trade for a Re-entry Test]]></title><description><![CDATA[Suppose two backtests enter a trade on the same bar. One exits on bar 20, and the other exits on bar 22. Because the next entry decisions follow different…]]></description><link>https://algorover.hashnode.dev/how-to-choose-a-trade-for-a-re-entry-test</link><guid isPermaLink="true">https://algorover.hashnode.dev/how-to-choose-a-trade-for-a-re-entry-test</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sun, 22 Nov 2026 13:22:50 GMT</pubDate><content:encoded><![CDATA[<p>Suppose two backtests enter a trade on the same bar. One exits on bar 20, and the other exits on bar 22. Because the next entry decisions follow different exits, this trade can’t isolate the effect of changing the re-entry rule.</p>
<p>Check the trade records for both runs. Choose a single replacement trade only if the records show that it entered at the same point in both runs and exited at the same point in both runs. Then compare the next entry decisions after that shared exit. If the records don’t establish both matches, mark the comparison inconclusive.</p>
<p>AlgoRover supports saving separate strategy versions. The product documentation is available at <a href="https://github.com/algorover/algorover-hub">AlgoRover Hub</a>.</p>
]]></content:encoded></item><item><title><![CDATA[What Happens to Re-entry If You Wait One More Bar?]]></title><description><![CDATA[Suppose both versions exit the same trade at the close of bar 20. Under the rules of this example, both are ineligible to re-enter on bar 20, so neither…]]></description><link>https://algorover.hashnode.dev/what-happens-to-re-entry-if-you-wait-one-more-bar</link><guid isPermaLink="true">https://algorover.hashnode.dev/what-happens-to-re-entry-if-you-wait-one-more-bar</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sun, 22 Nov 2026 02:55:42 GMT</pubDate><content:encoded><![CDATA[<p>Suppose both versions exit the same trade at the close of bar 20. Under the rules of this example, both are ineligible to re-enter on bar 20, so neither evaluates its entry condition. The first eligibility check is at the close of bar 21.</p>
<p>At the close of bar 21, the baseline can evaluate its usual entry condition. It signals if the condition passes and produces no signal if it fails. The edited version waits one full bar after the exit, so its entry condition remains unevaluated at the close of bar 21. It can first evaluate that condition at the close of bar 22.</p>
<p>Before comparing the versions, confirm they closed the same trade by matching its entry and exit records across versions. A missing record is unknown. If the records can’t identify the trade, use a different example you can verify.</p>
<p>The first difference in eligibility is at the close of bar 21, when the extra wait blocks re-entry in the edited version. There’s also a difference in signals at that close if the baseline’s entry condition passes.</p>
<p>To try the same edit on your strategy, save the edited strategy as a separate version in AlgoRover. <a href="https://github.com/algorover/algorover-hub">AlgoRover Hub</a></p>
]]></content:encoded></item><item><title><![CDATA[Your trading bot reconnected. Why did its position jump from 3 to 6?]]></title><description><![CDATA[A bot is long 3 units. It reconnects, receives the last fill again, and reports a position of 6. You can reproduce the bug without an exchange connection…]]></description><link>https://algorover.hashnode.dev/your-trading-bot-reconnected-why-did-its-position-jump-from-3-to-6</link><guid isPermaLink="true">https://algorover.hashnode.dev/your-trading-bot-reconnected-why-did-its-position-jump-from-3-to-6</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sat, 21 Nov 2026 09:24:04 GMT</pubDate><content:encoded><![CDATA[<p>A bot is long 3 units. It reconnects, receives the last fill again, and reports a position of 6. You can reproduce the bug without an exchange connection. Feed the same fill into the position calculation twice.</p>
<pre><code class="language-python">def replay_buys(fills):
    seen = set()
    position = 0
    for fill_id, quantity in fills:
        if fill_id in seen:
            continue
        seen.add(fill_id)
        position += quantity
    return position

assert replay_buys([("fill-A", 3), ("fill-A", 3)]) == 3
assert replay_buys([("fill-A", 3), ("fill-B", 2)]) == 5
</code></pre>
<p>The second test matters as much as the first. A single order can have several fills. If you use the order ID as your deduplication key, you can drop a legitimate second fill. In real code, use the execution identifier with the account and instrument scope defined by your venue. The example above uses a single stream of buy fills and replays it from the beginning.</p>
<p>If your bot restores a saved position instead of replaying the whole stream, that saved position needs to agree with the fill IDs it has already applied. Otherwise a restart can load the position and apply the same fill again. For a demo test, record the position, reconnect, and compare it with the venue’s position once the connection has caught up. Check any newly completed fills before attributing a difference to a duplicate.</p>
<p>In a supported exchange Demo account, AlgoRover Live lets you watch orders, fills, and positions through a reconnect. Use those records to check your local calculation against the venue’s reported position.</p>
]]></content:encoded></item><item><title><![CDATA[Two re-entry rules. Which candle puts you back in?]]></title><description><![CDATA[Suppose both versions of a strategy exit on the same candle. One buys back on the first close above a threshold. The other waits for two consecutive closes…]]></description><link>https://algorover.hashnode.dev/two-re-entry-rules-which-candle-puts-you-back-in</link><guid isPermaLink="true">https://algorover.hashnode.dev/two-re-entry-rules-which-candle-puts-you-back-in</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Thu, 19 Nov 2026 08:38:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/01ef7de2-83bc-44c4-9375-14e36b21ac0d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Suppose both versions of a strategy exit on the same candle. One buys back on the first close above a threshold. The other waits for two consecutive closes above it. If the price dips back below on the next candle, only one version has a position.</p>
<p>Dimon compared ways back into an ETH strategy across a crash, a rise and a choppy stretch. The sideways period is worth looking at separately. The one-close and two-close rules here are an example you can try with your own strategy.</p>
<p>In AlgoRover, keep your original strategy and save a copy with just the new re-entry condition. Backtest both over the same dates, with the same exit, instrument, sizing and costs. Find the first candle where one enters and the other waits. Write down the close each version saw. You can now explain one trade even if the final returns look similar.</p>
<p>To check execution, take one saved version into AlgoRover Live with an exchange demo account. At its next qualifying entry, note when the rule passed, when the order appeared and when it filled. An extra candle of confirmation and a delay getting filled show up in different places in that record.</p>
<p>Dimon’s comparison: <a href="https://dimonb19a.hashnode.dev/holding-eth-through-the-2022-crash-lost-52-this-free-bot-ended-at-0-9">https://dimonb19a.hashnode.dev/holding-eth-through-the-2022-crash-lost-52-this-free-bot-ended-at-0-9</a> AlgoRover Live: <a href="https://www.algorover.ai/en/live/">https://www.algorover.ai/en/live/</a></p>
]]></content:encoded></item><item><title><![CDATA[Stop Market vs Stop Limit: Why a Triggered Stop May Not Fill]]></title><description><![CDATA[RISK MANAGEMENT A triggered stop is not a completed exit. Compare execution prices, working limits and remaining positions, then check what the backtest…]]></description><link>https://algorover.hashnode.dev/stop-market-vs-stop-limit</link><guid isPermaLink="true">https://algorover.hashnode.dev/stop-market-vs-stop-limit</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Wed, 18 Nov 2026 01:27:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/ec8c9ab0-eadc-4b00-8469-ed825266d1e4.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>RISK MANAGEMENT</p>
<p>A triggered stop is not a completed exit. Compare execution prices, working limits and remaining positions, then check what the backtest assumed.</p>
<p>Your stop price was reached, yet the position is still open. Another stop sold successfully, but at a price noticeably below the number you entered. Both look like a stop failing to follow its settings, but they can be different problems.</p>
<p><strong>A stop-market order submits a market order after triggering and may fill at a worse price. A stop-limit order accepts only its limit price or better after triggering, so it may not fill at all.</strong> The trigger starts the order process; it is not a promised execution price.</p>
<h2>Stop market vs stop limit: what does each control?</h2>
<p>Consider a sell stop protecting a spot holding. A stop-market order submits a market sell when its condition is met. A stop-limit order submits a limit sell. Triggering happens first; ordinary market or limit execution comes next.</p>
<table><caption>What changes between the two sell stops</caption><thead><tr><th>Decision</th><th>Stop market</th><th>Stop limit</th></tr></thead><tbody><tr><td>Inputs</td><td>Trigger price, quantity and trigger reference</td><td>Trigger price, sell limit, quantity and trigger reference</td></tr><tr><td>After triggering</td><td>Submit a market sell against available bids</td><td>Submit a limit sell; accept the limit price or higher</td></tr><tr><td>During a fast drop</td><td>Execution may occur at lower prices</td><td>Bids below the limit cannot fill the order</td></tr><tr><td>Full execution</td><td>Still depends on liquidity, protection limits and venue rules</td><td>Also depends on eligible depth, queue priority and time in force</td></tr></tbody></table>

<p>Bybit's order documentation separates the conditional trigger from subsequent execution. Names, trigger choices and protection rules vary by venue and market, so check the order you are actually using.</p>
<h2>Stop-loss trigger price vs execution price: one order, two outcomes</h2>
<p>Suppose you bought 1 BTC at 50,000 USDT and want to sell on a decline to 48,000. Both stops use a trigger of 48,000. The stop-limit version also sets a minimum sell price of 47,900.</p>
<p>After triggering, suppose the available bids are 0.4 BTC at 47,850 and 0.6 BTC at 47,800, with no bids at 47,900 or higher.</p>
<ul>
<li><strong>Stop market:</strong> if those bids remain available and no additional protection restricts execution, the order can sell into both levels. The average fill price is 47,820.</li>
<li><strong>Stop limit:</strong> both bids are below the minimum of 47,900, so neither can fill it at that moment. A GTC order may remain working; an IOC order cancels its unfilled part under its time-in-force rules.</li>
</ul>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/stop-execution-en-1.png" alt="For the same assumed bids, a one-BTC stop-market sell fills at 47850 and 47800 with an average of 47820; a sell limit of 47900 is above every available bid and cannot fill." /></p>
<p><em>An assumed 1 BTC sell. Both orders face the same book: 48,000 is the trigger, 47,900 the sell limit, and 47,820 the market order's weighted average fill.</em></p>
<p>Kraken's stop-loss-limit guide also distinguishes the two prices and explains the possibility of non-execution during a fast decline. A sell limit of 47,900 prevents accepting lower fills; it does not cap the loss on a position that remains open.</p>
<p>If price keeps falling to 47,400 without eligible bids, the limit order may still be unfilled. You still hold the BTC and remain exposed to subsequent moves.</p>
<h2>How much does stop-loss slippage add?</h2>
<p>Before fees, selling at 48,000 would lose 2,000 USDT. Selling at the assumed average of 47,820 loses 2,180. The additional 180 USDT is 0.375% of the trigger price.</p>
<p>The average is quantity-weighted: 0.4 × 47,850 plus 0.6 × 47,800, divided by 1 BTC, gives 47,820. The 180 USDT belongs to this assumed book; it is not a fixed cost of every stop.</p>
<p>Add actual fees separately. An actual fill price already reflects its execution deviation. Subtracting the same estimated slippage again would double-count that cost.</p>
<h2>Why was my stop loss not triggered when the chart reached it?</h2>
<p>Check whether the chart and the order are watching the same price. Derivatives venues can distinguish last traded price, mark price and index price. The available references depend on the venue and market.</p>
<p>Suppose a sell stop triggers when the mark reaches 48,000. The last trade prints 47,950 while the mark remains at 48,020. A last-price chart appears to cross the stop, but the configured trigger condition has not been met.</p>
<p>This is why <strong>mark price vs last price</strong> matters: the selected reference determines activation, while executable bids determine how a sell order fills. Triggering from the mark does not guarantee execution at the mark.</p>
<p>Also distinguish a program monitoring prices locally before submitting a sell from a conditional order already resting at the exchange. The former depends on the runtime and its data connection; for the latter, verify that the conditional order actually exists at the venue. A line drawn on a chart is insufficient evidence.</p>
<h2>Triggered but not filled: follow the order's actual state</h2>
<p>Use the same order identifier to connect the records, then investigate the stage it reached.</p>
<ol>
<li><strong>Not triggered:</strong> check the reference price, trigger direction, condition and whether the stop remains active.</li>
<li><strong>Triggered, then rejected:</strong> read the rejection reason. Check balance or margin, minimum size, price restrictions and whether derivatives reduce-only instructions match the current position.</li>
<li><strong>Working limit:</strong> check the limit, eligible bids, queue and time in force. A last trade at your limit does not establish that your order filled.</li>
<li><strong>Partially filled:</strong> separate completed quantity, remaining order quantity and the remaining position.</li>
<li><strong>Local and exchange states disagree:</strong> reconcile venue orders, fills and positions before submitting another sell.</li>
</ol>
<p>For the quantity side, see how to check positions and stop quantities after partial fills. If you close a position another way, also check whether an old protective order remains active, especially in derivatives.</p>
<h2>Which stop order fits the constraint you actually want?</h2>
<p>If the priority is to attempt an exit promptly after the condition, while accepting price deviation, stop market is closer to that objective. If you refuse to sell below a specific price and accept remaining invested, stop limit expresses that constraint.</p>
<p>Decide before placing the order. Widening the limit allows more bids to qualify but does not guarantee execution. There is no universally safe gap between the stop and limit prices for every asset and order size. Larger quantities need more eligible depth.</p>
<p>Market-order protection matters too: some venues restrict the acceptable execution range, leaving quantities beyond that range unexecuted. “Market” does not guarantee immediate liquidation of the entire holding under every condition.</p>
<h2>How to account for stop execution losses in a backtest</h2>
<p>A backtest that always sells the full position exactly at the stop can miss price gaps and insufficient depth. A stop-market model needs to consider worse execution. A stop-limit model also needs unfilled and partially filled paths, including the position held afterward.</p>
<p>A candle low of 47,400 does not prove that a stop triggered at 48,000 could sell at a limit of 47,900. It does not reveal queue priority, bid depth or order arrival time. Non-execution changes the later position, so subtracting a percentage from the original exit profit does not reproduce stop-limit behavior.</p>
<p>Compare ordinary execution, a gap through the limit and partial execution, then inspect how the strategy handles the remaining position. Our analysis of slippage and backtest profits covers overall cost; the extra question here is whether this stop completed the exit at all.</p>
<h2>Frequently asked questions</h2>
<h3>Can the stop and limit prices be identical?</h3>
<p>If the venue permits it, yes. Available bids may already be below that price during a rapid decline, so the sell can remain unfilled. Matching the prices does not turn a limit order into a market order.</p>
<h3>Does a stop-limit order always pay maker fees?</h3>
<p>No. A triggered limit that immediately trades against resting bids may pay taker fees. Resting and later filling may qualify as maker execution. Check actual fills and the venue's fee rules.</p>
<h3>Does a stop-market order guarantee my maximum loss?</h3>
<p>No. The trigger does not fix the fill price. Gaps, depth and execution protection can change the outcome, and position size matters too.</p>
<h3>Should I submit another sell immediately after the stop triggers?</h3>
<p>First inspect completed fills, the remaining order and the current position. A second order can oversell. If replacing the first order, confirm its final cancellation state as well.</p>
<h2>Use AlgoRover Live to follow the stop through its fills</h2>
<p>If you run strategies with AlgoRover Live, inspect this stop's orders, fills and position together: which reference activated it, which order followed, how much sold and what remains. Review the process in a supported exchange Demo environment before deciding whether to change the execution rules.</p>
<p>Next time a stop appears to fail, bring the order identifier and its records. Finding where the process stopped is more useful than immediately replacing it with a more distant price.</p>
]]></content:encoded></item><item><title><![CDATA[API Key Permissions for Trading Bots: Research, Demo and Live]]></title><description><![CDATA[PRODUCT TUTORIALS Reading prices, inspecting an account and placing orders need different access. Match the key to the task before switching from research…]]></description><link>https://algorover.hashnode.dev/ai-trading-bot-api-key-permissions</link><guid isPermaLink="true">https://algorover.hashnode.dev/ai-trading-bot-api-key-permissions</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:27:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/a3210f79-715d-43e1-8e03-0e6f40df5fee.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>PRODUCT TUTORIALS</p>
<p>Reading prices, inspecting an account and placing orders need different access. Match the key to the task before switching from research or demo to live trading.</p>
<p>You want an AI assistant to review a strategy, but the setup asks for your exchange API key. What access does it actually need? Public market research and historical backtesting generally need no trading permission. Reading your private account, placing orders and canceling them need their own authorization. Separate those tasks before choosing a key or switching from demo to live trading.</p>
<h2>Do you need an exchange API key for research and backtesting?</h2>
<p>An API key is a credential a program uses to access an exchange. Its permissions determine what the program can do. Viewing public prices, reading your account and placing an order are separate jobs.</p>
<p>Binance, for example, labels public market-data endpoints <code>NONE</code>, private account and order information <code>USER_DATA</code>, and order placement and cancellation <code>TRADE</code>. Each endpoint has its own authorization requirements. Binance permission definitions</p>
<table>
  <caption>Match the credential to the task</caption>
  <thead><tr><th>Task</th><th>Typical requirement</th><th>Check first</th></tr></thead>
  <tbody>
    <tr><td>Public strategies and prices</td><td>A public endpoint; some data services require a login or data credential</td><td>Data source</td></tr>
    <tr><td>Historical backtesting</td><td>Historical data and strategy configuration</td><td>Data-source authorization</td></tr>
    <tr><td>Local simulated execution</td><td>Simulation configuration; some feeds require read-only credentials</td><td>Orders remain simulated locally</td></tr>
    <tr><td>Exchange demo trading</td><td>Credentials for the test environment</td><td>Key, endpoint and run mode match</td></tr>
    <tr><td>Live trading</td><td>Necessary account-query and trading permissions</td><td>Market, account and order scope</td></tr>
  </tbody>
</table>

<p>The label “paper trading” does not settle the credential question. Find out whether orders are simulated locally or sent to an exchange test environment. The latter usually needs dedicated test credentials.</p>
<h2>What is the difference between read, trade and withdrawal permissions?</h2>
<p>Think of the key as an access badge. The records room, trading desk and funds exit have separate doors. Opening every door just to check a balance makes it harder to explain what the program actually needs.</p>
<table>
  <caption>API key permissions for trading bots</caption>
  <thead><tr><th>Permission</th><th>Common use</th><th>Configuration principle</th></tr></thead>
  <tbody>
    <tr><td>Read</td><td>Balances, positions, orders and history</td><td>Check whether read-only access is sufficient for reporting or monitoring</td></tr>
    <tr><td>Trade</td><td>Place and cancel orders; exact scope varies by exchange</td><td>Enable only the spot, futures or other functions the task requires</td></tr>
    <tr><td>Withdraw and transfer</td><td>Withdraw funds or move them between accounts</td><td>Ordinary order placement needs no withdrawal access; examine transfer scope separately</td></tr>
  </tbody>
</table>

<p>Reading and trading can also use separate keys. Binance's documentation gives that example: one key trades while another queries order status. Check whether your tool supports that configuration.</p>
<p>Read the details behind the permission name. On OKX, <code>Trade</code> includes funding transfers and certain account settings as well as placing and canceling orders. A key without withdrawal permission can therefore have powers beyond buying and selling. OKX API permission definitions</p>
<h2>Should demo and live trading use different API keys?</h2>
<p>Demo credentials belong to a test account; live credentials reach real funds. Check three things together when switching: <strong>the key's environment, the API endpoint and the program's run mode</strong>.</p>
<p>OKX Demo Trading, for example, uses a key created in the demo environment and the corresponding simulated-trading request flag. Mixing a live key with demo mode can cause connection failures even when the key has broad permissions. OKX demo API FAQ</p>
<p>If demo works but live orders fail, continue with the account and order checks for the demo-to-live transition.</p>
<h2>Where should you store API keys on a computer or VPS?</h2>
<p>Use the tool's documented local credential configuration on the device that actually runs the program. When moving to your own VPS, check its credential setup and network egress address. An exchange IP allowlist must permit the address sending the requests.</p>
<p>The computer displaying your chat is not necessarily the machine trading. If the program runs on a server, the exchange receives the server's requests. Binance recommends appropriate IP restrictions for access beyond reading. Binance API key guide</p>
<p>Keep complete secrets in the local credential configuration. For troubleshooting, share permission names, run mode and a redacted error message.</p>
<h2>When does AlgoRover need exchange credentials?</h2>
<p><strong>AlgoRover Research</strong> can discover public strategies and use supported public market data for historical research without connecting an exchange account. A product login and an exchange API key serve different purposes.</p>
<p>When moving to <strong>AlgoRover Live</strong>, check credentials for the selected local simulation, exchange Demo or live mode. Live manages trading credentials locally by mode, while funds remain in your exchange account. Starting live trading requires your explicit confirmation of configuration and permissions.</p>
<p>Write down what this task needs to read, change and run on. Then consult the AlgoRover Live guide. For strategy research, start with AlgoRover Research.</p>
<h2>Common questions</h2>
<h3>Can AI analyze my trade history without trading permission?</h3>
<p>You can provide redacted fills, positions and cost records for an AI assistant to explain. A tool that reads your private exchange account directly needs the appropriate read access. Decide separately whether it should also be allowed to place orders.</p>
<h3>Can a bot still lose money when withdrawals are disabled?</h3>
<p>Yes. Trading permission still allows orders, and the wrong direction, size or frequency can create losses. Disabling withdrawals restricts a funds exit; strategy rules and position limits still need their own checks.</p>
<h3>Should I enable every permission to fix an API permission error?</h3>
<p>First check the endpoint, spot or futures market, account mode, demo or live environment, and IP allowlist. Change the specific missing permission once you identify it.</p>
<h3>Is removing a leaked key from the bot enough?</h3>
<p>Revoke the key at the exchange, then review account activity and outstanding orders. Deleting local configuration does not invalidate the exchange-issued credential.</p>
<h2>Sources</h2>
<ul>
<li>Binance: public-data, account and trading permissions</li>
<li>OKX: API key permission scope</li>
<li>OKX: demo credentials and common API errors</li>
<li>Binance: API keys and IP access restrictions</li>
</ul>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[Perpetual Funding Fees: Calculate a 30-Day Holding Cost]]></title><description><![CDATA[TRADING COSTS A small payment can become a substantial holding cost. Work through a 30-day example, then account for position changes and negative funding…]]></description><link>https://algorover.hashnode.dev/perpetual-funding-fees-30-days</link><guid isPermaLink="true">https://algorover.hashnode.dev/perpetual-funding-fees-30-days</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:27:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/f2ad9601-82b2-4815-87aa-d834cd5244d5.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>TRADING COSTS</p>
<p>A small payment can become a substantial holding cost. Work through a 30-day example, then account for position changes and negative funding rates.</p>
<p>A 2 USDT funding payment can become a 180 USDT bill over a month. Perpetual funding depends on your position value at each settlement and how many settlements you cross. But what happens when the rate changes or you reduce the position? Separate those entries to calculate a 30-day holding cost and estimate what another week could add.</p>
<h2>Are funding fees based on position value or margin?</h2>
<p>For a USDT linear perpetual, <strong>one funding payment = position value at settlement × that period's funding rate</strong>. Position value is generally the position quantity multiplied by the mark price at settlement. Posting less margin does not reduce funding on an unchanged position. Bybit calculation reference</p>
<p>Margin is like the deposit on rented equipment. A smaller deposit does not mean a smaller machine. Separate the margin you posted from the position it supports.</p>
<p>Check which side pays. With the usual mechanism, positive funding means longs pay shorts; negative funding means shorts pay longs. Record funding separately from entry and exit fees. Inverse and other contracts also require checking the settlement unit.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/08/funding-explainer-en-v1.png" alt="An octopus holds a position-sized balloon while a settlement clock keeps printing funding bills" /></p>
<p><em>Position value sets each bill's base; settlement count determines how many bills arrive.</em></p>
<h2>How much does a 20,000 USDT position cost over 30 days?</h2>
<p>Hold the assumptions fixed: you stay on the paying side, position value remains 20,000 USDT, funding settles every eight hours, and the 30-day period crosses exactly 90 settlements. Each row holds its rate constant.</p>
<table>
  <caption>30-day funding costs at fixed rates (illustrative example)</caption>
  <thead><tr><th>Rate per period</th><th>Each payment</th><th>Total: 90 payments</th></tr></thead>
  <tbody>
    <tr><td>0.005%</td><td>1 USDT</td><td>90 USDT</td></tr>
    <tr><td>0.010%</td><td>2 USDT</td><td>180 USDT</td></tr>
    <tr><td>0.030%</td><td>6 USDT</td><td>540 USDT</td></tr>
  </tbody>
</table>

<p>The middle row is 20,000 × 0.010% × 90 = 180 USDT. Two USDT at a time sounds small. It simply happens three times a day, without weekends off.</p>
<p>If you initially posted 4,000 USDT of margin, 180 USDT is 4.5% of that initial deposit. Changing leverage to reduce margin on the same 20,000 USDT position does not directly change its funding bill. Keeping margin fixed while using more leverage to increase the position also increases funding exposure.</p>
<h2>How do you calculate total funding when rates change?</h2>
<p>Add the settlements individually. Each entry uses <strong>the position value, funding rate and position direction at that time</strong>. Position changes, price changes and a switch between positive and negative rates can all alter the next payment.</p>
<table>
  <caption>Three settlements after reducing a long position (illustrative example)</caption>
  <thead><tr><th>Settlement</th><th>Position value</th><th>Rate</th><th>Cash flow</th></tr></thead>
  <tbody>
    <tr><td>1</td><td>20,000 USDT</td><td>0.010%</td><td>Pay 2 USDT</td></tr>
    <tr><td>2</td><td>15,000 USDT</td><td>−0.010%</td><td>Receive 1.5 USDT</td></tr>
    <tr><td>3</td><td>15,000 USDT</td><td>0.020%</td><td>Pay 3 USDT</td></tr>
  </tbody>
</table>

<p>You paid 5 USDT and received 1.5 USDT: a net cost of 3.5 USDT. Multiplying the first payment by three gives 6 USDT and erases everything that changed afterward.</p>
<p>For costs already incurred, start with the exchange's funding settlement records. Match time, contract, direction, position value, rate and actual cash flow. Check the reporting period and currency before totaling them. Today's rate cannot reconstruct last month's bill.</p>
<h2>How often are perpetual funding fees charged?</h2>
<p>Check the contract's interval and the settlement times your position actually crossed. Bybit states that different trading pairs can have different intervals. An eight-hour interval gives three daily settlement points. Under that mechanism, you generally pay or receive funding when holding a position at settlement. Settlement and holding rules</p>
<p>Check the next funding time on the trading page, then count the settlements crossed during your holding period. Days held and payments incurred are different quantities.</p>
<h2>What could another seven days of funding cost?</h2>
<p>Use records for past costs and scenarios for future costs. Keeping the same 20,000 USDT position and three daily settlements, another seven days crosses 21 settlements:</p>
<ul>
<li>0.005% per period: another 21 USDT.</li>
<li>0.010% per period: another 42 USDT.</li>
<li>0.030% per period: another 126 USDT.</li>
</ul>
<p>Compare those amounts with the profit you still expect from the trade. These scenarios assume a fixed rate; the actual bill still comes from individual settlements.</p>
<h2>Why can total P&amp;L be negative even when you receive funding?</h2>
<p>Funding income is one line in the account. For the same holding period: <strong>price P&amp;L + funding received − funding paid − entry and exit fees = P&amp;L after those items</strong>.</p>
<p>Check whether the exchange or report already deducts funding from net P&amp;L before totaling the entries. Deducting it again counts the same cost twice. For the broader calculation, see how fees, spreads and slippage affect backtest profits.</p>
<h2>How should you reconcile your own funding records?</h2>
<p>Choose one complete holding period. Export its funding entries and match them to position changes and the P&amp;L report. Look for missing settlements, reversed payment direction and costs the report already includes.</p>
<p>In an AI assistant with <strong>AlgoRover Research</strong> enabled, paste redacted text records and ask AI to explain cost definitions and identify items to check. Verify amounts and payment direction against the original statement.</p>
<p>Review your funding records Copy</p>
<pre><code>Using these position and funding records, help me check the reporting period, payment direction and whether the P&amp;L report already deducts funding. List potentially missing or duplicated entries, then explain the cost of another seven days under low, middle and high funding-rate scenarios.
</code></pre>
<p>Start with the AlgoRover Research guide. Reconcile one holding period before choosing the next cost assumption to test.</p>
<h2>Common questions</h2>
<h3>What number should I enter for a 0.01% funding rate?</h3>
<p>Enter 0.01 when the field is labeled as a percentage. For manual multiplication, convert 0.01% to 0.0001. Then 20,000 × 0.0001 = 2 USDT.</p>
<h3>Does the closing fee include funding?</h3>
<p>Entry and exit commissions and funding arise separately. Check whether a report includes both in total P&amp;L; a field labeled “fees” does not establish its calculation scope.</p>
<h3>Does multiplying today's funding rate by a year give its annualized cost?</h3>
<p>It gives a simple annualized estimate under an unchanged-rate assumption. Normalize different settlement intervals to the same time unit. Actual annual spending requires summing the year's settlement records.</p>
<h3>Can I compare funding rates directly with margin borrowing rates?</h3>
<p>First match the time unit and charging base. Borrowing interest follows the amount borrowed and its interest rules; perpetual funding follows the contract position and settlement rules. Compare estimated amounts for the same trade rather than two percentages alone.</p>
<h2>Sources</h2>
<ul>
<li>Bybit: funding calculations, settlement times and records</li>
</ul>
<p>For research and education; not investment advice.</p>
<p>NEXT STEP</p>
<h2>Put the records together. What should you check next?</h2>
<p>Bring your results, settings, and cost records to AlgoRover Research to explore the differences and identify what to check next.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[AI Trading Bot Token Costs: Which Decisions Can Run as Rules?]]></title><description><![CDATA[TRADING COSTS A short answer can still carry a long input. See how model calls add up and where strategy reuse and fixed-rule execution can reduce token…]]></description><link>https://algorover.hashnode.dev/ai-trading-bot-token-cost-budget</link><guid isPermaLink="true">https://algorover.hashnode.dev/ai-trading-bot-token-cost-budget</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:26:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/4bb090b4-504d-4d00-be1d-1b568785eba7.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>TRADING COSTS</p>
<p>A short answer can still carry a long input. See how model calls add up and where strategy reuse and fixed-rule execution can reduce token usage.</p>
<p>Where do an AI trading bot's tokens go? One market assessment can involve several model requests: reading data, producing a judgment and analyzing tool results. Even if the final answer is just “hold,” the rules, market data and conversation history sent along the way count toward input usage. To control costs, first identify when the model is called and how much context each request carries. Then decide which calls are worth keeping.</p>
<h2>Why do AI trading bots consume so many tokens?</h2>
<p><strong>The useful distinction is between asking a model to decide on every cycle and using AI to research a strategy whose defined rules then run in software.</strong> These workflows make different numbers of model requests. To calculate token costs, check how many requests are made, how much content each sends, how long the model's responses are and the model's token prices.</p>
<p>In the first design, new market data, positions or news enter a model workflow that produces an assessment or proposed action. Analyst roles, tools and reviews can make one decision involve several requests. Those calls can be useful when the task needs interpretation of text or complex evidence.</p>
<p>In the second design, explicit conditions stay in the strategy program. For example: generate an entry signal when the fast moving average crosses above the slow one on a closed candle, with no additional entry while a position is open. When software computes the indicators and conditions, it need not repeatedly submit the context to a model.</p>
<p>It is like agreeing on a shift checklist: run it on schedule and discuss changes when needed. You do not need a new meeting for every routine check. The avoidable calls are the ones spent reinterpreting conditions that have already been settled.</p>
<h2>Where can AlgoRover's approach reduce token usage?</h2>
<p>With AlgoRover Research, you can use AI to find published strategies, select available presets and markets, preview a configuration, and review trades and reports after completion. AI is useful for understanding the strategy, defining a test and interpreting results.</p>
<p><strong>AlgoRover's library contains 4,000+ strategies, including strategies uploaded and shared by experienced traders. Users can select a strategy and install it with one click.</strong> Through AI conversations, users can adapt existing strategies, adjusting trading rules and parameters to suit their trading goals and risk preferences.</p>
<p>Starting with an existing strategy and focusing on the parts you want to change can reduce the input and output tokens spent describing a strategy from scratch, generating a complete set of rules and repeatedly explaining the same requirements.</p>
<p>For example, if a moving-average strategy is close to what you need, ask AI to explain its existing rules first. Then discuss changes around your position requirements and parameter settings. Keep the parts that fit and focus the conversation on what needs to change, carrying that work into subsequent research.</p>
<p>For execution, we pass the selected strategy program and parameters to an engine: Research runs a historical backtest, while Live passes the strategy to the trading engine on your runtime device. <strong>When a fixed-rule strategy computes its indicators and signals in code, routine checks can run there without model requests increasing with every candle.</strong></p>
<table><caption>Where the two workflows use models differently</caption><thead><tr><th>Task</th><th>Model judgment each cycle</th><th>AI research plus fixed-rule execution</th></tr></thead><tbody><tr><td>Routine market check</td><td>Submit data and conditions for another model judgment</td><td>Update indicators and evaluate conditions in code</td></tr><tr><td>Rules and historical context</td><td>May be resent with each request</td><td>Keep rules and parameters in the strategy configuration; routine calculations need not explain them to a model again</td></tr><tr><td>New hypotheses and changes</td><td>Call models according to the decision and research workflow</td><td>Use AI around a research question, then review configuration changes</td></tr><tr><td>Anomalies and review</td><td>Depends on the review workflow</td><td>Provide relevant records when AI analysis is needed</td></tr></tbody></table>

<p>Savings can occur at two stages: <strong>during research, reuse an existing strategy to reduce generation from scratch and repeated explanations; during execution, let code check fixed conditions to reduce routine model requests and their repeated context.</strong> Research, changes and interpretation can be organized around actual questions.</p>
<p>This benefit applies to explicit conditions expressible in code. If the strategy needs a model to interpret each news event or announcement, retain a budget for those necessary calls.</p>
<h2>What does a five-minute model loop cost over 30 days?</h2>
<p><strong>Monthly AI trading bot token cost = monthly input tokens / 1,000,000 × price per million input tokens + monthly output tokens / 1,000,000 × price per million output tokens.</strong> Calculate cached inputs and other applicable billing categories separately using the provider's bill. Measure usage first, then apply the prices of the model you use.</p>
<p>Consider an <strong>illustrative budget</strong>: 30 uninterrupted days with one check every five minutes, or 8,640 checks. Workflow A requests one model judgment per check. Workflow B checks routine conditions in code and separately budgets 120 requests for research, changes and review. That allowance is an example assumption, not an AlgoRover quota or measured monthly average.</p>
<p>To isolate request count, give each request in both workflows 2,000 uncached input tokens and 300 output tokens. Use teaching prices of $1 per million input tokens and $4 per million output tokens. Exclude caching, retries, additional reasoning and tool charges from both. These are not current prices for a named model.</p>
<table><caption>30-day model budget at equal usage per request: illustrative example</caption><thead><tr><th>Workflow</th><th>Model requests</th><th>Input / output tokens</th><th>Model cost</th></tr></thead><tbody><tr><td>A: one model request every five minutes</td><td>8,640</td><td>17.28 million / 2.592 million</td><td>About $27.65</td></tr><tr><td>B: code checks conditions; separate research allowance</td><td>120</td><td>240,000 / 36,000</td><td>About $0.38</td></tr></tbody></table>

<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/token-budget-comparison-en-c6db033cda63.png" alt="At equal usage per request, 8,640 model requests cost about $27.65 and 120 cost about $0.38" /></p>
<p><em>30-day model cost comparison: illustrative example. Usage and prices per request are equal; request counts are 8,640 and 120.</em></p>
<p>Each example request costs 2,000 / 1,000,000 × $1 + 300 / 1,000,000 × $4 = $0.0032. A costs $27.648 and B costs $0.384, a difference of $27.264. The table rounds to two decimal places.</p>
<p>The saving has a specific cause: B does not request a model judgment for each of its 8,640 fixed-condition checks. It still processes market data and uses research conversations. Actual research requests may be longer; automated AI reviews, event analysis and retries must also enter B's bill.</p>
<h2>Does reducing model calls mean missing signals?</h2>
<p>Separate <strong>checking the market less often</strong> from <strong>requesting a model less often</strong>. A five-minute rule can still be evaluated every five minutes by software. Saving tokens on a mathematical condition does not require turning it into an hourly check.</p>
<p>Keep calls where information needs interpretation. If the strategy requires understanding an announcement, deleting that step changes the strategy. A news-analysis workflow and a moving-average rule answer different questions; a lower bill alone does not establish which fits better.</p>
<h2>How can you identify avoidable token usage?</h2>
<ol>
<li><strong>Find the triggers.</strong> Does every candle call the model, or do calls occur during research, event analysis and review?</li>
<li><strong>Count the full request chain.</strong> Include tool follow-ups, additional judgments and retries.</li>
<li><strong>Inspect repeated inputs.</strong> How much of the same rules, history and market data is resent?</li>
<li><strong>Identify fixed conditions.</strong> Could software evaluate them, with its behavior checked against the specification?</li>
<li><strong>Price actual usage.</strong> Apply the relevant input, caching, output and other categories from provider records.</li>
</ol>
<p>A short answer can carry a long context or billable reasoning. Caching can reduce some repeated-input charges; evaluating a fixed condition directly in code can avoid the request for that check. Account for these savings separately.</p>
<h2>Give AI a defined research task</h2>
<p>Find a published strategy in Research that is close to your needs and understand its entry, exit and sizing rules. Tell AI what to keep and what you want to adjust, then select available parameters, presets and markets and preview the backtest configuration. Test the changes, review the report and refine the strategy using what you have already learned.</p>
<p>Start with an existing strategy and adapt it to your needs Copy</p>
<pre><code>Find several published BTC strategies. Explain their entry, exit and position-sizing rules and list available versions, parameters, presets and markets. I want fewer frequent entries. Choose a strategy close to that goal, explain which rules to keep and which settings to test, and list any requirements you need me to clarify. Preview a backtest configuration without starting a run.
</code></pre>
<p>Get started with AlgoRover Research. When you need ongoing execution, review Live's Demo and deployment settings. Hosting, market-data services and trading fees belong in the total operating budget alongside model usage.</p>
<p>Let software keep checking defined rules. Use AI for questions worth thinking through again. Then the token savings have an explanation you can trace.</p>
<h2>Frequently asked questions</h2>
<h3>How can reusing an existing strategy save tokens?</h3>
<p>An existing strategy gives you a starting point for entry, exit and position-sizing rules. Choosing one close to your needs and focusing AI conversations on the changes can reduce the tokens spent describing requirements and generating complete rules from scratch. Savings depend on the scope of changes, number of requests and actual input and output lengths.</p>
<h3>Does AlgoRover call a language model on every candle?</h3>
<p>We pass strategy programs and parameters to an engine. A fixed-rule strategy that computes indicators and signals in code does not need a fresh model request for every candle. Research conversations, interpretation and additional model-driven tasks have their own usage.</p>
<h3>How can an AI trading bot reduce input tokens?</h3>
<p>Identify requests that only repeat fixed-condition checks. Moving those conditions into code can eliminate those requests together with their market data, rule descriptions and conversation context. Optimize input scope and caching separately for research and analysis that still need a model.</p>
<h3>Does executing without a model request mean zero running cost?</h3>
<p>Compute, machines or hosting, and potentially data and trading fees remain. This article compares model-token costs, not the entire operating bill.</p>
<h3>Does a monthly AI subscription make request counts irrelevant?</h3>
<p>Check its allowances, limits and permitted usage. Subscription and metered API billing differ; repeated requests can still consume allowances and add latency.</p>
<h2>Sources</h2>
<ul>
<li>TradingAgents: a research framework with LLM analyst and decision roles</li>
<li>OpenAI: tokens and usage</li>
<li>OpenAI: prompt caching and billing</li>
</ul>
<p>For research and education; not investment advice.</p>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[Crypto Backtest Survivorship Bias: Are You Using Today's Coin List?]]></title><description><![CDATA[BACKTEST VALIDATION Could you actually buy those coins back then? Check listings, delistings and ranking dates before crediting the trading rules for a…]]></description><link>https://algorover.hashnode.dev/crypto-backtest-historical-universe</link><guid isPermaLink="true">https://algorover.hashnode.dev/crypto-backtest-historical-universe</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:25:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/7f40cff6-d75f-4f3f-87ac-100d7436ed13.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>BACKTEST VALIDATION</p>
<p>Could you actually buy those coins back then? Check listings, delistings and ranking dates before crediting the trading rules for a good-looking backtest.</p>
<p>A three-year crypto backtest can look great if it only includes today's popular coins. What happened to the coins that were active then but later delisted? Were any included before they even launched? Survivorship bias often starts with that coin list. Check how it was chosen before deciding whether the returns came from the trading rules or from knowing which coins survived.</p>
<h2>What goes wrong when you backtest today's crypto universe?</h2>
<p><strong>A historical trading universe should use information available at the decision time.</strong>Today's listed, liquid assets survived events that a trader at the historical start could not know. Excluding assets that later disappeared can create survivorship bias. Selecting past trades using future volume or market capitalization introduces look-ahead bias.</p>
<p>Those problems can coexist, but they need different checks. Recover missing candidates for survivorship bias; inspect the availability time of each selection input for look-ahead bias. A price series alone does not establish that an asset was eligible to trade.</p>
<h2>Can a dynamic pairlist still use current market information?</h2>
<p>Yes. “Dynamic” describes a changing list, not necessarily a historically correct one. Freqtrade's backtesting documentation warns that dynamic pairlists may depend on current market conditions and fail to reflect historical pairlist states. Lists other than StaticPairlist can also affect reproducibility. This is a warning about implementation, not a verdict on every dynamic universe.</p>
<p>First decide what you want to find out: how a few chosen coins performed in the past, or which coins your selection rule would actually have picked back then. These three approaches tell you different things.</p>
<table><caption>How you choose coins changes what the backtest tells you</caption><thead><tr><th>How you choose coins</th><th>What you find out</th><th>What is easy to miss</th></tr></thead><tbody><tr><td>Pick today's popular coins and backtest their past prices</td><td>How your trading rules would have performed on those coins</td><td>Coins that were popular then but later delisted or lost liquidity may be missing, making returns look better</td></tr><tr><td>Choose only BTC and ETH and keep them throughout the test</td><td>How the same trading rules perform on BTC and ETH</td><td>The result covers those two coins; it does not show what a whole-market selection rule would have picked</td></tr><tr><td>Go back through history and choose coins each week using volume known at the time</td><td>Which coins you would have bought and how those trades would have performed</td><td>Use only data available then, and include coins that were tradable then but delisted later</td></tr></tbody></table>

<h2>How do you build a point-in-time crypto universe?</h2>
<ol>
<li><strong>Declare the selection rule first.</strong> For example, rank eligible spot pairs at UTC midnight using the previous completed day's volume.</li>
<li><strong>Keep historical market membership.</strong> Include listing dates, suspensions, delistings and pair changes.</li>
<li><strong>Record data availability.</strong> Distinguish the period being measured from when its completed value could be retrieved.</li>
<li><strong>Save each rebalance.</strong> Record inclusions, exclusions and missing-data decisions, including how to exit a holding that leaves the list.</li>
<li><strong>Charge for the changes.</strong> Turnover, spreads and unfilled orders belong in the result.</li>
</ol>
<p>Suppose a coin launches in June, but your backtest buys it in January. That trade could never have happened. The same goes for using March's volume ranking to decide what to buy in February. Check those dates first to see whether later information slipped into earlier decisions.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/universe-inline-en-e0b1fb0d131d.png" alt="Suppose a coin lists in June. Earlier months cannot include it as a tradable asset." /></p>
<p><em>Suppose a coin lists in June. Earlier months cannot include it as a tradable asset.</em></p>
<h2>Can you backtest without complete historical membership?</h2>
<p><strong>You can start with a fixed BTC and ETH basket to understand the trading rules.</strong> To answer what a whole-market selection rule would have earned back then, you need the listings, volume and replacement records available at the time. Saving today's list as a CSV makes it easier to rerun the same basket; it does not bring back missing coins.</p>
<p>You can study a declared fixed basket. That is useful for isolating entry and exit rules, provided the conclusion stays specific to that basket. Freezing the assets improves repeatability; it does not explain why those assets were chosen.</p>
<p>Where data permits, hold rules and dates constant and compare today's list with a reconstructed historical universe. Examine trade counts, turnover, membership changes and missing-data coverage alongside returns. Do not invent prices for delisted assets to make the dataset look complete.</p>
<h2>What should you ask about a good-looking backtest?</h2>
<p>Ask how the list was chosen, when it was settled, where the historical market information came from and how assets were replaced. Then pick a few dates and look back: which coins made the list, why were they chosen, and could you actually trade them then?</p>
<p>AlgoRover Research can help you understand strategy material and backtest results. Before running the rules, keep the strategy version, chosen coins and replacement conditions together so you can check that execution follows the same setup you reviewed.</p>
<p>Then look at out-of-sample validation and trading costs. Rebuild the list of coins available at the time, then see how much of the return your trading rules still produce.</p>
<h2>Frequently asked questions</h2>
<h3>Does a fixed BTC and ETH backtest have survivorship bias?</h3>
<p>Choosing them at a historical start because you now know they survived uses later information. It remains a valid fixed-basket study if you describe its scope accordingly.</p>
<h3>Is yesterday's trading volume safe to use?</h3>
<p>Check that the period had closed and its data was available before selection and trading. Historical listings and exit rules still matter.</p>
<h3>Should missing delisted prices be replaced with zero?</h3>
<p>No arbitrary replacement establishes a tradable exit. Investigate the last trading time and exit rules; identify any period that cannot be reconstructed.</p>
<h3>Does StaticPairlist eliminate selection bias?</h3>
<p>It helps reproduce the chosen assets. It does not establish that their selection was historically valid or that fills and costs were realistic.</p>
<h2>Compare the coin list with actual trades</h2>
<p>Once the historical universe is checked, run the selected strategy in a supported exchange Demo through AlgoRover Live. Inspect which coins it trades and when it replaces them, then compare orders and positions with your selection rules.</p>
<p>See how Live runs a strategy</p>
<h2>Sources</h2>
<ul>
<li>Freqtrade: backtesting and dynamic pairlists</li>
</ul>
<p>Not investment advice.</p>
]]></content:encoded></item><item><title><![CDATA[EMA Warm-Up: Why Trading Signals Can Change After a Restart]]></title><description><![CDATA[BACKTEST VALIDATION The settings stayed the same, but the buy signal disappeared after a restart. Check where the history begins and how the first EMA…]]></description><link>https://algorover.hashnode.dev/ema-warmup-restart-signals</link><guid isPermaLink="true">https://algorover.hashnode.dev/ema-warmup-restart-signals</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:25:03 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/0e9e8c21-df66-4122-b756-44b0de6f6487.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>BACKTEST VALIDATION</p>
<p>The settings stayed the same, but the buy signal disappeared after a restart. Check where the history begins and how the first EMA value is calculated.</p>
<p>You restart a trading bot without changing the strategy, yet its EMA moves to the other side of the entry threshold. Yesterday's buy signal disappears on the same candle. The missing ingredient may be the history loaded at startup: an EMA remembers where it began. How much warm-up does it need, and how do you check that a restart preserves the decision?</p>
<h2>Why can the same EMA period produce different values?</h2>
<p><strong>An EMA depends on its previous value and initialization, not only its period.</strong> A common recurrence is current EMA = α × current price + (1 − α) × previous EMA, with α = 2 / (period + 1). Starting on different dates can produce different initial values. The difference decays as new prices arrive; reaching N candles does not automatically erase it.</p>
<p>Think of a running account balance. Identical transactions today do not produce the same balance if yesterday's opening balances differed. Matching the latest price checks only the latest input.</p>
<p>Platforms may also seed the first EMA differently. In QuantConnect's EMA documentation, the first ready value is a simple moving average, followed by recursive updates. Before comparing platforms, check that first value and the starting candle, not just whether both periods say 20.</p>
<h2>How many warm-up candles does an EMA need?</h2>
<p>It depends on how your strategy uses the EMA. The starting value, other indicators and how close price sits to a trading threshold all affect the history you need. Once the EMA returns a number, check whether loading more history still changes that number or the trading signal.</p>
<p>Suppose two EMA 20 calculations start 10 apart, then receive exactly the same prices. Here is how that gap shrinks as new prices arrive:</p>
<table><caption>How much of the EMA 20 starting gap remains?</caption><thead><tr><th>Condition</th><th>Updates</th><th>Remaining difference, approximately</th></tr></thead><tbody><tr><td>EMA 20, initial difference 10</td><td>20</td><td>1.351</td></tr><tr><td>EMA 20, initial difference 10</td><td>60</td><td>0.0247</td></tr><tr><td>EMA 20, initial difference 10</td><td>100</td><td>0.00045</td></tr></tbody></table>

<p>These values come from 10 × (19/21)<sup>k</sup>, where k is the number of updates. The gap keeps shrinking. Whether it is small enough to leave your orders unchanged depends on the signal rule; other indicators in the strategy may need more history too.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/ema-inline-en-18f4aaa99070.png" alt="Suppose two EMA 20 calculations start at 90 and 100, with every later close at 100. The lines converge as the effect of initialization decays." /></p>
<p><em>Suppose two EMA 20 calculations start at 90 and 100, with every later close at 100. The lines converge as the effect of initialization decays.</em></p>
<h2>Can a tiny indicator difference change a trade?</h2>
<p>It can when price is close to the trigger. Suppose price is 100.00 and the EMA comes out at 99.99 in one calculation and 100.01 in another. A “price above EMA” rule triggers in the first case and stays off in the second. A difference of just 0.02 changes the decision.</p>
<p>A crossover also depends on the previous candle. A small difference on the final row does not establish matching crossover times. Compare signal timestamps, first entries and exits as well as indicator values.</p>
<h2>What does recursive analysis actually test?</h2>
<p>Freqtrade's recursive-analysis compares indicator values under different startup-candle counts. Its documentation explicitly limits the comparison to the final row and says it does not verify entry or exit signals. Treat a low reported variance as an indicator check, then test the decisions themselves.</p>
<ol>
<li>Fix the market, timeframe, end time, price field and indicator implementation.</li>
<li>Compute with several historical starting points and compare the same overlapping period.</li>
<li>Inspect values near thresholds and compare entry, crossover and exit timestamps.</li>
<li>Choose a startup length, freeze it and rerun the formal test.</li>
<li>Save the actual data count, first and last timestamps, and first permitted trading time.</li>
</ol>
<p>Choose lengths that fit the strategy and available history. Selecting the startup count that gives the prettiest equity curve turns another engineering setting into an optimization parameter.</p>
<h2>What else should you check after a restart?</h2>
<p>Compare the same closed candle first. Then inspect missing or duplicate candles, timezones, price fields, revised data, and whether historical and live events reach the indicator in chronological order. An unfinished candle changing in real time is a different problem from initialization.</p>
<p>Record four boundaries: data loading begins, indicators become ready, trading is permitted, and performance measurement begins. Warm-up history may precede the test; it should not silently change the intended evaluation period.</p>
<h2>How do you make startup conditions reproducible?</h2>
<p>Save periods, historical start, initialization method, warm-up count and trading start. AlgoRover Research can help organize the historical research. Keep those settings with the strategy version when moving to execution so a restart does not quietly change the starting conditions.</p>
<p>For a closer look at how signals lead to trades, see EMA crossovers and ATR exits. After a restart, pick a few matching candles and compare the values and decisions. That gives you somewhere concrete to start looking.</p>
<h2>Frequently asked questions</h2>
<h3>Are 200 candles enough for EMA 200?</h3>
<p>Having a value does not establish convergence. Compare different history lengths at the same end time and inspect both indicators and signals.</p>
<h3>Is a longer warm-up always better?</h3>
<p>More history generally reduces initial-value influence but requires more data. Look for a stable, reproducible configuration rather than a return-maximizing count.</p>
<h3>Does zero recursive variance prove matching live signals?</h3>
<p>No. A final-row comparison does not validate every decision, data timestamp or execution setting.</p>
<h3>Why do two platforms calculate different EMAs?</h3>
<p>Compare seeds, price fields, date ranges, live versus closed candles and missing-data rules before attributing the difference to precision.</p>
<h2>Did the restart change the orders too?</h2>
<p>After checking the EMA difference, run the same version and configuration in AlgoRover Live. Compare signals and order records before and after the restart to locate where the trading decision changed. Start in a supported exchange Demo.</p>
<p>Continue the execution checks with Live</p>
<h2>Sources</h2>
<ul>
<li>Freqtrade: recursive analysis</li>
<li>Freqtrade: strategy startup period</li>
</ul>
<p>Not investment advice.</p>
]]></content:encoded></item><item><title><![CDATA[How to Verify AI-Generated Trading Strategies Against Your Rules]]></title><description><![CDATA[BACKTEST VALIDATION You asked for a crossover, but the code buys whenever one line is above another. Check the rules, timeframe, sizing and fees before…]]></description><link>https://algorover.hashnode.dev/verify-ai-trading-strategy-rules</link><guid isPermaLink="true">https://algorover.hashnode.dev/verify-ai-trading-strategy-rules</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:24:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/57a22069-fd7e-461e-87cc-d9bb6e0c01ed.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>BACKTEST VALIDATION</p>
<p>You asked for a crossover, but the code buys whenever one line is above another. Check the rules, timeframe, sizing and fees before trusting the returns.</p>
<p>You ask an AI for a strategy that buys when one moving average crosses above another. The backtest runs and the chart looks good. Then the logs reveal a different condition: buy whenever the fast average is above the slow one. The software solved a different problem successfully. How do you verify the rules before trusting the returns?</p>
<h2>Does a working backtest prove the strategy is correct?</h2>
<p><strong>Successful execution shows that the program ran. Correct implementation requires comparing the requested rules with observed behavior.</strong> Compilation, a clean run and a performance report do not individually establish closed-candle confirmation, crossover timing or position limits.</p>
<p>Imagine ordering beef noodles and getting fried rice. It is cooked, but it is still the wrong order. Check which conditions the strategy actually traded before judging its returns.</p>
<h2>How is “crosses above” different from “is above”?</h2>
<p>A crossover is an event: the fast line was no higher than the slow line on the previous candle and is higher now. “Is above” is a state on the current candle. They can agree at one timestamp and diverge on the next.</p>
<p>Suppose the slow line stays at 100 across three candles while the fast line moves from 99 to 101 to 102. Put the two conditions side by side:</p>
<table><caption>Where do “is above” and “crosses above” differ?</caption><thead><tr><th>Time</th><th>Fast</th><th>Slow</th><th>Fast is above slow</th><th>Crosses above now</th></tr></thead><tbody><tr><td>A</td><td>99</td><td>100</td><td>No</td><td>No previous value supplied</td></tr><tr><td>B</td><td>101</td><td>100</td><td>Yes</td><td>Yes</td></tr><tr><td>C</td><td>102</td><td>100</td><td>Yes</td><td>No</td></tr></tbody></table>

<p>The fast line is above the slow line at both B and C, but the crossover happens only at B. If the program buys again at C, check which condition it used and whether repeat entries are allowed. Those records make the extra order much easier to explain.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/rules-inline-en-606db2c2c788.png" alt="For the assumed values in the table, the crossover happens at B. At C the fast line remains above, without another crossover." /></p>
<p><em>For the assumed values in the table, the crossover happens at B. At C the fast line remains above, without another crossover.</em></p>
<h2>What belongs in a trading-strategy specification?</h2>
<ul>
<li><strong>Data:</strong> market, timeframe, price field and closed versus unfinished candles.</li>
<li><strong>Entry:</strong> an event or a persistent state, equality behavior and repeated entries.</li>
<li><strong>Exit:</strong> stop conditions and priority when several exits trigger together.</li>
<li><strong>Size:</strong> allocation or risk-based sizing, maximum exposure and additional entries.</li>
<li><strong>Timing:</strong> signal time, order submission time and fill assumptions.</li>
<li><strong>Costs:</strong> fee and slippage settings, plus the evaluation start.</li>
</ul>
<p>Replace “add a little after a large drop” with a reference price, threshold, amount and maximum count. Unspecified choices should become questions to resolve, not silent changes to the strategy.</p>
<h2>Do timeframe, position size and fees need checking too?</h2>
<p>Yes. If you requested confirmation on a closed four-hour candle but the program uses hourly data, the trading schedule has already changed even if the crossover is correct. A fixed order amount and a fraction of account equity also create different exposure.</p>
<p>A blank fee field does not automatically mean zero fees. Check the effective rates, starting funds and fill assumptions used by that run; platforms can apply their own defaults. Save them with the strategy version so you can explain why two results differ.</p>
<h2>How do you validate AI-generated trading rules?</h2>
<ol>
<li><strong>Freeze the request.</strong> Save a dated version instead of overwriting the original.</li>
<li><strong>Map each rule to its implementation.</strong> Identify parameters, conditions and unresolved defaults.</li>
<li><strong>Write small cases with expected behavior.</strong> Include no entry, exact threshold, equality, an existing position and conflicting exits.</li>
<li><strong>Inspect events.</strong> Separate data timestamps, indicator values, conditions, orders and fills. Find the first disagreement.</li>
<li><strong>Repeat checks after a fix.</strong> Record the change and rerun previously correct cases.</li>
</ol>
<p>Start with a few candles you can work through yourself and check whether the trades match your rules. Then extend the backtest. There is no need to wait through years of data to find a mistake visible in a handful of candles.</p>
<h2>Can an AI debugging fix change the strategy?</h2>
<p>Sometimes the code is wrong; sometimes a condition was never fully specified. A fix that swaps an indicator or loosens a threshold also changes the strategy. You can make that change, but record it and check the new rules. Otherwise, what looks like a repaired program may be a different trading approach.</p>
<p>The QuantHarness paper examines research trajectories beyond final code, including specifications, data, repairs and execution evidence. Its useful lesson here is to retain the path to the answer.</p>
<h2>What comes after implementation checks?</h2>
<p>Evaluate which AI strategies deserve further testing, parameter-selection bias, costs and out-of-sample behavior. Correct rules and a useful trading edge are separate conclusions.</p>
<p>When you already have rules and backtest material, AlgoRover Research can help organize further research questions. Once the rules are checked, take the same strategy version and configuration into execution and inspect whether the order sequence matches your intent.</p>
<h2>Frequently asked questions</h2>
<h3>Is asking the same AI to review its code enough?</h3>
<p>It can help, but retain independently specified expected behavior and actual run evidence. Another reviewer can examine important assumptions without inheriting the same interpretation.</p>
<h3>Can I review code without checking trades?</h3>
<p>Code describes intended behavior; logs show this run's behavior. Data, timing and order settings can change the outcome, so compare both.</p>
<h3>Can I keep an AI parameter change if returns improve?</h3>
<p>Treat it as a new research candidate, record the change and validate it. Improved returns do not establish compliance with the original request.</p>
<h3>Does passing rule checks make a strategy live-ready?</h3>
<p>Data quality, costs, out-of-sample evidence and execution checks still matter. Implementation consistency is one gate.</p>
<h2>Check whether orders follow the rules</h2>
<p>Make “buy on the crossover” and “no repeat entry while holding” explicit, then run the reviewed version in a supported exchange Demo with AlgoRover Live. Inspect orders and positions to check whether entries happen when intended and whether unwanted repeat entries occur.</p>
<p>Continue checking execution with Live</p>
<h2>Sources</h2>
<ul>
<li>QuantHarness research paper</li>
<li>Full paper: research trajectories and evidence</li>
</ul>
<p>Not investment advice.</p>
]]></content:encoded></item><item><title><![CDATA[Partial Fills: How to Check Position Size, Remaining Orders and Stops]]></title><description><![CDATA[RISK MANAGEMENT Only 0.4 BTC filled, but the stop still assumes 1 BTC. Check confirmed fills and the cancellation outcome before deciding how much to buy…]]></description><link>https://algorover.hashnode.dev/partial-fills-position-stop-loss</link><guid isPermaLink="true">https://algorover.hashnode.dev/partial-fills-position-stop-loss</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Tue, 17 Nov 2026 01:22:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/73bc58c8-2d8c-4e3d-bbd7-93cb8c4a2777.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>RISK MANAGEMENT</p>
<p>Only 0.4 BTC filled, but the stop still assumes 1 BTC. Check confirmed fills and the cancellation outcome before deciding how much to buy next.</p>
<p>You submit an order for 1 BTC, receive 0.4 BTC, and discover that the stop still assumes a full bitcoin. You request a cancellation, then another fill arrives before confirmation. A single backtest trade has become several live events. How should the position, remainder and protection orders stay consistent?</p>
<h2>What is your position after a partial fill?</h2>
<p><strong>Check what has filled and what your account holds. The unfilled part may still execute.</strong> Suppose you have no BTC and place a spot order for 1 BTC, with no other orders or transfers. Leave fees deducted in BTC aside for now. The order could develop like this:</p>
<table><caption>You order 1 BTC. What happens after a partial fill?</caption><thead><tr><th>Event</th><th>Cumulative fill</th><th>Open quantity</th><th>Check</th></tr></thead><tbody><tr><td>First fill: 0.4 BTC</td><td>0.4 BTC</td><td>0.6 BTC</td><td>Position and protection size</td></tr><tr><td>Cancellation requested</td><td>Use confirmed records</td><td>Cancellation not yet confirmed</td><td>Any additional fills</td></tr><tr><td>Another 0.2 BTC fills</td><td>0.6 BTC</td><td>0.4 BTC</td><td>Average price and protection</td></tr><tr><td>Remaining 0.4 BTC cancellation confirmed</td><td>0.6 BTC</td><td>0</td><td>Final account and order state</td></tr></tbody></table>

<p>Canceling an order does not reverse completed fills. It is like canceling the unshipped part of a delivery: what already arrived remains yours. A cancellation request and its final confirmation are separate events.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/fills-inline-en-6ba5c25ace1f.png" alt="For the 1 BTC order described above, cancellation leaves the filled 0.6 BTC held. Only the remaining 0.4 BTC is canceled." /></p>
<p><em>For the 1 BTC order described above, cancellation leaves the filled 0.6 BTC held. Only the remaining 0.4 BTC is canceled.</em></p>
<h2>How should you size a stop after partial fills?</h2>
<p>Check net holdings, available quantity and existing protection orders first, then apply the venue's rules. Owning 0.4 BTC does not make the intended 1 BTC available to sell. If cumulative fills rise to 0.6 BTC, reassess the covered quantity.</p>
<p>An oversized spot sell can be rejected or constrained by balance and other open orders. Derivatives also require checking position mode, direction and any reduce-only or close-on-trigger settings. Changing a quantity field alone does not prove that protection became active.</p>
<p>Track whether the old protection remains active, whether its replacement was accepted and whether new fills arrived during the change. “Request submitted” is not the same as a final order state.</p>
<h2>How much should you reorder after canceling a partial fill?</h2>
<p>Confirm the remainder's final state first, then calculate <strong>original target quantity minus final cumulative fills</strong>. Suppose the target was 1 BTC, final fills total 0.6 BTC and the remainder is canceled. You are 0.4 BTC short of the original target. Placing another full 1 BTC order could take total purchases to 1.6 BTC.</p>
<p>Bybit's cancel-order documentation also distinguishes acceptance of a cancellation request from the final order state. Check for late fills before deciding whether to buy more, and reassess the stop quantity against actual holdings.</p>
<h2>How do GTC, IOC and FOK affect a remainder?</h2>
<ul>
<li><strong>GTC:</strong> the unfilled portion generally remains open until filled, canceled or otherwise terminated under venue rules.</li>
<li><strong>IOC:</strong> execute what is immediately available and cancel the remainder.</li>
<li><strong>FOK:</strong> fill the entire order immediately or cancel it.</li>
</ul>
<p>Availability depends on market and order type. FOK can avoid an incomplete individual order by allowing no fill at all. It does not create liquidity.</p>
<h2>How do partial fills change average entry and risk?</h2>
<p>Suppose you buy 0.4 BTC at 60,000 USDT, then 0.2 BTC at 60,100 USDT. You spend 36,020 USDT for 0.6 BTC. Divide 36,020 by 0.6 and your average entry is about 60,033.33 USDT. The larger first fill carries more weight in that average.</p>
<p>At a reference stop price of 59,000 USDT, the price-gap risk is 36,020 − 0.6 × 59,000 = 620 USDT, before fees and any difference in the actual stop fill. Assess the position already held, then consider the exposure if the remaining order fills.</p>
<p>Existing holdings, sell fills or fees charged in the base asset change this simple purchase example. Reconcile the actual account rather than reusing its numbers.</p>
<h2>Why can a backtest fill an order that live trading only partly fills?</h2>
<p>A candle touching a price does not establish your queue position or sufficient opposing quantity. QuantConnect documents that its prebuilt backtest fill models assume complete fills, whereas live orders can fill partially; modeling partial fills requires an appropriate custom model.</p>
<p>Try checking what the program does when an order fills completely, fills partly or does not fill at all. Follow both the remainder and the exit. This is especially useful with narrow stops or fast entries: the position you planned and the one you actually hold can differ from the first trade.</p>
<h2>Which records make a fill sequence explainable?</h2>
<p>Retain order IDs, original quantity, time-in-force, individual fill quantities and prices, fees, change requests and final confirmations. Put events in order and establish the actual position before discussing another order.</p>
<p>If an order still has no fill report, continue with submitted versus filled orders. To estimate the funding and risk associated with a position first, use the spot position-size calculator.</p>
<h2>Frequently asked questions</h2>
<h3>Does canceling the remainder undo completed fills?</h3>
<p>No. Completed fills still establish holdings. Confirm the cancellation and inspect any fills that arrived before it completed.</p>
<h3>Can I resend the original order size after a partial fill?</h3>
<p>Reconcile cumulative fills and the original remainder first. Resending the full quantity can exceed the intended position.</p>
<h3>Is a stop matching the filled quantity always sufficient?</h3>
<p>Check existing positions, fee deductions, available balances, other protection orders and venue-specific direction and size rules.</p>
<h3>Does a paper partial fill predict live fill rates?</h3>
<p>Read the simulator's rules. Simulated events can test handling logic without reproducing real queue position, market impact or available quantity.</p>
<h2>Check fills and open orders before ordering again</h2>
<p>After a partial fill, ask the AI assistant in AlgoRover Live to inspect existing orders and positions. Establish how much filled and whether the remainder is still open before deciding whether to buy more or adjust a stop.</p>
<p>See how to inspect orders and positions in Live</p>
<h2>Sources</h2>
<ul>
<li>QuantConnect: trade fills</li>
<li>QuantConnect: order events</li>
<li>Bybit: GTC, IOC and FOK</li>
</ul>
<p>Not investment advice.</p>
]]></content:encoded></item><item><title><![CDATA[Your Strategy Is Suddenly Profitable. Real Edge or Market Luck?]]></title><description><![CDATA[BACKTEST VALIDATION A hot streak can make a strategy look smarter than it is. Trace the gains, compare the conditions, and turn the result into a focused…]]></description><link>https://algorover.hashnode.dev/trading-edge-or-market-regime</link><guid isPermaLink="true">https://algorover.hashnode.dev/trading-edge-or-market-regime</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sat, 14 Nov 2026 01:37:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/9fc826de-6f12-418a-8a3e-78e6f0afb5db.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>BACKTEST VALIDATION</p>
<p>A hot streak can make a strategy look smarter than it is. Trace the gains, compare the conditions, and turn the result into a focused research plan.</p>
<p>Your strategy suddenly starts making much more money, and the obvious thought is: have I finally found an edge? Start by tracing where the profits came from, then check whether the same rules hold up on data they were not tuned on. A favorable market can help a good strategy—but one hot streak cannot tell you how much credit belongs to the strategy.</p>
<p>Brand update: EdgePilot is now AlgoRover. Historical screenshots retain the former name; use the AlgoRover website for current installation instructions.</p>
<p>That is a useful starting point for AlgoRover Research: ask the question in plain English, inspect the available strategy evidence, and put an impressive return back into its test period and trading conditions. The goal is to turn excitement into a specific next test.</p>
<h2>The same profit can tell two very different stories</h2>
<p>Imagine a trend-following strategy that does well during a sustained rally but takes repeated small losses when prices move sideways. The final equity curve looks strong. Break it into periods, though, and most of the profit comes from that one directional move.</p>
<p>That does not automatically make it a bad strategy. Trend following can earn much of its return during a few persistent trends. The question is whether rules set in advance captured the move, or whether the parameters were chosen because they fitted a rally that had already happened. The first deserves further testing; the second needs a fresh stretch of data that played no part in tuning.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/regime-wave.en-US.png" alt="The EdgePilot mascot rides a market rally, then removes the wave to examine the strategy without that tailwind." /></p>
<p><em>Separate the most favorable market period to see where the profits are concentrated.</em></p>
<p>Removing the best market period is a stress check, not a pass-or-fail formula. If returns drop, you have learned something about the conditions the strategy depends on. Next, look for similar behavior when those conditions occur in a different sample.</p>
<h2>Once you find the tailwind, check three things</h2>
<ol>
<li><strong>How concentrated are the profits?</strong>Break returns down by period and trade. How much came from the best stretch or a handful of big winners? Keep the original result alongside the comparison with those gains removed, so the exercise does not become another way to cherry-pick.</li>
<li><strong>What did the strategy add beyond a simple benchmark?</strong>For a BTC trend strategy, compare it with buying and holding BTC over the same dates. Look at drawdown, time in the market, and trading costs, not just the higher return. More profit may also mean more risk.</li>
<li><strong>Do the rules hold up outside the tuning period?</strong>Freeze the parameters and test on historical periods or subsequent data that were not used to select them. Compare similar market conditions and record the environments where the strategy struggles. For the testing sequence, see this guide to rolling validation and cross-validation.</li>
</ol>
<p>A genuine edge does not have to make money in every market. AQR’s long-run study of trend following examines a much longer history and multiple markets to investigate robustness. Apply the same research instinct to your own strategy: move from “it worked here” toward evidence across separate samples, rather than demanding an equity curve that never dips.</p>
<p>The checklist is simple. Keeping the evidence straight is the tedious part. Which parameter version produced this screenshot? Do the reports cover the same dates? Were costs treated consistently? Each change sends you back through reports and notes, and it is easy to compare results that were never measured on the same basis.</p>
<h2>Bring that question to AlgoRover Research</h2>
<p>AlgoRover Research brings strategy discovery, public evidence, and historical backtesting into an AI conversation. Start by clarifying what to investigate, then bring a specific report into the same exchange. Instead of hunting through scattered material, you have a clearer order of checks.</p>
<p>After enabling the official AlgoRover Research plugin through the setup guide, you can ask:</p>
<blockquote>
<p>Use AlgoRover Research to help me check this: my strategy suddenly started making much more money. Is that a real edge, or did it just catch the right market?</p>
</blockquote>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/regime-conversation.en-US-1.png" alt="Real English EdgePilot Research conversation: the user asks whether a sudden profit jump reflects an edge or favorable market conditions; the reply sets out six research checks." /></p>
<p><em>The actual question and complete response turn a sudden profit jump into a sequence of research checks.</em></p>
<p>The reply breaks the question into profit concentration, market conditions, untouched data, nearby parameters, benchmark exposure, and trading costs. It then asks for the before-and-after periods, performance figures, trade count, settings, and market details to investigate the change. These are research checks to apply to the report; removing the biggest winners, for example, reveals concentration rather than proving on its own that an edge is absent.</p>
<p>“This looks almost too good” becomes a concrete research path. Add the backtest report to the same conversation and continue with the same strategy context, instead of explaining everything again from scratch.</p>
<h3>Put an annualized return back into its actual test period</h3>
<p>The screenshot below preserves the former ADX Volume Dynamic Trend strategy’s public historical simulation, with cumulative return, annualized return, test length, and order count shown together. That strategy detail has not moved to the new website; for the current evidence format, see the AlgoRover evidence guide.</p>
<p><img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/regime-evidence.en-US.png" alt="ADX Volume Dynamic Trend public historical simulation: 23.22% cumulative return, 133.37% annualized return, 90-day test, and 8 orders." /></p>
<p><em>EdgePilot public strategy details: historical simulation ending September 1, 2026.</em></p>
<p>The reported cumulative return is <strong>23.22%</strong>, the annualized return is <strong>133.37%</strong>, and the test covers <strong>90 days</strong>. Annualization expresses the rate of return on a yearly basis; the observations still come from that 90-day window.</p>
<p>That makes the next step clearer: establish what the sample covers, then plan tests on other periods. You are looking at more than a large annualized number—you have a research record whose source, conditions, and results you can inspect.</p>
<h3>Keep the next test as a record you can revisit</h3>
<p>Once you find a strategy worth investigating, AlgoRover Research can run historical backtests on supported, reviewed research packages in a compatible research environment. The run retains the strategy version, parameters, market and fee configuration, and results, giving you a reference when conditions change.</p>
<p>For a strategy with a sudden profit jump, the next test can answer one focused question: with the current rules frozen, what happens to return and drawdown on data that was not used for tuning? Put the results side by side, then decide what to investigate next. That is more useful than chasing a bigger headline return.</p>
<p>From finding a strategy and inspecting its existing evidence to running historical tests and reviewing the results, AlgoRover Research helps turn a promising idea into an evidence-based investigation. Start with what you want to understand; you do not need to master every research term before asking.</p>
<p>Have an equity curve that suddenly looks a little too good? Try AlgoRover Research and investigate what is driving the gains. Bring the strategy and backtest report, and start with the question you most want answered.</p>
<p>If the profit jump appeared only after repeated tuning, check whether the winning parameter set deserves your confidence. If the gains survive that check, revisit whether the exchange fits the strategy’s execution needs.</p>
<p>This article is for strategy research and software education. The strategy figures are public historical simulation results for a specific version and period. Research analysis and historical performance do not guarantee future returns.</p>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[Why Does My Backtest Barely Make Money After Trading Costs?]]></title><description><![CDATA[TRADING COSTS A trade earns 12 basis points before costs. Fees, the spread, and slippage leave just 1. Here’s how to check what your backtest actually…]]></description><link>https://algorover.hashnode.dev/why-trading-costs-wipe-out-backtest-profits</link><guid isPermaLink="true">https://algorover.hashnode.dev/why-trading-costs-wipe-out-backtest-profits</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sat, 14 Nov 2026 01:37:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/d8a317e9-f8f4-4a69-b2ff-fde65182cccd.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>TRADING COSTS</p>
<p>A trade earns 12 basis points before costs. Fees, the spread, and slippage leave just 1. Here’s how to check what your backtest actually includes.</p>
<p>A backtest can look profitable until you add the trading costs it left out. When each trade earns very little, fees, the bid–ask spread, and slippage can eat most of the profit—and trading more often repeats the bill. So where did the money go? Start with one trade, then check how the backtest accounted for each cost.</p>
<p>The final return alone won't tell you what was included. You need to look at the assumptions behind the fills and the costs already deducted from the result.</p>
<h2>Start with the math on one trade</h2>
<p>Suppose a strategy earns 12 basis points before costs on a round-trip trade. A basis point is 0.01%, so that's a gross return of 0.12%. Opening and closing the position costs 6 basis points in fees, and the spread and slippage cost another 5. That leaves just 1 basis point, or 0.01%.</p>
<p>All three figures use the same trade notional as their denominator. These are illustrative assumptions, not standard charges for a particular market.</p>
<table style="min-width:75px"><colgroup><col style="min-width:25px"></col><col style="min-width:25px"></col><col style="min-width:25px"></col></colgroup><tbody><tr><td><p></p></td><td><p></p></td><td><p>The cost of one round-trip trade</p></td></tr><tr><th><p>ITEM</p></th><th><p>CHANGE</p></th><th><p>RETURN REMAINING</p></th></tr><tr><td><p>Return before costs</p></td><td><p>+12 basis points</p></td><td><p>12 basis points</p></td></tr><tr><td><p>Entry and exit fees combined</p></td><td><p>−6 basis points</p></td><td><p>6 basis points</p></td></tr><tr><td><p>Spread and slippage</p></td><td><p>−5 basis points</p></td><td><p>1 basis point</p></td></tr></tbody></table>

<p>That 12-basis-point gain was never all yours to keep. Under these assumptions, only 1 basis point survives. A slightly worse fill could wipe it out.</p>
<img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/costs-mechanism-en-v1.png" alt="Trading costs weigh against gross profit" style="display:block;margin:0 auto" />

<p><em>Small costs add up each time you trade.</em></p>
<p>The example shows how a small profit gets squeezed. To work out whether your strategy still has an edge, you need to trace each deduction.</p>
<h2>Check where the costs enter the backtest</h2>
<ol>
<li>Separate trading fees, the bid–ask spread, slippage, funding, and any applicable borrowing or financing costs.</li>
<li>Compare a baseline with more typical and stressed cost assumptions. Look at how much room the strategy has before its profit disappears.</li>
<li>Check costs against traded value and turnover, rather than relying on win rate.</li>
<li>Check whether the backtest fills limit orders too generously.</li>
</ol>
<p>Count each cost once. If a cost is already reflected in the simulated fill price or deducted from the reported return, don't subtract it again. For example, if your slippage setting already accounts for the spread, adding the same spread separately would double-count it. TradingView's broker emulator documentation explains its commission and slippage settings, including the use of slippage to account for the spread.</p>
<h3>Small slippage still needs evidence</h3>
<p>What if you trade a liquid market, keep positions small, and use limit orders? Slippage may be less significant, especially for a low-turnover strategy. But check fills or order-book data before treating it as zero. “Probably small” is an assumption worth testing.</p>
<p>For a closer look at the individual costs, read how trading fees eat into profit and how slippage changes a backtest. Then bring both back into the same calculation.</p>
<h3>How much of the edge do costs consume?</h3>
<p>Compare the average all-in cost per completed trade with its average profit before costs. Use the same trades, currency, and cost definitions for both figures.</p>
<p><strong>Share of gross profit consumed = average cost per trade ÷ average gross profit per trade × 100%.</strong></p>
<p>In the example, costs consume 11 ÷ 12 × 100% ≈ 91.7% of the gross profit. Only 8.3% remains. That leaves very little room for worse execution.</p>
<p>This comparison assumes average gross profit is positive. If it is zero or negative, the strategy already needs attention before costs. If costs look implausibly large, check for duplicate deductions or a percentage-versus-basis-point error before blaming the strategy.</p>
<h3>Run a small, controlled comparison</h3>
<p>Keep the current code, parameters, and data version fixed, and save the order or trade records. Change one cost assumption at a time, then compare the result with the original. If a small, plausible change turns a profit into a loss, the strategy needs more testing before you commit real money.</p>
<p>That answers the question for one version. Change the parameters, market, or timeframe, and you need to check again. The time-consuming part is keeping the assumptions consistent as the strategy changes.</p>
<h2>Make the next cost check easier</h2>
<p>Calculating a fee once is straightforward. Keeping track of which fee assumptions went with which backtest is where things get messy. With spreadsheets and screenshots, it's easy to lose track of what changed between runs.</p>
<p>Brand update: EdgePilot is now AlgoRover. Historical screenshots retain the former name; use the AlgoRover website for current installation instructions.</p>
<h3>Bring the question to AlgoRover Research</h3>
<p>AlgoRover Research helps you keep the strategy version, test conditions, and cost evidence in the same research workflow. That gives you a consistent starting point for comparing results after costs, instead of piecing the assumptions together again each time.</p>
<p>Install and enable AlgoRover Research in your AI workspace, then start with a question like this:</p>
<blockquote>
<p>Use AlgoRover Research to help me figure out why this backtest barely makes money once all trading costs are included.</p>
</blockquote>
<img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/costs-research-conversation-en-v1.png" alt="EdgePilot screenshot" style="display:block;margin:0 auto" />

<p><em>EdgePilot screenshot</em></p>
<p>AlgoRover points to the relationship between profit per trade and trading frequency, then separates fees, spread and slippage, and funding into things to check. It also flags accounting mistakes such as counting a fee twice or mixing up percentages and basis points.</p>
<p>The next step is to provide the backtest report: profit before and after costs, trade count, fees, slippage assumptions, and funding charges. That turns the initial explanation into a check of your own numbers.</p>
<table>
<thead>
<tr>
<th>WHAT YOU BRING</th>
<th>WHAT ALGOROVER HELPS CHECK</th>
<th>YOUR NEXT DECISION</th>
</tr>
</thead>
<tbody><tr>
<td>Gross and net results, plus trade count</td>
<td>How much profit costs consume per trade</td>
<td>Whether the remaining margin warrants more testing</td>
</tr>
<tr>
<td>Fee settings and fill assumptions</td>
<td>Missing costs, double-counting, and unit mismatches</td>
<td>Which assumption to correct first</td>
</tr>
<tr>
<td>A fixed strategy version and comparable runs</td>
<td>How results change under different cost assumptions</td>
<td>Which comparison to run next</td>
</tr>
</tbody></table>
<h3>Use the details to follow up</h3>
<p>When reviewing a catalog strategy, start with its description, test period, return, and drawdown. The strategy-detail panel below is from AlgoRover Live. It shows the published summary you can use as a starting point before checking the underlying cost assumptions.</p>
<img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/09/costs-dashboard-en-v1.png" alt="EdgePilot screenshot" style="display:block;margin:0 auto" />

<p><em>EdgePilot screenshot</em></p>
<p>Keep the strategy summary alongside the detailed report. The useful comparison is between the costs assumed in the test and the costs relevant to the way you plan to trade.</p>
<h3>Turn the findings into your next test</h3>
<p>AlgoRover Research helps turn a vague question about returns into specific cost assumptions you can investigate:</p>
<ul>
<li>Check what the reported return includes. A profit factor is a ratio, not an amount of net profit.</li>
<li>Identify any missing fee, spread, slippage, or funding assumptions.</li>
<li>Rerun parameter comparisons on the same cost basis to see how much margin remains.</li>
</ul>
<p>If you regularly change parameters, markets, or timeframes, keeping the questions and cost records together makes those comparisons easier to repeat. You can check whether the strategy still has room to work before spending more time tuning it.</p>
<p>Research is the place to work through historical results. When you're ready to test execution, AlgoRover Live extends the workflow to local paper trading, exchange demo environments, and live trading.</p>
<p>Have a backtest you're working on? Save the current version and its cost assumptions, then give AlgoRover Research a try. Start with one question: after every cost is accounted for, what's left?</p>
<p>The AlgoRover Research overview explains the historical-testing workflow and the reports you can keep for comparison.</p>
<p>If costs leave almost no margin, check whether repeated tuning produced a fragile winner. If the gap appears only after switching venues, compare the rules and execution conditions of the same grid.</p>
<h2>Sources</h2>
<ul>
<li>TradingView: Broker emulator</li>
<li>CFTC: Commodity Trading Systems Sold on the Internet</li>
</ul>
<p><em>This article is for trading research and software-testing education, not investment advice. The figures are illustrative and explain the calculation method.</em></p>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[One losing trade, two P&L figures. Where did the difference come from?]]></title><description><![CDATA[TRADING COSTS Match the fills before comparing profit figures. In this OKX case, opening and closing fees explain most of a roughly 2 USDT difference…]]></description><link>https://algorover.hashnode.dev/exchange-pnl-reconciliation-chat-en</link><guid isPermaLink="true">https://algorover.hashnode.dev/exchange-pnl-reconciliation-chat-en</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sat, 14 Nov 2026 01:36:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/89633621-788d-48bd-b522-6acc8abdb212.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>TRADING COSTS</p>
<p>Match the fills before comparing profit figures. In this OKX case, opening and closing fees explain most of a roughly 2 USDT difference between the exchange and workbench.</p>
<p>The same trade shows a loss of about 112.86 USDT on one screen and 114.87 USDT on another. Match the underlying fills first, then check whether each figure includes trading fees and funding. In this OKX case, two fee entries explain most of the roughly 2 USDT difference.</p>
<p>A trading bot, an exchange and a strategy workbench can use different definitions for realized P&amp;L and net P&amp;L. When comparing AlgoRover records with the exchange, match the contract, fill identifiers and reporting period before separating price P&amp;L, costs and any remaining difference.</p>
<h2>Which fills belong to each P&amp;L figure?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/bf6678f5-e34e-4285-8d01-262492f10765.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Match the transactions before explaining the gap</strong></p>
<p>Two pages labeled profit can include different accounting items. Once the fill set matches, the difference can be broken down. In the source case, fill-by-fill price P&amp;L was approximately −112.8504 USDT.</p>
<h2>How do opening and closing fees change net P&amp;L?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/62dfeb38-a626-4c23-9419-82345762708c.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Attach each part of the difference to an account entry</strong></p>
<p>Check the opening and closing fee records separately. Look up funding independently and compare whether each page includes it. For another trade, use that trade's actual charges.</p>
<img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/pnl-receipt-explain-en.png" alt="P&amp;L waterfall: −112.8504 USDT of price P&amp;L, less 2.02308 USDT of fees, gives −114.87348 USDT." style="display:block;margin:0 auto" />

<p><em>Case breakdown: the small green fee segment takes price P&amp;L down to the net result shown here.</em></p>
<h2>What if a small difference remains after reconciliation?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/a7a24d2b-7e68-4ea1-8624-8108fa52b45a.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Keep full precision through the calculation</strong></p>
<p>Rounding every intermediate value makes the final difference harder to trace. Keep source precision until the final display step.</p>
<h2>Ask AI to reconcile fills, fees and funding</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/9c348359-48f4-41bb-b384-b31309b32350.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Give each figure its own ledger</strong></p>
<p>Scope, fills, costs and precision provide four concrete places to investigate the next mismatch.</p>
<h2>Trading profit, fees and reconciliation: common questions</h2>
<h3>Does trading bot profit always include fees?</h3>
<p>Read the page's definition. A figure may show price P&amp;L alone or include opening fees, closing fees and funding. List the accounting items on both sides before comparing.</p>
<h3>Can I compare realized P&amp;L directly with net P&amp;L?</h3>
<p>Match completed fills and check each page's fee and funding treatment. Keep unrealized position P&amp;L, realized price P&amp;L and the result after costs separate.</p>
<h3>Should I deduct slippage after using actual fill prices?</h3>
<p>Slippage is the difference between expected and actual execution prices. Actual fill prices already reflect that price effect. Deducting an additional estimated slippage amount would count it twice; actual fees and funding remain separate entries.</p>
<h3>What records do I need to reconcile OKX closed-position P&amp;L?</h3>
<p>Use the same contract and period, with fill IDs, actual prices, quantities, contract units, fees and fee currencies. Match those with the workbench records, preserve precision and keep any unresolved residual visible.</p>
<h2>Read next</h2>
<p>How trading fees affect profit</p>
<p>Why costs can erase a backtest's profit</p>
<p>Explore AlgoRover Live</p>
<h3>Sources</h3>
<p>OKX: trading fee rules</p>
<p>QuantConnect: expected prices, fills and slippage</p>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item><item><title><![CDATA[5,000 USDT in the account, 3× leverage. Why is the order only 750 USDT?]]></title><description><![CDATA[RISK MANAGEMENT The sizing formula determines notional exposure; exchange leverage affects margin requirements. Follow a 750 USDT position and 250 USDT…]]></description><link>https://algorover.hashnode.dev/leverage-order-size-chat-en</link><guid isPermaLink="true">https://algorover.hashnode.dev/leverage-order-size-chat-en</guid><dc:creator><![CDATA[collaboration]]></dc:creator><pubDate>Sat, 14 Nov 2026 01:36:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/86f69b79-035f-43d7-be3e-9267ae6a199e.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>RISK MANAGEMENT</p>
<p>The sizing formula determines notional exposure; exchange leverage affects margin requirements. Follow a 750 USDT position and 250 USDT basic margin example.</p>
<p>Your account holds 5,000 USDT and leverage is set to 3×, yet the order is only 750 USDT. Start with two calculations: the strategy's position sizing formula determines order notional, while exchange leverage affects initial margin. Mixing those numbers hides how much exposure is actually in the market.</p>
<p>A position percentage needs a defined base. Notional exposure measures the amount participating in price changes; initial margin measures the basic collateral required to open it. When checking an AlgoRover order, list account equity, available balance, the sizing formula and exposure limits together.</p>
<h2>What does the strategy multiply by its 5% sizing setting?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/c3332bc1-281a-4aaf-83da-32776f2f7945.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Check the formula before judging the order size</strong></p>
<p>A position percentage can refer to equity, margin or available funds. Ask which account field supplies each input and which revision uses it.</p>
<h2>Why can 750 USDT of exposure use 250 USDT of basic margin?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/ffa63e2f-5fa9-4319-8c79-b897610b8176.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Collateral and market exposure answer different questions</strong></p>
<p>750 USDT describes the position's sensitivity to price changes. 250 USDT is its basic margin in this example. Also account for other positions and orders when checking available funds.</p>
<img src="https://storage.ghost.io/c/6d/bb/6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f/content/images/2026/11/leverage-receipt-explain-en.png" alt="Price change versus P&amp;L for 750 and 250 USDT notional positions. At a 1% price rise, price P&amp;L is 7.5 and 2.5 USDT respectively." style="display:block;margin:0 auto" />

<p><em>Illustrative example: a 1% price rise produces 7.5 USDT on 750 USDT notional, three times the 2.5 USDT on 250 USDT notional.</em></p>
<h2>Does raising exchange leverage automatically increase the position?</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/15298b9d-799e-4c72-ac3c-d2806fc328b8.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Express the exposure limit as a checkable amount</strong></p>
<p>Record single-order notional as a share of equity, total same-direction exposure and the price move's P&amp;L effect. These are more concrete than calling a position small.</p>
<h2>Ask AI to trace order size, margin and total exposure</h2>
<img src="https://cdn.hashnode.com/uploads/covers/6aea80666348bf9926c8af53/97ce5c39-b20a-47aa-b04f-b81c500adbea.jpg" alt="Original figure" style="display:block;margin:0 auto" />

<p><strong>Keep one complete calculation</strong></p>
<p>Repeat the same calculation after changing the strategy, contract or exchange. Each parameter change then has a clear numerical target.</p>
<h2>Position sizing and leverage: common questions</h2>
<h3>What is the difference between position percentage and margin percentage?</h3>
<p>A position percentage may refer to notional exposure, equity allocation or an order budget, depending on the strategy. Margin percentage describes collateral usage. Check the field definition and exchange leverage separately.</p>
<h3>Should position sizing use equity or available balance?</h3>
<p>Use the base defined in the current strategy. Equity measures overall account value; available balance also reflects reservations for positions, orders and costs. Verify the actual field read by the formula.</p>
<h3>Why doesn't 3× leverage put the entire account into the trade?</h3>
<p>Exchange leverage affects margin requirements. The strategy's order fraction, capital base, existing positions and exposure limits also determine trade size. Calculate actual notional exposure to see the amount affected by price changes.</p>
<h3>Should an exposure limit include unfilled orders?</h3>
<p>Check whether the implementation includes pending opening orders and accumulated entries. Existing positions and relevant orders affect whether another order can be placed and how much size remains.</p>
<h2>Read next</h2>
<p>Compare costs, returns and drawdown in a backtest</p>
<p>What to confirm before live trading</p>
<p>Explore AlgoRover Live</p>
<h3>Sources</h3>
<p>QuantConnect: position weights, leverage and buying power</p>
<p>NEXT STEP</p>
<h2>Test the strategy yourself</h2>
<p>Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.</p>
<p>Try AlgoRover Research Follow us on X Follow us on Reddit</p>
]]></content:encoded></item></channel></rss>