<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AlgoRover</title>
    <description>The latest articles on DEV Community by AlgoRover (@algorover).</description>
    <link>https://dev.to/algorover</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4223274%2F4a904bda-1080-4a55-be15-d3208c1fd96c.png</url>
      <title>DEV Community: AlgoRover</title>
      <link>https://dev.to/algorover</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/algorover"/>
    <language>en</language>
    <item>
      <title>Keltner Channel Strategy: Buy the Breakout or Wait for a Pullback?</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:33:21 +0000</pubDate>
      <link>https://dev.to/algorover/keltner-channel-strategy-buy-the-breakout-or-wait-for-a-pullback-2gm4</link>
      <guid>https://dev.to/algorover/keltner-channel-strategy-buy-the-breakout-or-wait-for-a-pullback-2gm4</guid>
      <description>&lt;span&gt;Strategy Analysis&lt;/span&gt; &lt;p&gt;An upper-band touch does not tell you whether to buy. Follow one complete Keltner breakout, see what the settings change, and check the orders after the signal.&lt;/p&gt;   &lt;p&gt;Price reaches the upper Keltner band. Do you buy now or wait for a pullback? Buying a breakout aims to catch further gains; waiting for a pullback aims for a lower entry during an uptrend. Decide which opportunity you want to trade, then define when to buy and when to sell.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;A Keltner channel’s middle line follows average price, while ATR sets the distance to the outer lines. An upper-band touch tells you where price has reached; your trading rules still decide when to buy and sell.&lt;/strong&gt; Following one trade from entry to exit makes that distinction easier to see.&lt;/p&gt; &lt;h2&gt;What are the three Keltner channel lines?&lt;/h2&gt; &lt;p&gt;Think of the channel as a running track that moves along with price. The middle line marks its center, with a boundary drawn on each side. When recent price swings grow, the track widens; when they shrink, it narrows. These are painted reference lines, so price can cross them. You still need to see what it does afterward.&lt;/p&gt; &lt;p&gt;Suppose you’re looking at four-hour candles with a 20-period EMA of closes down the middle and a 10-period ATR measuring volatility. Place each outer band twice that ATR away from the EMA: add it for the upper band and subtract it for the lower. &lt;span&gt;TradingView’s KC settings&lt;/span&gt; let you adjust these inputs separately. If another platform draws different lines, start by checking whether it uses the same calculation.&lt;/p&gt; &lt;p&gt;EMA is an average that pays more attention to recent prices. A fresh move affects it more, while the influence of older prices gradually fades. ATR measures the size of price movements and averages them across candles.&lt;/p&gt; &lt;p&gt;Suppose the previous candle closed at 100, and the next candle has a low of 105 and a high of 106. Its own high-to-low range is only 1, but price jumped above 105 from that earlier close of 100. Its true range is 6. ATR includes that gap, and ATR 10 averages those movements over time.&lt;/p&gt; &lt;p&gt;Suppose the EMA is 100 USDT and ATR is 1.5 USDT after a candle closes. The upper band is 103 and the lower band is 97. That gives you reference levels. Deciding what happens when price reaches them is a separate rule.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fkeltner-lines-en-1.png" alt="Assumed four-hour candles with EMA20 in black, the upper band in green and the lower in blue; an arrow shows that the upper half-width equals twice ATR10." width="800" height="661"&gt;All three lines are calculated candle by candle from the same assumed OHLC data. EMA supplies the center; ATR changes the distance to each boundary. &lt;h2&gt;Should you buy when price touches the upper band?&lt;/h2&gt; &lt;div class="table-wrapper-paragraph"&gt;Two entry ideas wait for different price behavior&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Your aim&lt;/th&gt;
&lt;th&gt;What else must happen?&lt;/th&gt;
&lt;th&gt;What can get confused?&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Follow an upward breakout&lt;/td&gt;
&lt;td&gt;For example, wait for a close crossing above the upper band while the middle line rises&lt;/td&gt;
&lt;td&gt;An intrabar touch happens before a confirmed close&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Buy a pullback in an uptrend&lt;/td&gt;
&lt;td&gt;Define the pullback level and the recovery condition, such as returning near EMA and closing back above it&lt;/td&gt;
&lt;td&gt;Falling back inside the channel alone does not complete an entry rule&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;If you buy because you expect a breakout to keep going, then sell at the upper band, two different ideas are driving the same trade. Write down what you are waiting for before buying and what would make you sell. Changing one of those decisions at a time makes the difference easier to track.&lt;/p&gt; &lt;h2&gt;A Keltner channel strategy: confirm at the close, order next bar&lt;/h2&gt; &lt;p&gt;Suppose you want to buy a spot breakout, one unit at a time, with enough cash available and no additions while holding. Two decisions still need an answer: what counts as a breakout, and what makes you sell afterward?&lt;/p&gt; &lt;ol&gt;
&lt;li&gt;Let the historical data produce valid EMA 20 and ATR 10 values before checking an entry.&lt;/li&gt;
&lt;li&gt;While you hold no units, look for a previous close that had not exceeded its upper band, followed by a close strictly above its current upper band. The middle line must also be higher than it was on the previous candle.&lt;/li&gt;
&lt;li&gt;Wait for the next candle to begin before submitting the buy. Assume a fill at its opening price, before fees.&lt;/li&gt;
&lt;li&gt;Once you own the unit, wait for a close below the middle line, then submit the sell at the next candle’s start. A close exactly on the line leaves you holding.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;Each comparison waits for the candle to finish. If you have used a &lt;span&gt;Donchian breakout rule&lt;/span&gt;, remember that its upper line uses a period’s highest price. A Keltner upper line uses EMA plus ATR, so copying the entry condition across needs care.&lt;/p&gt; &lt;p&gt;In our assumed prices, candle 23 closes at 102, below its upper band of about 103.02. Candle 24 closes at 104, above its band of about 103.68, while EMA is rising. The entry signal is now valid. At the start of candle 25, assume one unit fills at 104.2 USDT. The signal close of 104 was not the fill.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fkeltner-trade-en-2.png" alt="A complete assumed Keltner trade: candle24 confirms the breakout, candle25 fills at104.2, candle32 closes below EMA, and candle33 exits at100.2." width="800" height="661"&gt;Separate arrows identify closing signals and next-bar assumed fills. The band and EMA update through time; entry and exit use the same price scale. &lt;p&gt;Price later reaches around 109, but the rule keeps holding because it waits for a close below the middle line. Candle 32 closes at 102, below EMA at about 103.62. Assume an exit at 100.2 at the start of candle 33. You paid 104.2 and received 100.2, losing 4 USDT on one unit before fees. A profit shown during the trade can disappear before you sell.&lt;/p&gt; &lt;p&gt;This rule waits for closes. A mid-candle move through EMA does not immediately close the position. Adding a fixed stop or an intrabar protective order requires an explicit trigger, order type and treatment of the event sequence within a candle.&lt;/p&gt; &lt;h2&gt;Keltner channel settings: what does each parameter change?&lt;/h2&gt; &lt;div class="table-wrapper-paragraph"&gt;Keep the four-hour interval and other rules fixed; change one setting&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Smaller&lt;/th&gt;
&lt;th&gt;Values shown&lt;/th&gt;
&lt;th&gt;Larger&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EMA length&lt;/td&gt;
&lt;td&gt;10: the middle follows recent prices more closely&lt;/td&gt;
&lt;td&gt;20: checks direction and when to sell&lt;/td&gt;
&lt;td&gt;40: one new close moves the middle less&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ATR length&lt;/td&gt;
&lt;td&gt;5: a new large move has more influence&lt;/td&gt;
&lt;td&gt;10: each update gives the new true range one-tenth of the weight&lt;/td&gt;
&lt;td&gt;20: a single large move has less influence&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multiplier&lt;/td&gt;
&lt;td&gt;1.5: a lower upper band with other inputs unchanged&lt;/td&gt;
&lt;td&gt;2: add twice ATR to the middle&lt;/td&gt;
&lt;td&gt;2.5: a higher upper band with other inputs unchanged&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;With EMA still at 100 and ATR at 1.5, multipliers of 1.5, 2 and 2.5 produce upper bands of 102.25, 103 and 103.75. That establishes how the threshold moves. Trade count and net return still depend on the full sequence of positions, exits and costs.&lt;/p&gt; &lt;p&gt;The chart’s EMA starts with the average of the first 20 closes, then mixes the old value and the new close in a 19-to-2 ratio. ATR starts with the average of the first 10 true ranges, then combines nine parts old value with one part new true range. The close before candle 1 is assumed to be 100. For your own backtest, load earlier history so the lines can get going before the period you want to inspect.&lt;/p&gt; &lt;h2&gt;When does this breakout rule make sense?&lt;/h2&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;✅ A breakout that continues higher:&lt;/strong&gt; price has room to extend while closes stay above the middle line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;⚠️ A sharp rise followed by a fast reversal:&lt;/strong&gt; waiting for the close and the following order can delay both entry and exit, giving back unrealized profit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;❌ Repeated breaks inside a narrow range:&lt;/strong&gt; buying and exiting can repeat while fees accumulate. A narrow channel does not ensure the next move will trend.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;These are implications of the rules, not measured performance claims. Fix the market, period, fees and sizing before comparing settings, and retain the losing stretches as well as the attractive breakout.&lt;/p&gt; &lt;h2&gt;Keltner channels vs Bollinger Bands&lt;/h2&gt; &lt;p&gt;Both draw boundaries around price, but they measure the track’s width differently. Keltner channels use ATR to measure the size of candle-to-candle movements. Traditional Bollinger Bands use standard deviation to measure how spread out the closes are around their average. The middle-line calculation can differ too. &lt;span&gt;StockCharts’ Keltner guide&lt;/span&gt; describes the familiar EMA 20 and ATR 10 settings.&lt;/p&gt; &lt;p&gt;Compare complete rules with stated entry, exit, interval and fees. Which line gets touched first cannot establish which strategy makes money. Calling one indicator “safer” does not replace that comparison.&lt;/p&gt; &lt;h2&gt;Common questions&lt;/h2&gt; &lt;h3&gt;Does an upper-band touch mean overbought and sell?&lt;/h3&gt;
&lt;p&gt;If you’re holding under the breakout rule above, wait for a close below EMA before scheduling the sell. An upper-band touch leaves the position open. If you prefer taking profit there, test that change separately and compare the trades it changes.&lt;/p&gt; &lt;h3&gt;Does EMA 20 on a four-hour chart mean 20 days?&lt;/h3&gt;
&lt;p&gt;The 20 counts candles, so the length is set to 20 four-hour candles. Newer prices affect EMA more, while older prices gradually have less influence. They do not suddenly disappear once they are more than 80 hours old.&lt;/p&gt; &lt;h3&gt;Why do Keltner channels differ between platforms?&lt;/h3&gt;
&lt;p&gt;Start with the same asset, timeframe and historical data. Then check EMA versus SMA, whether its length is 20, whether ATR uses 10, how ATR averages earlier movements, and whether the multiplier is 2. The same name can hide different calculations; compare those settings before judging the lines.&lt;/p&gt; &lt;h3&gt;The breakout signal appeared. Did the order follow the rule?&lt;/h3&gt; &lt;p&gt;For the trade in the chart, check whether candle 24’s closing signal really waited until candle 25 to submit the buy, then inspect its fill price and quantity. In a supported exchange Demo environment, &lt;span&gt;AlgoRover Live&lt;/span&gt; lets you inspect a confirmed strategy’s orders, fills and positions to see what happened after the signal. First confirm that the strategy uses the same EMA, ATR and selling rules.&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Anchored VWAP: Why Changing the Anchor Changes Your Entry</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:33:05 +0000</pubDate>
      <link>https://dev.to/algorover/anchored-vwap-why-changing-the-anchor-changes-your-entry-2fhl</link>
      <guid>https://dev.to/algorover/anchored-vwap-why-changing-the-anchor-changes-your-entry-2fhl</guid>
      <description>&lt;span&gt;Strategy Analysis&lt;/span&gt; &lt;p&gt;The same price can sit above one anchored VWAP and below another. Compare the anchors, then trace when a crossing was knowable and when an order could follow.&lt;/p&gt;   &lt;p&gt;You draw two anchored VWAP lines on the same chart. Price sits above one and below the other. One view seems to support holding; the other looks weaker. Before adding another line, check where each calculation starts.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Anchored VWAP, or AVWAP, calculates a volume-weighted average from the candle you choose. Move that starting point and you include a different set of trades, which changes the average.&lt;/strong&gt; First check where each line starts, then look at how price crosses it and when you would buy or sell.&lt;/p&gt; &lt;h2&gt;What is anchored VWAP, and how does it differ from VWAP?&lt;/h2&gt; &lt;p&gt;Think of VWAP as a trade ledger. You record the price and quantity of each trade, then divide the total amount paid by the total units traded. A trade of 20 units counts more toward that average than a trade of one unit. That is what “volume-weighted average price” means.&lt;/p&gt; &lt;p&gt;A familiar session VWAP opens a fresh ledger each trading session. With anchored VWAP, you choose the first page and can keep adding entries across days. &lt;span&gt;TradingView’s anchored VWAP tool&lt;/span&gt; lets you choose that starting candle on the chart.&lt;/p&gt; &lt;p&gt;The ledger records trades that happened during that period. Some buyers have already sold, and the same units may have changed hands repeatedly. The average gives you a price reference; it cannot tell you what every current holder paid.&lt;/p&gt; &lt;h2&gt;How to calculate anchored VWAP&lt;/h2&gt; &lt;p&gt;Suppose you are using four-hour candles. Give each candle a representative price: (high + low + close) ÷ 3, called its typical price. Multiply that by the number of units traded during the candle. Add those amounts together and divide by the total units. Each candle becomes one line in the ledger.&lt;/p&gt; &lt;p&gt;Combining trades into candle-sized entries can give a slightly different answer from calculating every individual trade. &lt;span&gt;TradingView’s VWAP calculation&lt;/span&gt; describes this common approach.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;The first four candles of one assumed price sequence&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Candle&lt;/th&gt;
&lt;th&gt;Typical price / USDT&lt;/th&gt;
&lt;th&gt;Volume / units&lt;/th&gt;
&lt;th&gt;Close / USDT&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;103&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;Ledger A starts at candle 1. At candle 3’s close, the average is (100×10 + 102×20 + 104×10) ÷ 40 = 102 USDT. Candle 4 adds 10 units at a representative price of 103. The total amount is now 5,110 for 50 units, giving an average of 102.2.&lt;/p&gt; &lt;p&gt;Ledger B starts at candle 3 and leaves out the first two entries. Its average after candle 4 is (104×10 + 103×10) ÷ 20 = 103.5. Candle 4 closes at 103, above A’s 102.2 but below B’s 103.5. You are comparing the same price with two ledgers that started on different dates.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Favwap-anchors-en-1.png" alt="The same assumed four-hour candles with green AVWAP starting at candle1 and blue AVWAP at candle3. Candle4 closes at103, above A at102.2 and below B at103.5." width="800" height="661"&gt;Both starting times are specified in advance. Each line accumulates the same underlying OHLC and volume data from its own anchor; the three candle-4 markers share one price scale. &lt;h2&gt;Where should you anchor VWAP?&lt;/h2&gt; &lt;p&gt;A predetermined date, an announcement that has already happened, or a confirmed breakout can define different useful periods. Decide which question you want to answer: the average since the week began, or since a particular event? Record the event, timezone and first included candle.&lt;/p&gt; &lt;p&gt;“Start at the low” sounds reasonable, but when price first drops, how do you know it will not drop further? Suppose your rule requires a candle’s low to be lower than the two candles on each side. After candle 5 appears, you still need candles 6 and 7 to finish before confirming it. You can then backfill the ledger from candle 5, but orders must wait until after confirmation.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Favwap-confirmation-en-1.png" alt="An assumed low occurs at candle5. With two candles on either side required for confirmation, it becomes known at candle7 close. AVWAP can be calculated back from5, but a next-bar action cannot begin before8." width="800" height="661"&gt;The shaded interval separates the low from its confirmation. Calculating the blue line back from candle 5 does not turn a candle-5 signal into a trade that was available then. &lt;p&gt;You could instead reset the anchor whenever a new running low becomes known. That is another rule, with repeated resets. A backtest must make each change using only information available at that moment, rather than selecting the most attractive low after seeing the whole chart.&lt;/p&gt; &lt;h2&gt;An anchored VWAP crossover strategy, from entry to exit&lt;/h2&gt; &lt;p&gt;Return to anchor A in the first chart. Suppose you decide in advance to start the ledger at candle 1 and keep that starting point. You have enough cash to buy one unit and will not add to the position. To check a cross, you need two consecutive candles with both a closing price and a valid AVWAP value.&lt;/p&gt; &lt;ol&gt;
&lt;li&gt;While flat, require the previous close to be at or below its AVWAP and the current close to be strictly above its current AVWAP.&lt;/li&gt;
&lt;li&gt;Record the closing signal, then submit the buy at the next candle’s start. The calculation assumes a fill at its opening price, before fees.&lt;/li&gt;
&lt;li&gt;While holding, a close strictly below the current AVWAP schedules an exit at the next candle’s start. Equality does not trigger an exit.&lt;/li&gt;
&lt;li&gt;Remaining above the line does not create another entry every candle. The first value after a new anchor cannot create a crossover without a previous comparable value.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;Candle 2 closes at 101, below A at about 101.33. Candle 3 closes at 104, above A at 102, completing the cross. Assume one unit fills at candle 4’s open of 104. Candle 5 closes at 102, below A at about 102.17, triggering the exit. An assumed sale at candle 6’s open of 100.6 loses 3.4 USDT before fees.&lt;/p&gt; &lt;p&gt;A close above an average did not ensure continuation. With anchor B, candle 3 only supplies the first AVWAP reading, so there is no previous value for a cross. Candle 4 then closes below that line. It does not produce the same entry.&lt;/p&gt; &lt;p&gt;A crossover takes two observations: the previous close was below or on its line, and the current close is above its line. If price has already closed above it for three candles, the third candle has not crossed again. Think of stepping over a doorstep versus already standing inside. A program needs that distinction too, or it may try to buy every candle. See &lt;span&gt;how to check whether AI changed your trading rules&lt;/span&gt;.&lt;/p&gt; &lt;h2&gt;How anchors, timeframe and price source change the result&lt;/h2&gt; &lt;div class="table-wrapper-paragraph"&gt;Change one input while keeping the others fixed&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Input&lt;/th&gt;
&lt;th&gt;What changes?&lt;/th&gt;
&lt;th&gt;What should you record?&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Earlier or later anchor&lt;/td&gt;
&lt;td&gt;A block of prices and volume enters or leaves the sum; the average can move either way&lt;/td&gt;
&lt;td&gt;Time, reason and when the choice became knowable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One-hour instead of four-hour bars&lt;/td&gt;
&lt;td&gt;Typical prices and volume grouping change, so candle-based values need not match&lt;/td&gt;
&lt;td&gt;Data source, timezone and the same starting time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Close instead of typical price&lt;/td&gt;
&lt;td&gt;The weighted price in every observation changes&lt;/td&gt;
&lt;td&gt;Price source, volume units and missing-data handling&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;Start with three questions: when does the ledger begin, will you ever open a fresh one, and which exchange supplies the data? Trying every possible anchor and choosing the one that made the most money in the past gives you an advantage you will not have in real time. Decide how you will choose an anchor first, then test it on a period you did not use to make that choice.&lt;/p&gt; &lt;h2&gt;When does this crossover rule have room to work?&lt;/h2&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;✅ Price crosses and keeps rising:&lt;/strong&gt; as long as closes stay above the line, this rule can keep holding. The final result still depends on fees and the prices at which orders actually fill.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;⚠️ Early volume is much larger:&lt;/strong&gt; once the ledger already contains many units, a few new units barely move the overall average. The line may react slowly. Check whether that old starting point still suits the period you want to understand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;❌ Price keeps crossing back and forth:&lt;/strong&gt; you buy, price drops below the line, you sell, then it rises again. Fees build up with each round trip. Drawing more lines does not automatically fix this.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;Keep a record of how you chose the anchor, when it was confirmed, which candle gave the signal, when the order was submitted, and its fill and fees. Those records help explain an unexpected trade. If you add a “buy only when the trend is rising” condition, keep the original result so you can see what the extra condition changed.&lt;/p&gt; &lt;h2&gt;Common questions&lt;/h2&gt; &lt;h3&gt;Anchored VWAP vs VWAP: which is better?&lt;/h3&gt;
&lt;p&gt;Use session VWAP when you want the average for the current trading session. Anchor it to an announcement or breakout when you want the average since that event. It is like choosing which pages of the ledger to read. To compare trading rules, use the same asset, fees and position size.&lt;/p&gt; &lt;h3&gt;Does anchored VWAP repaint?&lt;/h3&gt;
&lt;p&gt;Keep the starting point and original data unchanged, and values for completed candles stay as calculated. New trades extend the line forward. The unfinished candle can still change because its entry is not complete. If older values change too, check for revised data, an automatic anchor reset, or a newly confirmed low that caused the line to be drawn back to an earlier candle.&lt;/p&gt; &lt;h3&gt;Why does AVWAP differ between crypto exchanges?&lt;/h3&gt;
&lt;p&gt;Each exchange has its own trade ledger, so prices and quantities can differ. First check that you are comparing the same spot or perpetual market, candle interval, timezone and anchor. Then check the price formula and whether volume means units traded or USDT traded. Any of these differences can change the line.&lt;/p&gt; &lt;h3&gt;What happens with zero volume?&lt;/h3&gt;
&lt;p&gt;If the ledger already contains trades, a candle with no new volume leaves the average unchanged. If no units have traded since the anchor, there is no average yet; wait for a trade. Filling that gap with zero could make a program think price crossed a line at zero.&lt;/p&gt; &lt;h3&gt;Price crossed above the line. Did the strategy buy on time?&lt;/h3&gt; &lt;p&gt;For this trade, candle 3’s close confirms the cross. Check whether the buy waited until candle 4 to be submitted, then look at how many units filled and what you paid. In a supported exchange Demo environment, &lt;span&gt;AlgoRover Live&lt;/span&gt; lets you inspect a confirmed strategy’s orders, fills and positions. Compare those records with the strategy’s logged anchor and signal times to check that it kept using the same ledger as your chart.&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Donchian Channel Strategy: Breakouts, False Signals and Bollinger Bands</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 10:36:30 +0000</pubDate>
      <link>https://dev.to/algorover/donchian-channel-strategy-breakouts-false-signals-and-bollinger-bands-lhj</link>
      <guid>https://dev.to/algorover/donchian-channel-strategy-breakouts-false-signals-and-bollinger-bands-lhj</guid>
      <description>&lt;span&gt;Strategy Analysis&lt;/span&gt; &lt;p&gt;A channel touch is not a complete trading rule. Follow entry, holding and exit, compare Bollinger Bands, and inspect what happens after a closing signal.&lt;/p&gt;   &lt;p&gt;A price breaks its recent high, you buy, and it drops straight back into the range. That is the uncomfortable part of a Donchian channel strategy: did a trend just start, or did you buy another false breakout?&lt;/p&gt; &lt;p&gt;&lt;strong&gt;A Donchian channel gives “the recent high” a precise definition. It does not tell you that the next move will keep rising.&lt;/strong&gt; To test the strategy, you also need a reference window, a confirmation time, an entry order and an exit rule.&lt;/p&gt; &lt;p&gt;Start by connecting those decisions. Then the difference between Donchian channels and Bollinger Bands becomes useful, rather than just another comparison of indicator names.&lt;/p&gt; &lt;h2&gt;What is a Donchian channel?&lt;/h2&gt; &lt;p&gt;For a 20-period channel, the upper boundary is the highest high in the window, the lower boundary is its lowest low, and the middle is halfway between them. On a four-hour chart, 20 bars span 80 hours. They do not mean 20 days.&lt;/p&gt; &lt;p&gt;Suppose 20 completed candles have a high of 104 USDT and a low of 94 USDT. Their channel boundaries are 104 and 94, with a midpoint of 99. That midpoint is not the average closing price. These are assumed prices used below to follow the timing of one trade.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fdonchian-three-lines-en-a98eb363a202.png" alt="Twenty assumed four-hour candles: candle 18 sets the highest high of 104, candle 5 sets the lowest low of 94, and equal-length arrows place the middle at 99 halfway between the two boundaries." width="800" height="700"&gt;Read this assumed window at the close of candle 20. The circled high and low set the boundaries; two equal-length arrows locate their midpoint. As the window moves forward, all three levels are recalculated from the new window. &lt;p&gt;&lt;span&gt;TradingView documents the channel calculation&lt;/span&gt;. Turning it into an executable breakout rule introduces another choice: which bars go into the comparison?&lt;/p&gt; &lt;h2&gt;Donchian breakout strategy: exclude the signal candle&lt;/h2&gt; &lt;p&gt;If the current candle is included in the channel maximum, its close cannot be strictly above that maximum: an ordinary candle cannot close above its own high. A rule requiring a close above that current-window upper boundary can therefore remain silent indefinitely.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;For a close-confirmed breakout, calculate the high of the previous 20 completed candles, then compare the current close against it.&lt;/strong&gt; Check whether the plotted indicator includes the current bar or uses an offset. The chart and the strategy must reference the same window.&lt;/p&gt; &lt;p&gt;In the assumed sequence, candle 21 reaches 106 but closes at 103. It trades through the previous high of 104, yet does not pass the close-confirmed entry rule. Before candle 22, the reference high has risen to 106. A close at 107 then qualifies.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fdonchian-breakout-en-2.png" alt="Assumed four-hour candles: candle 21 wicks above the previous 20-bar high but closes below it; candle 22 closes at 107 above the reference high of 106, followed by an assumed entry at 107.5." width="800" height="500"&gt;Assumed prices, four hours per candle. The dashed threshold uses only the previous 20 completed bars. A wick above the threshold and a confirmed closing breakout happen at different times. &lt;h2&gt;Follow one trade from entry to exit&lt;/h2&gt; &lt;p&gt;Here is a defined starting rule for a spot, long-only strategy. It is not presented as the full historical Turtle Trading system.&lt;/p&gt; &lt;ul&gt;
&lt;li&gt;While flat, record an entry signal when the close is strictly above the high of the previous 20 bars.&lt;/li&gt;
&lt;li&gt;Submit the buy at the beginning of the next bar. The walkthrough assumes a fill at that opening price; actual execution needs a separate check.&lt;/li&gt;
&lt;li&gt;Hold one position without adding to it or buying again while already invested.&lt;/li&gt;
&lt;li&gt;Record an exit when the close is strictly below the low of the previous 10 bars. Submit the sell at the beginning of the next bar.&lt;/li&gt;
&lt;li&gt;A close exactly equal to either threshold does not meet these strict comparisons.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;Suppose you buy one unit at 107.5 USDT on candle 23, following candle 22's signal. Price later reaches 112. You keep holding because this rule does not take profit at a fixed percentage.&lt;/p&gt; &lt;p&gt;Price then falls. The 10 completed candles before candle 28 have a low of 100. Candle 28 closes at 99 and produces an exit signal. If the next candle opens and fills at 98.5, the trade loses 9 USDT before fees. An earlier unrealized profit did not become a realized gain.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;When the assumed trade makes each decision&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Comparison&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Candle 21 close&lt;/td&gt;
&lt;td&gt;103 is not above the prior high of 104&lt;/td&gt;
&lt;td&gt;No entry; a wick to 106 is not closing confirmation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Candle 22 close&lt;/td&gt;
&lt;td&gt;107 is above the prior high of 106&lt;/td&gt;
&lt;td&gt;Record the signal; wait for the next bar to submit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Candle 23 open&lt;/td&gt;
&lt;td&gt;Assumed fill at 107.5&lt;/td&gt;
&lt;td&gt;Buy one unit; do not pyramid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Candle 28 close to candle 29 open&lt;/td&gt;
&lt;td&gt;99 is below the prior low of 100&lt;/td&gt;
&lt;td&gt;Record the exit; assume a sale at 98.5 next bar&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;The strategy needs some breakouts to continue far enough to offset failed attempts. A close-based exit also leaves exposure to intrabar declines and gaps into the next bar. Adding a fixed or ATR-based stop changes the rule set and needs its own test.&lt;/p&gt; &lt;h2&gt;When does a Donchian channel strategy make sense?&lt;/h2&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;✅ Sustained directional moves:&lt;/strong&gt; new highs continue to be followed by new highs, allowing the position to remain open.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;⚠️ A fast surge followed by a sharp reversal:&lt;/strong&gt; closing confirmation and next-bar submission can enter late, while the exit gives back an unrealized gain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;❌ Repeated breaks around a narrow range:&lt;/strong&gt; price exceeds the boundary, retreats, then repeats. Entries, exits and fees can accumulate without a lasting trend.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;Include the false breaks and long waiting periods in the review. Selecting a few attractive breakout charts leaves out much of the strategy's experience.&lt;/p&gt; &lt;h2&gt;Donchian channel settings: what changes between 20 and 55?&lt;/h2&gt; &lt;p&gt;Keep the asset, four-hour timeframe, order logic and costs constant. Change the entry and exit lengths separately. The 20/10 pair below is this article's defined rule, not an optimized setting.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;Changing the window changes the threshold&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;Shorter window&lt;/th&gt;
&lt;th&gt;Article rule&lt;/th&gt;
&lt;th&gt;Longer window&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Entry lookback&lt;/td&gt;
&lt;td&gt;10 bars: high of the previous 40 hours&lt;/td&gt;
&lt;td&gt;20 bars: high of the previous 80 hours&lt;/td&gt;
&lt;td&gt;55 bars: high of the previous 220 hours&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Exit lookback&lt;/td&gt;
&lt;td&gt;5 bars: a more recent low, potentially a higher sell threshold&lt;/td&gt;
&lt;td&gt;10 bars: low of the previous 40 hours&lt;/td&gt;
&lt;td&gt;20 bars: an older low may allow more of the move to be given back&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;At the same instant, a longer entry window cannot have a lower maximum than its shorter subset. A longer exit window cannot have a higher minimum. How those differences affect total trades and net returns depends on the full path, including the changing position state.&lt;/p&gt; &lt;h2&gt;Donchian channel vs Bollinger Bands: the same touch means different things&lt;/h2&gt; &lt;p&gt;Donchian channels ask whether price has exceeded a recent extreme. Traditional Bollinger Bands measure price relative to an average of closes and their standard deviation. Their upper boundaries can be at very different prices.&lt;/p&gt; &lt;p&gt;A large wick can keep a Donchian high elevated until that bar leaves the window. Bollinger Bands instead change with the distribution of closing prices in their window.&lt;/p&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fdonchian-bollinger-en-1.png" alt="The same assumed closes compared with the previous 20-bar Donchian high and a Bollinger upper band calculated from the prior 20 closes, showing different entry thresholds." width="800" height="500"&gt;The same assumed market sequence. For signal comparison, both upper boundaries use the previous 20 completed candles. Bollinger uses SMA 20 plus two population standard deviations of closes. &lt;p&gt;That does not create a universal “buy at the Donchian upper band, sell at the Bollinger upper band” rule. &lt;span&gt;John Bollinger's own rules&lt;/span&gt; explain that an upper-band tag alone is not a sell signal; price can travel along the band in a trend.&lt;/p&gt; &lt;p&gt;Compare complete strategies: entry, exit, confirmation time, costs and execution assumptions. Changing several of those while changing the indicator makes the source of any performance difference hard to identify.&lt;/p&gt; &lt;h2&gt;What to check in a Donchian channel backtest&lt;/h2&gt; &lt;p&gt;Find a wick-only break and check that the strategy waits if closing confirmation is required. Then inspect a confirmed entry and the bars used for its reference high. Follow the order into the next candle rather than treating the signal close as a guaranteed execution price.&lt;/p&gt; &lt;p&gt;Use the same rule set through both trends and choppy ranges. Review trade count, losing streaks, drawdown and results after costs. &lt;span&gt;Check that an AI-generated strategy follows your rules&lt;/span&gt; before tuning the lookback. Candle lows alone cannot establish the order of events or prove that an order filled.&lt;/p&gt; &lt;p&gt;AlgoRover Research can help you find published strategies and their available historical-test configurations. Read a candidate's actual rules first: sharing the Donchian name does not establish identical windows, exits or sizing.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt; &lt;h3&gt;Should I enter a Donchian breakout immediately or wait for the close?&lt;/h3&gt; &lt;p&gt;Both can define a strategy, but they accept different trades. This article waits for the close and submits next bar. Switching to an intrabar touch includes temporary wick breaks, so the close-confirmed test results no longer describe the same strategy.&lt;/p&gt; &lt;h3&gt;Does a 20-period Donchian channel always mean 20 days?&lt;/h3&gt; &lt;p&gt;No. It means 20 bars of the selected timeframe: 80 hours on four-hour candles, or 20 daily bars on a daily chart.&lt;/p&gt; &lt;h3&gt;Can Donchian channels eliminate false breakouts?&lt;/h3&gt; &lt;p&gt;No. Confirmation and trend filters change which signals qualify, while also excluding some winning trades. Evaluate both sides of that change.&lt;/p&gt; &lt;h3&gt;Are Donchian channels better than Bollinger Bands?&lt;/h3&gt; &lt;p&gt;They answer different questions about extremes and dispersion around an average. A return comparison needs complete rules tested on the same market, period and execution conditions.&lt;/p&gt;  &lt;h2&gt;Use AlgoRover Live to inspect the next-bar orders&lt;/h2&gt; &lt;p&gt;The next useful question is what happens after a closing signal. With &lt;span&gt;AlgoRover Live&lt;/span&gt;, you can run a confirmed strategy in a supported exchange Demo environment and inspect orders, fills and positions, connecting signal timing with execution.&lt;/p&gt; &lt;p&gt;Start with: “Find Donchian breakout strategies and list the available versions, entry and exit lookbacks, confirmation timing and Live Demo support. Compare their rules with this article before starting any trading.”&lt;/p&gt;  

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Stop Market vs Stop Limit: Why a Triggered Stop May Not Fill</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 10:36:27 +0000</pubDate>
      <link>https://dev.to/algorover/stop-market-vs-stop-limit-why-a-triggered-stop-may-not-fill-47kg</link>
      <guid>https://dev.to/algorover/stop-market-vs-stop-limit-why-a-triggered-stop-may-not-fill-47kg</guid>
      <description>&lt;span&gt;Risk Management&lt;/span&gt; &lt;p&gt;A triggered stop is not a completed exit. Compare execution prices, working limits and remaining positions, then check what the backtest assumed.&lt;/p&gt;   &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; The trigger starts the order process; it is not a promised execution price.&lt;/p&gt; &lt;h2&gt;Stop market vs stop limit: what does each control?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;What changes between the two sell stops&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Decision&lt;/th&gt;
&lt;th&gt;Stop market&lt;/th&gt;
&lt;th&gt;Stop limit&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Inputs&lt;/td&gt;
&lt;td&gt;Trigger price, quantity and trigger reference&lt;/td&gt;
&lt;td&gt;Trigger price, sell limit, quantity and trigger reference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After triggering&lt;/td&gt;
&lt;td&gt;Submit a market sell against available bids&lt;/td&gt;
&lt;td&gt;Submit a limit sell; accept the limit price or higher&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;During a fast drop&lt;/td&gt;
&lt;td&gt;Execution may occur at lower prices&lt;/td&gt;
&lt;td&gt;Bids below the limit cannot fill the order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full execution&lt;/td&gt;
&lt;td&gt;Still depends on liquidity, protection limits and venue rules&lt;/td&gt;
&lt;td&gt;Also depends on eligible depth, queue priority and time in force&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;&lt;span&gt;Bybit's order documentation&lt;/span&gt; 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.&lt;/p&gt; &lt;h2&gt;Stop-loss trigger price vs execution price: one order, two outcomes&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stop market:&lt;/strong&gt; 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.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stop limit:&lt;/strong&gt; 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.&lt;/li&gt;
&lt;/ul&gt; &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fstop-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." width="800" height="750"&gt;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. &lt;p&gt;&lt;span&gt;Kraken's stop-loss-limit guide&lt;/span&gt; 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How much does stop-loss slippage add?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Add actual fees separately. An actual fill price already reflects its execution deviation. Subtracting the same estimated slippage again would double-count that cost.&lt;/p&gt; &lt;h2&gt;Why was my stop loss not triggered when the chart reached it?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;This is why &lt;strong&gt;mark price vs last price&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Triggered but not filled: follow the order's actual state&lt;/h2&gt; &lt;p&gt;Use the same order identifier to connect the records, then investigate the stage it reached.&lt;/p&gt; &lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Not triggered:&lt;/strong&gt; check the reference price, trigger direction, condition and whether the stop remains active.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Triggered, then rejected:&lt;/strong&gt; read the rejection reason. Check balance or margin, minimum size, price restrictions and whether derivatives reduce-only instructions match the current position.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working limit:&lt;/strong&gt; check the limit, eligible bids, queue and time in force. A last trade at your limit does not establish that your order filled.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partially filled:&lt;/strong&gt; separate completed quantity, remaining order quantity and the remaining position.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local and exchange states disagree:&lt;/strong&gt; reconcile venue orders, fills and positions before submitting another sell.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;For the quantity side, see &lt;span&gt;how to check positions and stop quantities after partial fills&lt;/span&gt;. If you close a position another way, also check whether an old protective order remains active, especially in derivatives.&lt;/p&gt; &lt;h2&gt;Which stop order fits the constraint you actually want?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How to account for stop execution losses in a backtest&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Compare ordinary execution, a gap through the limit and partial execution, then inspect how the strategy handles the remaining position. Our &lt;span&gt;analysis of slippage and backtest profits&lt;/span&gt; covers overall cost; the extra question here is whether this stop completed the exit at all.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt; &lt;h3&gt;Can the stop and limit prices be identical?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Does a stop-limit order always pay maker fees?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Does a stop-market order guarantee my maximum loss?&lt;/h3&gt; &lt;p&gt;No. The trigger does not fix the fill price. Gaps, depth and execution protection can change the outcome, and position size matters too.&lt;/p&gt; &lt;h3&gt;Should I submit another sell immediately after the stop triggers?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt;  &lt;h2&gt;Use AlgoRover Live to follow the stop through its fills&lt;/h2&gt; &lt;p&gt;If you run strategies with &lt;span&gt;AlgoRover Live&lt;/span&gt;, 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt;  

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>API Key Permissions for Trading Bots: Research, Demo and Live</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:58 +0000</pubDate>
      <link>https://dev.to/algorover/api-key-permissions-for-trading-bots-research-demo-and-live-3e8h</link>
      <guid>https://dev.to/algorover/api-key-permissions-for-trading-bots-research-demo-and-live-3e8h</guid>
      <description>&lt;span&gt;Product Tutorials&lt;/span&gt; &lt;p&gt;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.&lt;/p&gt;   &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Do you need an exchange API key for research and backtesting?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Binance, for example, labels public market-data endpoints &lt;code&gt;NONE&lt;/code&gt;, private account and order information &lt;code&gt;USER_DATA&lt;/code&gt;, and order placement and cancellation &lt;code&gt;TRADE&lt;/code&gt;. Each endpoint has its own authorization requirements. &lt;span&gt;Binance permission definitions&lt;/span&gt;&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt; Match the credential to the task &lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Typical requirement&lt;/th&gt;
&lt;th&gt;Check first&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt;
&lt;td&gt;Public strategies and prices&lt;/td&gt;
&lt;td&gt;A public endpoint; some data services require a login or data credential&lt;/td&gt;
&lt;td&gt;Data source&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Historical backtesting&lt;/td&gt;
&lt;td&gt;Historical data and strategy configuration&lt;/td&gt;
&lt;td&gt;Data-source authorization&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Local simulated execution&lt;/td&gt;
&lt;td&gt;Simulation configuration; some feeds require read-only credentials&lt;/td&gt;
&lt;td&gt;Orders remain simulated locally&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Exchange demo trading&lt;/td&gt;
&lt;td&gt;Credentials for the test environment&lt;/td&gt;
&lt;td&gt;Key, endpoint and run mode match&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Live trading&lt;/td&gt;
&lt;td&gt;Necessary account-query and trading permissions&lt;/td&gt;
&lt;td&gt;Market, account and order scope&lt;/td&gt;
&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What is the difference between read, trade and withdrawal permissions?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt; API key permissions for trading bots &lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Permission&lt;/th&gt;
&lt;th&gt;Common use&lt;/th&gt;
&lt;th&gt;Configuration principle&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt;
&lt;td&gt;Read&lt;/td&gt;
&lt;td&gt;Balances, positions, orders and history&lt;/td&gt;
&lt;td&gt;Check whether read-only access is sufficient for reporting or monitoring&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Trade&lt;/td&gt;
&lt;td&gt;Place and cancel orders; exact scope varies by exchange&lt;/td&gt;
&lt;td&gt;Enable only the spot, futures or other functions the task requires&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;Withdraw and transfer&lt;/td&gt;
&lt;td&gt;Withdraw funds or move them between accounts&lt;/td&gt;
&lt;td&gt;Ordinary order placement needs no withdrawal access; examine transfer scope separately&lt;/td&gt;
&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Read the details behind the permission name. On OKX, &lt;code&gt;Trade&lt;/code&gt; 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. &lt;span&gt;OKX API permission definitions&lt;/span&gt;&lt;/p&gt; &lt;h2&gt;Should demo and live trading use different API keys?&lt;/h2&gt; &lt;p&gt;Demo credentials belong to a test account; live credentials reach real funds. Check three things together when switching: &lt;strong&gt;the key's environment, the API endpoint and the program's run mode&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;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. &lt;span&gt;OKX demo API FAQ&lt;/span&gt;&lt;/p&gt; &lt;p&gt;If demo works but live orders fail, continue with the &lt;span&gt;account and order checks for the demo-to-live transition&lt;/span&gt;.&lt;/p&gt; &lt;h2&gt;Where should you store API keys on a computer or VPS?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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. &lt;span&gt;Binance API key guide&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Keep complete secrets in the local credential configuration. For troubleshooting, share permission names, run mode and a redacted error message.&lt;/p&gt; &lt;h2&gt;When does AlgoRover need exchange credentials?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;AlgoRover Research&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;When moving to &lt;strong&gt;AlgoRover Live&lt;/strong&gt;, 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.&lt;/p&gt; &lt;p&gt;Write down what this task needs to read, change and run on. Then consult the &lt;span&gt;AlgoRover Live guide&lt;/span&gt;. For strategy research, start with &lt;span&gt;AlgoRover Research&lt;/span&gt;.&lt;/p&gt; &lt;h2&gt;Common questions&lt;/h2&gt; &lt;h3&gt;Can AI analyze my trade history without trading permission?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Can a bot still lose money when withdrawals are disabled?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Should I enable every permission to fix an API permission error?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Is removing a leaked key from the bot enough?&lt;/h3&gt; &lt;p&gt;Revoke the key at the exchange, then review account activity and outstanding orders. Deleting local configuration does not invalidate the exchange-issued credential.&lt;/p&gt; &lt;h2&gt;Sources&lt;/h2&gt; &lt;ul&gt; &lt;li&gt;&lt;span&gt;Binance: public-data, account and trading permissions&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;OKX: API key permission scope&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;OKX: demo credentials and common API errors&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;Binance: API keys and IP access restrictions&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Next step&lt;/p&gt;
&lt;h2&gt;Test the strategy yourself&lt;/h2&gt;
&lt;p&gt;Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.&lt;/p&gt;
&lt;span&gt;Try AlgoRover Research&lt;/span&gt; &lt;span&gt;Follow us on X&lt;/span&gt; &lt;span&gt;Follow us on Reddit&lt;/span&gt;

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
      <category>programming</category>
    </item>
    <item>
      <title>Perpetual Funding Fees: Calculate a 30-Day Holding Cost</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:56 +0000</pubDate>
      <link>https://dev.to/algorover/perpetual-funding-fees-calculate-a-30-day-holding-cost-473m</link>
      <guid>https://dev.to/algorover/perpetual-funding-fees-calculate-a-30-day-holding-cost-473m</guid>
      <description>&lt;span&gt;Trading Costs&lt;/span&gt; &lt;p&gt;A small payment can become a substantial holding cost. Work through a 30-day example, then account for position changes and negative funding rates.&lt;/p&gt;   &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Are funding fees based on position value or margin?&lt;/h2&gt; &lt;p&gt;For a USDT linear perpetual, &lt;strong&gt;one funding payment = position value at settlement × that period's funding rate&lt;/strong&gt;. 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. &lt;span&gt;Bybit calculation reference&lt;/span&gt;&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt;  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F08%2Ffunding-explainer-en-v1.png" alt="An octopus holds a position-sized balloon while a settlement clock keeps printing funding bills" width="800" height="450"&gt;Position value sets each bill's base; settlement count determines how many bills arrive.   &lt;h2&gt;How much does a 20,000 USDT position cost over 30 days?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt; 30-day funding costs at fixed rates (illustrative example) &lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Rate per period&lt;/th&gt;
&lt;th&gt;Each payment&lt;/th&gt;
&lt;th&gt;Total: 90 payments&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt;
&lt;td&gt;0.005%&lt;/td&gt;
&lt;td&gt;1 USDT&lt;/td&gt;
&lt;td&gt;90 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;0.010%&lt;/td&gt;
&lt;td&gt;2 USDT&lt;/td&gt;
&lt;td&gt;180 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;0.030%&lt;/td&gt;
&lt;td&gt;6 USDT&lt;/td&gt;
&lt;td&gt;540 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How do you calculate total funding when rates change?&lt;/h2&gt; &lt;p&gt;Add the settlements individually. Each entry uses &lt;strong&gt;the position value, funding rate and position direction at that time&lt;/strong&gt;. Position changes, price changes and a switch between positive and negative rates can all alter the next payment.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt; Three settlements after reducing a long position (illustrative example) &lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Settlement&lt;/th&gt;
&lt;th&gt;Position value&lt;/th&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;th&gt;Cash flow&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;20,000 USDT&lt;/td&gt;
&lt;td&gt;0.010%&lt;/td&gt;
&lt;td&gt;Pay 2 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;15,000 USDT&lt;/td&gt;
&lt;td&gt;−0.010%&lt;/td&gt;
&lt;td&gt;Receive 1.5 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;15,000 USDT&lt;/td&gt;
&lt;td&gt;0.020%&lt;/td&gt;
&lt;td&gt;Pay 3 USDT&lt;/td&gt;
&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How often are perpetual funding fees charged?&lt;/h2&gt; &lt;p&gt;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. &lt;span&gt;Settlement and holding rules&lt;/span&gt;&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What could another seven days of funding cost?&lt;/h2&gt; &lt;p&gt;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:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;0.005% per period: another 21 USDT.&lt;/li&gt; &lt;li&gt;0.010% per period: another 42 USDT.&lt;/li&gt; &lt;li&gt;0.030% per period: another 126 USDT.&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Why can total P&amp;amp;L be negative even when you receive funding?&lt;/h2&gt; &lt;p&gt;Funding income is one line in the account. For the same holding period: &lt;strong&gt;price P&amp;amp;L + funding received − funding paid − entry and exit fees = P&amp;amp;L after those items&lt;/strong&gt;.&lt;/p&gt; &lt;p&gt;Check whether the exchange or report already deducts funding from net P&amp;amp;L before totaling the entries. Deducting it again counts the same cost twice. For the broader calculation, see &lt;span&gt;how fees, spreads and slippage affect backtest profits&lt;/span&gt;.&lt;/p&gt; &lt;h2&gt;How should you reconcile your own funding records?&lt;/h2&gt; &lt;p&gt;Choose one complete holding period. Export its funding entries and match them to position changes and the P&amp;amp;L report. Look for missing settlements, reversed payment direction and costs the report already includes.&lt;/p&gt; &lt;p&gt;In an AI assistant with &lt;strong&gt;AlgoRover Research&lt;/strong&gt; 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.&lt;/p&gt;  &lt;span&gt;Review your funding records&lt;/span&gt; &lt;pre&gt;Using these position and funding records, help me check the reporting period, payment direction and whether the P&amp;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.&lt;/pre&gt; &lt;span&gt;&lt;/span&gt;  &lt;p&gt;Start with the &lt;span&gt;AlgoRover Research guide&lt;/span&gt;. Reconcile one holding period before choosing the next cost assumption to test.&lt;/p&gt; &lt;h2&gt;Common questions&lt;/h2&gt; &lt;h3&gt;What number should I enter for a 0.01% funding rate?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Does the closing fee include funding?&lt;/h3&gt; &lt;p&gt;Entry and exit commissions and funding arise separately. Check whether a report includes both in total P&amp;amp;L; a field labeled “fees” does not establish its calculation scope.&lt;/p&gt; &lt;h3&gt;Does multiplying today's funding rate by a year give its annualized cost?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Can I compare funding rates directly with margin borrowing rates?&lt;/h3&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Sources&lt;/h2&gt; &lt;ul&gt;&lt;li&gt;&lt;span&gt;Bybit: funding calculations, settlement times and records&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;small&gt;For research and education; not investment advice.&lt;/small&gt;&lt;/p&gt;  &lt;p&gt;Next step&lt;/p&gt;
&lt;h2&gt;Put the records together. What should you check next?&lt;/h2&gt;
&lt;p&gt;Bring your results, settings, and cost records to AlgoRover Research to explore the differences and identify what to check next.&lt;/p&gt;
&lt;span&gt;Try AlgoRover Research&lt;/span&gt; &lt;span&gt;Follow us on X&lt;/span&gt; &lt;span&gt;Follow us on Reddit&lt;/span&gt;

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>AI Trading Bot Token Costs: Which Decisions Can Run as Rules?</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:54 +0000</pubDate>
      <link>https://dev.to/algorover/ai-trading-bot-token-costs-which-decisions-can-run-as-rules-3f3m</link>
      <guid>https://dev.to/algorover/ai-trading-bot-token-costs-which-decisions-can-run-as-rules-3f3m</guid>
      <description>&lt;span&gt;Trading Costs&lt;/span&gt; &lt;p&gt;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.&lt;/p&gt;   &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Why do AI trading bots consume so many tokens?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Where can AlgoRover's approach reduce token usage?&lt;/h2&gt; &lt;p&gt;With &lt;span&gt;AlgoRover Research&lt;/span&gt;, 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.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; Through AI conversations, users can adapt existing strategies, adjusting trading rules and parameters to suit their trading goals and risk preferences.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;For execution, we pass the selected strategy program and parameters to an engine: Research runs a historical backtest, while &lt;span&gt;Live&lt;/span&gt; passes the strategy to the trading engine on your runtime device. &lt;strong&gt;When a fixed-rule strategy computes its indicators and signals in code, routine checks can run there without model requests increasing with every candle.&lt;/strong&gt;&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;Where the two workflows use models differently&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Model judgment each cycle&lt;/th&gt;
&lt;th&gt;AI research plus fixed-rule execution&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Routine market check&lt;/td&gt;
&lt;td&gt;Submit data and conditions for another model judgment&lt;/td&gt;
&lt;td&gt;Update indicators and evaluate conditions in code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rules and historical context&lt;/td&gt;
&lt;td&gt;May be resent with each request&lt;/td&gt;
&lt;td&gt;Keep rules and parameters in the strategy configuration; routine calculations need not explain them to a model again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;New hypotheses and changes&lt;/td&gt;
&lt;td&gt;Call models according to the decision and research workflow&lt;/td&gt;
&lt;td&gt;Use AI around a research question, then review configuration changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anomalies and review&lt;/td&gt;
&lt;td&gt;Depends on the review workflow&lt;/td&gt;
&lt;td&gt;Provide relevant records when AI analysis is needed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;Savings can occur at two stages: &lt;strong&gt;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.&lt;/strong&gt; Research, changes and interpretation can be organized around actual questions.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What does a five-minute model loop cost over 30 days?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;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.&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;Consider an &lt;strong&gt;illustrative budget&lt;/strong&gt;: 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;30-day model budget at equal usage per request: illustrative example&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Workflow&lt;/th&gt;
&lt;th&gt;Model requests&lt;/th&gt;
&lt;th&gt;Input / output tokens&lt;/th&gt;
&lt;th&gt;Model cost&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A: one model request every five minutes&lt;/td&gt;
&lt;td&gt;8,640&lt;/td&gt;
&lt;td&gt;17.28 million / 2.592 million&lt;/td&gt;
&lt;td&gt;About $27.65&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B: code checks conditions; separate research allowance&lt;/td&gt;
&lt;td&gt;120&lt;/td&gt;
&lt;td&gt;240,000 / 36,000&lt;/td&gt;
&lt;td&gt;About $0.38&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;img alt="At equal usage per request, 8,640 model requests cost about $27.65 and 120 cost about $0.38" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Ftoken-budget-comparison-en-c6db033cda63.png" width="800" height="440"&gt;30-day model cost comparison: illustrative example. Usage and prices per request are equal; request counts are 8,640 and 120. &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Does reducing model calls mean missing signals?&lt;/h2&gt; &lt;p&gt;Separate &lt;strong&gt;checking the market less often&lt;/strong&gt; from &lt;strong&gt;requesting a model less often&lt;/strong&gt;. 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How can you identify avoidable token usage?&lt;/h2&gt; &lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find the triggers.&lt;/strong&gt; Does every candle call the model, or do calls occur during research, event analysis and review?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Count the full request chain.&lt;/strong&gt; Include tool follow-ups, additional judgments and retries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspect repeated inputs.&lt;/strong&gt; How much of the same rules, history and market data is resent?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Identify fixed conditions.&lt;/strong&gt; Could software evaluate them, with its behavior checked against the specification?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Price actual usage.&lt;/strong&gt; Apply the relevant input, caching, output and other categories from provider records.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Give AI a defined research task&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;span&gt;Start with an existing strategy and adapt it to your needs&lt;/span&gt;&lt;pre&gt;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.&lt;/pre&gt;
&lt;span&gt;&lt;/span&gt; &lt;p&gt;&lt;span&gt;Get started with AlgoRover Research&lt;/span&gt;. When you need ongoing execution, review &lt;span&gt;Live's Demo and deployment settings&lt;/span&gt;. Hosting, market-data services and trading fees belong in the &lt;span&gt;total operating budget&lt;/span&gt; alongside model usage.&lt;/p&gt; &lt;p&gt;Let software keep checking defined rules. Use AI for questions worth thinking through again. Then the token savings have an explanation you can trace.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt; &lt;h3&gt;How can reusing an existing strategy save tokens?&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Does AlgoRover call a language model on every candle?&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;How can an AI trading bot reduce input tokens?&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Does executing without a model request mean zero running cost?&lt;/h3&gt;
&lt;p&gt;Compute, machines or hosting, and potentially data and trading fees remain. This article compares model-token costs, not the entire operating bill.&lt;/p&gt; &lt;h3&gt;Does a monthly AI subscription make request counts irrelevant?&lt;/h3&gt;
&lt;p&gt;Check its allowances, limits and permitted usage. Subscription and metered API billing differ; repeated requests can still consume allowances and add latency.&lt;/p&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;TradingAgents: a research framework with LLM analyst and decision roles&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;OpenAI: tokens and usage&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;OpenAI: prompt caching and billing&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;For research and education; not investment advice.&lt;/small&gt;&lt;/p&gt;  &lt;p&gt;Next step&lt;/p&gt;
&lt;h2&gt;Test the strategy yourself&lt;/h2&gt;
&lt;p&gt;Use AlgoRover Research to check costs, drawdown, and performance across market periods before you keep testing.&lt;/p&gt;
&lt;span&gt;Try AlgoRover Research&lt;/span&gt; &lt;span&gt;Follow us on X&lt;/span&gt; &lt;span&gt;Follow us on Reddit&lt;/span&gt;

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Crypto Backtest Survivorship Bias: Are You Using Today's Coin List?</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:41 +0000</pubDate>
      <link>https://dev.to/algorover/crypto-backtest-survivorship-bias-are-you-using-todays-coin-list-2k9k</link>
      <guid>https://dev.to/algorover/crypto-backtest-survivorship-bias-are-you-using-todays-coin-list-2k9k</guid>
      <description>&lt;span&gt;Backtest Validation&lt;/span&gt; &lt;p&gt;Could you actually buy those coins back then? Check listings, delistings and ranking dates before crediting the trading rules for a good-looking backtest.&lt;/p&gt;   &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What goes wrong when you backtest today's crypto universe?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;A historical trading universe should use information available at the decision time.&lt;/strong&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Can a dynamic pairlist still use current market information?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;How you choose coins changes what the backtest tells you&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;How you choose coins&lt;/th&gt;
&lt;th&gt;What you find out&lt;/th&gt;
&lt;th&gt;What is easy to miss&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pick today's popular coins and backtest their past prices&lt;/td&gt;
&lt;td&gt;How your trading rules would have performed on those coins&lt;/td&gt;
&lt;td&gt;Coins that were popular then but later delisted or lost liquidity may be missing, making returns look better&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Choose only BTC and ETH and keep them throughout the test&lt;/td&gt;
&lt;td&gt;How the same trading rules perform on BTC and ETH&lt;/td&gt;
&lt;td&gt;The result covers those two coins; it does not show what a whole-market selection rule would have picked&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go back through history and choose coins each week using volume known at the time&lt;/td&gt;
&lt;td&gt;Which coins you would have bought and how those trades would have performed&lt;/td&gt;
&lt;td&gt;Use only data available then, and include coins that were tradable then but delisted later&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;h2&gt;How do you build a point-in-time crypto universe?&lt;/h2&gt; &lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Declare the selection rule first.&lt;/strong&gt; For example, rank eligible spot pairs at UTC midnight using the previous completed day's volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep historical market membership.&lt;/strong&gt; Include listing dates, suspensions, delistings and pair changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Record data availability.&lt;/strong&gt; Distinguish the period being measured from when its completed value could be retrieved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save each rebalance.&lt;/strong&gt; Record inclusions, exclusions and missing-data decisions, including how to exit a holding that leaves the list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Charge for the changes.&lt;/strong&gt; Turnover, spreads and unfilled orders belong in the result.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;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.&lt;/p&gt;
&lt;img alt="Suppose a coin lists in June. Earlier months cannot include it as a tradable asset." src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Funiverse-inline-en-e0b1fb0d131d.png" width="800" height="567"&gt;Suppose a coin lists in June. Earlier months cannot include it as a tradable asset. &lt;h2&gt;Can you backtest without complete historical membership?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;You can start with a fixed BTC and ETH basket to understand the trading rules.&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What should you ask about a good-looking backtest?&lt;/h2&gt; &lt;p&gt;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?&lt;/p&gt; &lt;p&gt;&lt;span&gt;AlgoRover Research&lt;/span&gt; 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.&lt;/p&gt; &lt;p&gt;Then look at &lt;span&gt;out-of-sample validation&lt;/span&gt; and &lt;span&gt;trading costs&lt;/span&gt;. Rebuild the list of coins available at the time, then see how much of the return your trading rules still produce.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt; &lt;h3&gt;Does a fixed BTC and ETH backtest have survivorship bias?&lt;/h3&gt;
&lt;p&gt;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.&lt;/p&gt; &lt;h3&gt;Is yesterday's trading volume safe to use?&lt;/h3&gt;
&lt;p&gt;Check that the period had closed and its data was available before selection and trading. Historical listings and exit rules still matter.&lt;/p&gt; &lt;h3&gt;Should missing delisted prices be replaced with zero?&lt;/h3&gt;
&lt;p&gt;No arbitrary replacement establishes a tradable exit. Investigate the last trading time and exit rules; identify any period that cannot be reconstructed.&lt;/p&gt; &lt;h3&gt;Does StaticPairlist eliminate selection bias?&lt;/h3&gt;
&lt;p&gt;It helps reproduce the chosen assets. It does not establish that their selection was historically valid or that fills and costs were realistic.&lt;/p&gt; &lt;h2&gt;Compare the coin list with actual trades&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;span&gt;See how Live runs a strategy&lt;/span&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;span&gt;Freqtrade: backtesting and dynamic pairlists&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;Not investment advice.&lt;/small&gt;&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
      <category>datascience</category>
    </item>
    <item>
      <title>EMA Warm-Up: Why Trading Signals Can Change After a Restart</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:39 +0000</pubDate>
      <link>https://dev.to/algorover/ema-warm-up-why-trading-signals-can-change-after-a-restart-mch</link>
      <guid>https://dev.to/algorover/ema-warm-up-why-trading-signals-can-change-after-a-restart-mch</guid>
      <description>&lt;span&gt;Backtest Validation&lt;/span&gt; &lt;p&gt;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.&lt;/p&gt;   &lt;p&gt;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?&lt;/p&gt; &lt;h2&gt;Why can the same EMA period produce different values?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;An EMA depends on its previous value and initialization, not only its period.&lt;/strong&gt; 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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Platforms may also seed the first EMA differently. In &lt;span&gt;QuantConnect's EMA documentation&lt;/span&gt;, 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.&lt;/p&gt; &lt;h2&gt;How many warm-up candles does an EMA need?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;Suppose two EMA 20 calculations start 10 apart, then receive exactly the same prices. Here is how that gap shrinks as new prices arrive:&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;How much of the EMA 20 starting gap remains?&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;Updates&lt;/th&gt;
&lt;th&gt;Remaining difference, approximately&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;EMA 20, initial difference 10&lt;/td&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1.351&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EMA 20, initial difference 10&lt;/td&gt;
&lt;td&gt;60&lt;/td&gt;
&lt;td&gt;0.0247&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EMA 20, initial difference 10&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;0.00045&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;These values come from 10 × (19/21)&lt;sup&gt;k&lt;/sup&gt;, 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.&lt;/p&gt;
&lt;img 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." src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fema-inline-en-18f4aaa99070.png" width="800" height="567"&gt;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. &lt;h2&gt;Can a tiny indicator difference change a trade?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What does recursive analysis actually test?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;ol&gt;
&lt;li&gt;Fix the market, timeframe, end time, price field and indicator implementation.&lt;/li&gt;
&lt;li&gt;Compute with several historical starting points and compare the same overlapping period.&lt;/li&gt;
&lt;li&gt;Inspect values near thresholds and compare entry, crossover and exit timestamps.&lt;/li&gt;
&lt;li&gt;Choose a startup length, freeze it and rerun the formal test.&lt;/li&gt;
&lt;li&gt;Save the actual data count, first and last timestamps, and first permitted trading time.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What else should you check after a restart?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How do you make startup conditions reproducible?&lt;/h2&gt; &lt;p&gt;Save periods, historical start, initialization method, warm-up count and trading start. &lt;span&gt;AlgoRover Research&lt;/span&gt; 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.&lt;/p&gt; &lt;p&gt;For a closer look at how signals lead to trades, see &lt;span&gt;EMA crossovers and ATR exits&lt;/span&gt;. After a restart, pick a few matching candles and compare the values and decisions. That gives you somewhere concrete to start looking.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt;
&lt;h3&gt;Are 200 candles enough for EMA 200?&lt;/h3&gt;
&lt;p&gt;Having a value does not establish convergence. Compare different history lengths at the same end time and inspect both indicators and signals.&lt;/p&gt; &lt;h3&gt;Is a longer warm-up always better?&lt;/h3&gt;
&lt;p&gt;More history generally reduces initial-value influence but requires more data. Look for a stable, reproducible configuration rather than a return-maximizing count.&lt;/p&gt; &lt;h3&gt;Does zero recursive variance prove matching live signals?&lt;/h3&gt;
&lt;p&gt;No. A final-row comparison does not validate every decision, data timestamp or execution setting.&lt;/p&gt; &lt;h3&gt;Why do two platforms calculate different EMAs?&lt;/h3&gt;
&lt;p&gt;Compare seeds, price fields, date ranges, live versus closed candles and missing-data rules before attributing the difference to precision.&lt;/p&gt; &lt;h2&gt;Did the restart change the orders too?&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;span&gt;Continue the execution checks with Live&lt;/span&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Freqtrade: recursive analysis&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Freqtrade: strategy startup period&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;Not investment advice.&lt;/small&gt;&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>How to Verify AI-Generated Trading Strategies Against Your Rules</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:19:37 +0000</pubDate>
      <link>https://dev.to/algorover/how-to-verify-ai-generated-trading-strategies-against-your-rules-2cpc</link>
      <guid>https://dev.to/algorover/how-to-verify-ai-generated-trading-strategies-against-your-rules-2cpc</guid>
      <description>&lt;span&gt;Backtest Validation&lt;/span&gt; &lt;p&gt;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.&lt;/p&gt;   &lt;p&gt;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?&lt;/p&gt; &lt;h2&gt;Does a working backtest prove the strategy is correct?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;Successful execution shows that the program ran. Correct implementation requires comparing the requested rules with observed behavior.&lt;/strong&gt; Compilation, a clean run and a performance report do not individually establish closed-candle confirmation, crossover timing or position limits.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How is “crosses above” different from “is above”?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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:&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;Where do “is above” and “crosses above” differ?&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Fast&lt;/th&gt;
&lt;th&gt;Slow&lt;/th&gt;
&lt;th&gt;Fast is above slow&lt;/th&gt;
&lt;th&gt;Crosses above now&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;99&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No previous value supplied&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt;
&lt;img alt="For the assumed values in the table, the crossover happens at B. At C the fast line remains above, without another crossover." src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Frules-inline-en-606db2c2c788.png" width="800" height="567"&gt;For the assumed values in the table, the crossover happens at B. At C the fast line remains above, without another crossover. &lt;h2&gt;What belongs in a trading-strategy specification?&lt;/h2&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data:&lt;/strong&gt; market, timeframe, price field and closed versus unfinished candles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entry:&lt;/strong&gt; an event or a persistent state, equality behavior and repeated entries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exit:&lt;/strong&gt; stop conditions and priority when several exits trigger together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Size:&lt;/strong&gt; allocation or risk-based sizing, maximum exposure and additional entries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timing:&lt;/strong&gt; signal time, order submission time and fill assumptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Costs:&lt;/strong&gt; fee and slippage settings, plus the evaluation start.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Do timeframe, position size and fees need checking too?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How do you validate AI-generated trading rules?&lt;/h2&gt; &lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Freeze the request.&lt;/strong&gt; Save a dated version instead of overwriting the original.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Map each rule to its implementation.&lt;/strong&gt; Identify parameters, conditions and unresolved defaults.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write small cases with expected behavior.&lt;/strong&gt; Include no entry, exact threshold, equality, an existing position and conflicting exits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspect events.&lt;/strong&gt; Separate data timestamps, indicator values, conditions, orders and fills. Find the first disagreement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeat checks after a fix.&lt;/strong&gt; Record the change and rerun previously correct cases.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Can an AI debugging fix change the strategy?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;What comes after implementation checks?&lt;/h2&gt; &lt;p&gt;Evaluate &lt;span&gt;which AI strategies deserve further testing&lt;/span&gt;, &lt;span&gt;parameter-selection bias&lt;/span&gt;, costs and out-of-sample behavior. Correct rules and a useful trading edge are separate conclusions.&lt;/p&gt; &lt;p&gt;When you already have rules and backtest material, &lt;span&gt;AlgoRover Research&lt;/span&gt; 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.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt;
&lt;h3&gt;Is asking the same AI to review its code enough?&lt;/h3&gt;
&lt;p&gt;It can help, but retain independently specified expected behavior and actual run evidence. Another reviewer can examine important assumptions without inheriting the same interpretation.&lt;/p&gt; &lt;h3&gt;Can I review code without checking trades?&lt;/h3&gt;
&lt;p&gt;Code describes intended behavior; logs show this run's behavior. Data, timing and order settings can change the outcome, so compare both.&lt;/p&gt; &lt;h3&gt;Can I keep an AI parameter change if returns improve?&lt;/h3&gt;
&lt;p&gt;Treat it as a new research candidate, record the change and validate it. Improved returns do not establish compliance with the original request.&lt;/p&gt; &lt;h3&gt;Does passing rule checks make a strategy live-ready?&lt;/h3&gt;
&lt;p&gt;Data quality, costs, out-of-sample evidence and execution checks still matter. Implementation consistency is one gate.&lt;/p&gt; &lt;h2&gt;Check whether orders follow the rules&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;span&gt;Continue checking execution with Live&lt;/span&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;QuantHarness research paper&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Full paper: research trajectories and evidence&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;Not investment advice.&lt;/small&gt;&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Partial Fills: How to Check Position Size, Remaining Orders and Stops</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:18:10 +0000</pubDate>
      <link>https://dev.to/algorover/partial-fills-how-to-check-position-size-remaining-orders-and-stops-139d</link>
      <guid>https://dev.to/algorover/partial-fills-how-to-check-position-size-remaining-orders-and-stops-139d</guid>
      <description>&lt;span&gt;Risk Management&lt;/span&gt; &lt;p&gt;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.&lt;/p&gt;   &lt;p&gt;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?&lt;/p&gt; &lt;h2&gt;What is your position after a partial fill?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;Check what has filled and what your account holds. The unfilled part may still execute.&lt;/strong&gt; 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:&lt;/p&gt; &lt;div class="table-wrapper-paragraph"&gt;You order 1 BTC. What happens after a partial fill?&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;Cumulative fill&lt;/th&gt;
&lt;th&gt;Open quantity&lt;/th&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;First fill: 0.4 BTC&lt;/td&gt;
&lt;td&gt;0.4 BTC&lt;/td&gt;
&lt;td&gt;0.6 BTC&lt;/td&gt;
&lt;td&gt;Position and protection size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cancellation requested&lt;/td&gt;
&lt;td&gt;Use confirmed records&lt;/td&gt;
&lt;td&gt;Cancellation not yet confirmed&lt;/td&gt;
&lt;td&gt;Any additional fills&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Another 0.2 BTC fills&lt;/td&gt;
&lt;td&gt;0.6 BTC&lt;/td&gt;
&lt;td&gt;0.4 BTC&lt;/td&gt;
&lt;td&gt;Average price and protection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remaining 0.4 BTC cancellation confirmed&lt;/td&gt;
&lt;td&gt;0.6 BTC&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;Final account and order state&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;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.&lt;/p&gt;
&lt;img alt="For the 1 BTC order described above, cancellation leaves the filled 0.6 BTC held. Only the remaining 0.4 BTC is canceled." src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Ffills-inline-en-6ba5c25ace1f.png" width="800" height="567"&gt;For the 1 BTC order described above, cancellation leaves the filled 0.6 BTC held. Only the remaining 0.4 BTC is canceled. &lt;h2&gt;How should you size a stop after partial fills?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How much should you reorder after canceling a partial fill?&lt;/h2&gt; &lt;p&gt;Confirm the remainder's final state first, then calculate &lt;strong&gt;original target quantity minus final cumulative fills&lt;/strong&gt;. 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.&lt;/p&gt; &lt;p&gt;&lt;span&gt;Bybit's cancel-order documentation&lt;/span&gt; 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.&lt;/p&gt; &lt;h2&gt;How do GTC, IOC and FOK affect a remainder?&lt;/h2&gt; &lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GTC:&lt;/strong&gt; the unfilled portion generally remains open until filled, canceled or otherwise terminated under venue rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IOC:&lt;/strong&gt; execute what is immediately available and cancel the remainder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FOK:&lt;/strong&gt; fill the entire order immediately or cancel it.&lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;How do partial fills change average entry and risk?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Why can a backtest fill an order that live trading only partly fills?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;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.&lt;/p&gt; &lt;h2&gt;Which records make a fill sequence explainable?&lt;/h2&gt; &lt;p&gt;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.&lt;/p&gt; &lt;p&gt;If an order still has no fill report, continue with &lt;span&gt;submitted versus filled orders&lt;/span&gt;. To estimate the funding and risk associated with a position first, use the &lt;span&gt;spot position-size calculator&lt;/span&gt;.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt;
&lt;h3&gt;Does canceling the remainder undo completed fills?&lt;/h3&gt;
&lt;p&gt;No. Completed fills still establish holdings. Confirm the cancellation and inspect any fills that arrived before it completed.&lt;/p&gt; &lt;h3&gt;Can I resend the original order size after a partial fill?&lt;/h3&gt;
&lt;p&gt;Reconcile cumulative fills and the original remainder first. Resending the full quantity can exceed the intended position.&lt;/p&gt; &lt;h3&gt;Is a stop matching the filled quantity always sufficient?&lt;/h3&gt;
&lt;p&gt;Check existing positions, fee deductions, available balances, other protection orders and venue-specific direction and size rules.&lt;/p&gt; &lt;h3&gt;Does a paper partial fill predict live fill rates?&lt;/h3&gt;
&lt;p&gt;Read the simulator's rules. Simulated events can test handling logic without reproducing real queue position, market impact or available quantity.&lt;/p&gt; &lt;h2&gt;Check fills and open orders before ordering again&lt;/h2&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;span&gt;See how to inspect orders and positions in Live&lt;/span&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;QuantConnect: trade fills&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;QuantConnect: order events&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Bybit: GTC, IOC and FOK&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;Not investment advice.&lt;/small&gt;&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
    </item>
    <item>
      <title>Martingale Capital Requirements: Can You Fund the Next Doubling Order?</title>
      <dc:creator>AlgoRover</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:18:06 +0000</pubDate>
      <link>https://dev.to/algorover/martingale-capital-requirements-can-you-fund-the-next-doubling-order-3jim</link>
      <guid>https://dev.to/algorover/martingale-capital-requirements-can-you-fund-the-next-doubling-order-3jim</guid>
      <description>&lt;span&gt;Risk Management&lt;/span&gt; &lt;p&gt;The first six orders cost 6,300 USDT together. The next needs 6,400 on its own. Check remaining cash and addition counts before planning another buy.&lt;/p&gt;   &lt;p&gt;The first order is only 100 USDT. Then each additional order doubles, until the next one needs 6,400 USDT after you have already committed 6,300. The easy number to overlook is the next order. How many entries can a 10,000 USDT budget fund, and what does doubling the budget actually buy?&lt;/p&gt; &lt;h2&gt;What determines a martingale strategy's capital requirement?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;Start with the initial order, subsequent order amounts, multiplier and maximum count.&lt;/strong&gt; Spot averaging down, increasing stakes after closed losing trades, and leveraged derivatives have different cash flows and risks. The label “martingale” does not make them one model.&lt;/p&gt; &lt;p&gt;Suppose you start with a 100 USDT spot purchase and spend twice as much on each additional order, keeping what you buy. Leave leverage and fees aside for now and check whether your budget covers the next order. To work out unrealized losses or break-even, you will also need the price of each purchase.&lt;/p&gt; &lt;h2&gt;How many doubling orders can 10,000 USDT fund?&lt;/h2&gt; &lt;div class="table-wrapper-paragraph"&gt;Spot cash commitments: initial 100 USDT, multiplier 2&lt;table&gt;&lt;thead&gt;&lt;tr&gt;
&lt;th&gt;Order&lt;/th&gt;
&lt;th&gt;This order&lt;/th&gt;
&lt;th&gt;Total committed&lt;/th&gt;
&lt;th&gt;Next order&lt;/th&gt;
&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1: initial entry&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;700&lt;/td&gt;
&lt;td&gt;800&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;800&lt;/td&gt;
&lt;td&gt;1,500&lt;/td&gt;
&lt;td&gt;1,600&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;1,600&lt;/td&gt;
&lt;td&gt;3,100&lt;/td&gt;
&lt;td&gt;3,200&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;3,200&lt;/td&gt;
&lt;td&gt;6,300&lt;/td&gt;
&lt;td&gt;6,400&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;6,400&lt;/td&gt;
&lt;td&gt;12,700&lt;/td&gt;
&lt;td&gt;12,800&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt; &lt;p&gt;All amounts are in USDT. With 10,000 available, you can pay for six orders: the first purchase plus five additions. That leaves 3,700, short of the 6,400 needed for order seven. You have spent 6,300 buying assets; that does not mean you have lost 6,300.&lt;/p&gt;
&lt;img alt="With a 100 USDT first order and each later amount doubled, order seven takes cumulative spending above the 10,000 USDT budget." src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstorage.ghost.io%2Fc%2F6d%2Fbb%2F6dbbb7cc-1f93-4cd3-8d75-e3c2cfce055f%2Fcontent%2Fimages%2F2026%2F11%2Fmartingale-inline-en-6eff6e298c1c.png" width="800" height="567"&gt;With a 100 USDT first order and each later amount doubled, order seven takes cumulative spending above the 10,000 USDT budget. &lt;h2&gt;Do six orders mean six additions? How much is the next shortfall?&lt;/h2&gt; &lt;p&gt;&lt;strong&gt;Six orders include the initial purchase, so that is five additions.&lt;/strong&gt; Under these amounts, the next order needs 6,400 USDT and you have 3,700 left: a shortfall of 2,700. Before setting a maximum addition count, check whether the tool counts the initial order.&lt;/p&gt; &lt;p&gt;&lt;span&gt;OKX's spot DCA parameters&lt;/span&gt; distinguish the initial order, safety orders and maximum safety-order count. Use the tool's definitions when comparing your funding table with its configuration.&lt;/p&gt; &lt;p&gt;Order n costs 100 × 2&lt;sup&gt;n−1&lt;/sup&gt;. The first n orders require 100 × (2&lt;sup&gt;n&lt;/sup&gt; − 1). The seventh order alone needs 100 more than the first six combined. Small beginnings are a poor description of the final bill.&lt;/p&gt; &lt;h2&gt;Does doubling capital double the number of additions?&lt;/h2&gt; &lt;p&gt;Keep the first order at 100 and double each new order. With 20,000 available, you can cover seven orders totaling 12,700. Eight would need 25,500. Under these settings, doubling your budget buys room for just one more order.&lt;/p&gt; &lt;p&gt;If you also double the initial order to 200, the budget-to-initial-order ratio stays unchanged. The number of affordable layers does not increase. Fees, minimum order sizes and reserved cash can reduce what the theoretical budget actually funds.&lt;/p&gt; &lt;h2&gt;Why can a lower average entry still mean greater risk?&lt;/h2&gt; &lt;p&gt;Buying below the existing average lowers the weighted entry while increasing holdings and committed cash. Further declines then affect a larger position. Calculating break-even requires actual quantities, prices and fees, not just a doubling multiplier.&lt;/p&gt; &lt;p&gt;Look at both numbers in your account: how far the average entry fell and how much the position grew. The lower average brings break-even closer, while the larger position increases losses if price keeps falling.&lt;/p&gt; &lt;h2&gt;Why separate order multipliers, price spacing and leverage?&lt;/h2&gt; &lt;p&gt;The amount multiplier changes cash needed for the next order. The spacing multiplier changes the distance to its trigger. OKX's spot DCA documentation treats the initial order, safety orders, amount and spacing as distinct parameters.&lt;/p&gt; &lt;p&gt;Derivatives add margin, maintenance requirements and liquidation rules. Bybit's futures martingale parameters specify a multiplier for opening cost; that is not a universal instruction to double coin quantity. A spot funding table cannot predict the liquidation layer of a leveraged contract.&lt;/p&gt; &lt;h2&gt;How should you stress-test an averaging-down plan?&lt;/h2&gt; &lt;ol&gt;
&lt;li&gt;List trigger prices, cash amounts and maximum count. State whether the initial order counts.&lt;/li&gt;
&lt;li&gt;Calculate cumulative commitments, remaining cash and the next order, with a fee reserve.&lt;/li&gt;
&lt;li&gt;Apply declared price paths to quantities, average entry and unrealized P&amp;amp;L, including prolonged declines and incomplete rebounds.&lt;/li&gt;
&lt;li&gt;Specify what happens to open holdings when capital or the maximum layer is reached.&lt;/li&gt;
&lt;li&gt;Freeze the rules before historical and out-of-sample evaluation instead of moving levels after seeing the path.&lt;/li&gt;
&lt;/ol&gt; &lt;p&gt;Identify settings that leave the next order unfunded before researching price paths and exits. &lt;span&gt;AlgoRover Research&lt;/span&gt; can help you understand existing strategy and backtest material. Before execution, check the addition counts and cash settings in the selected version.&lt;/p&gt; &lt;p&gt;You can also look at &lt;span&gt;the entry and exit rules of a dynamic DCA strategy&lt;/span&gt; and &lt;span&gt;what to check during a drawdown&lt;/span&gt;. Before adding again, compare the next order with your remaining cash. That tells you more than the small first purchase.&lt;/p&gt; &lt;h2&gt;Frequently asked questions&lt;/h2&gt;
&lt;h3&gt;Is martingale the same as regular dollar-cost averaging?&lt;/h3&gt;
&lt;p&gt;A fixed recurring purchase does not automatically increase after a previous purchase or loss. Inspect triggers and amount sequences rather than relying on labels.&lt;/p&gt; &lt;h3&gt;How much must price rebound after doubling entries?&lt;/h3&gt;
&lt;p&gt;Calculate total cost and acquired quantity using each fill and fee. The cash sequence alone does not determine one break-even price.&lt;/p&gt; &lt;h3&gt;Do consecutive losses make the next trade more likely to win?&lt;/h3&gt;
&lt;p&gt;Not merely because they happened. Probability depends on the trading process and conditions; increasing size does not itself improve the win rate.&lt;/p&gt; &lt;h3&gt;Is martingale safe with enough capital?&lt;/h3&gt;
&lt;p&gt;A finite budget supports a finite sequence. Price paths, exits and asset risk remain relevant; more capital does not guarantee recovery.&lt;/p&gt; &lt;h2&gt;Compare the funding plan with actual additions&lt;/h2&gt;
&lt;p&gt;Once the next order's cost is clear, run the selected strategy in a supported exchange Demo with AlgoRover Live. Compare its initial amount, addition multiplier and maximum count with orders and positions to check whether execution follows your funding plan.&lt;/p&gt;
&lt;span&gt;Check an averaging-down strategy in Live&lt;/span&gt; &lt;h2&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;OKX: spot DCA parameters&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Bybit: futures martingale parameters&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;small&gt;Not investment advice.&lt;/small&gt;&lt;/p&gt; 

</description>
      <category>algorithmictrading</category>
      <category>tradingbot</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
