Introduction
In the field of quantitative trading, the rolling position strategy is an attractive yet challenging topic. The core concept of this strategy is to reinvest realized profits back into trades during trending markets, achieving compound growth. This article will explore in depth how to transform the trading idea of rolling positions step by step into executable code logic, focusing on the thought process rather than technical details. It should be noted that while the rolling position strategy amplifies returns, it also amplifies risks. This article is intended for educational and discussion purposes only.
strategy: https://www.fmz.com/strategy/521864
I. In-Depth Analysis of the Profit Logic Behind Rolling Position Strategies
1.1 The Mathematical Essence of Rolling Positions
The profit logic of the rolling position strategy is essentially a compound growth model. Let's understand this with a simplified example:
Traditional single trade (3 consecutive 10% gains):
- Initial capital: 100 USDT, 3x leverage
- Market gain: (1+10%) × (1+10%) × (1+10%) - 1 = 33.1%
- Profit: 100 × 3 × 33.1% = 99.3 USDT
Final: 199.3 USDT
Rolling position trade (3 consecutive 10% gains):Round 1: 100 USDT → Profit 30 USDT → Capital becomes 130 USDT
Calculation: 100 × 3x leverage × 10% gain = 30Round 2: 130 USDT → Profit 39 USDT → Capital becomes 169 USDT
Calculation: 130 × 3x leverage × 10% gain = 39Round 3: 169 USDT → Profit 50.7 USDT → Capital becomes 219.7 USDT
Calculation: 169 × 3x leverage × 10% gain = 50.7
Comparison:
Under the same market conditions of 3 consecutive 10% gains:
- Single trade: Profit of 99.3 USDT
- Rolling position trade: Profit of 119.7 USDT
- Compounding advantage: 20.4 USDT (approximately 20.5% improvement) With the same 3 consecutive 10% gains, a single trade yields 99.3 USDT profit, while rolling positions yield 119.7 USDT profit. This difference is the power of compounding.
Expressed mathematically:
pine
Traditional trading: Final capital = Initial capital × (1 + Leverage × Price change)
Rolling position trading: Final capital = Initial capital × (1 + Leverage × Single price change) ^ Number of rolls
This reveals the essence of rolling positions: transforming linear growth into exponential growth. However, it also exposes the risk: a single stop-loss can wipe out all previous compound gains.
1.2 Three Core Questions of Rolling Position Strategies
Before writing any code, we need to answer three fundamental questions at the strategy level:
Question 1: When to start? (Initial entry)
This requires identifying the signal for the beginning of a trend.
Question 2: When to continue? (Adding rolling positions)
This is the core of rolling positions: how to determine whether the trend continues after taking profit?
Question 3: When to stop? (Exit and observe)
- Active exit: Trend weakening
- Passive exit: Stop-loss triggered These three questions determine the entire framework of the strategy. Below, we will transform each of them into code logic one by one.
II. Question One: When to Start? — Finding the Trigger Point for Entry
2.1 Ideal vs. Reality of Rolling Position Strategies
Let's first understand the ideal application scenario for rolling position strategies.
*Ideal scenario: *
Imagine if you could enter when SHIB started rising from $0.000001, or establish a position on the eve of an altcoin's explosive rally. Through consecutive rolling positions, 100 USDT could become 10,000 USDT or even more. This is the ultimate dream of the rolling position strategy—entering before a coin explodes and capturing ten-fold or even hundred-fold returns.
*Harsh reality: *
But the problem is, how do you know which coin will surge? And when will it surge?
- If you're a project insider or have inside information, you might know positive news in advance
- If you're an ordinary trader, you can only rely on market signals to make judgments For most of us, trying to precisely capture such explosive moments is, frankly speaking, pure luck. We cannot predict the future; we can only use historical data and technical indicators to increase the probability of "getting lucky."
2.2 From Ideal to Reality: Simulating Entry with Technical Indicators
Since we cannot predict which coin will surge, what we can do is: establish an executable set of entry rules and use technical indicators to simulate "trend initiation" signals.
It's like fishing in a vast ocean. Although we don't know where the big fish are, we can:
- Observe ripples on the surface (price fluctuations)
- Analyze the direction of currents (trend direction)
- Choose appropriate tools (technical indicators) When multiple signals converge, we believe a trend "might" be starting, so we enter and try. If we're right, we ride the trend and profit through rolling positions; if we're wrong, we cut losses promptly and exit.
2.3 Technical Implementation of Entry Signals
*Choosing technical tools: *
We use a dual EMA system (EMA5 and EMA10) as our trend identification tool. The reasons for this choice are simple:
- Simple and intuitive, easy to verify
- Responds quickly to price changes
- Parameters balance sensitivity and stability *Core logic: *
Capture trend turning points by detecting "golden crosses" (EMA5 crossing above EMA10) and "death crosses" (EMA5 crossing below EMA10):
- Golden cross → Long signal
- Death cross → Short signal Code approach:
javascript
1. Retrieve data from two consecutive candlesticks
2. Calculate EMA5 and EMA10 for each
3. Compare the change in their relative positions
4. Detect crossover → Determine direction → Open position
We won't delve into the details of golden and death crosses here, as these are fundamental concepts in trading. The key point is: we need a clear, quantifiable entry signal to trigger the starting point of rolling positions.
III. Question Two: When to Continue? — The Core Mechanism of Compound Rolling Positions
**3.1 Understanding the Essence of Rolling Positions: A Rational **Adventurer's Game
The rolling position strategy is essentially a rational adventurer's game. Let's understand it through a complete scenario:
Game rules:
javascript
1. You take out 100 USDT from your exchange account as adventure capital
2. This 100 USDT is managed independently, isolated from other funds in your account
3. You start trading with this 100 USDT:
- Win → Profits are added to the capital pool, continue trading with larger capital (rolling)
- Lose → Stop-loss triggered, return to empty position
4. Repeat this process until:
- Either you lose all 100 USDT (game over)
- Or you roll to a satisfactory amount (voluntary exit)
The brilliance of this game lies in:
- Controlled risk: Maximum loss is 100 USDT, without affecting other funds in your account
- Unlimited upside: If the trend cooperates, compounding can quickly double your capital
- Clear rules: Definite take-profit, stop-loss, and rolling position rules 3.2 Capital Pool Design: The Key to Achieving Compound Growth This is the most crucial design concept in the rolling position strategy.
Problems with the traditional approach:
Suppose your exchange account has 1,000 USDT:
- First position opened with 100 USDT
- After profiting 30 USDT, account becomes 130 USDT
- How much should you use for the second position? 100 or 130?
- How do you distinguish whether this is profit from the rolling strategy or from other operations? Capital pool solution:
pine
Create a virtual "strategy capital pool":
Initialization:
strategyCapital = 100 // Allocate 100 USDT from account
1st trade:
Position size = 100 USDT
Profit after take-profit = 30 USDT
strategyCapital = 100 + 30 = 130 USDT
2nd trade (rolling):
Position size = 130 USDT // Automatically uses profit from 1st trade
Profit after take-profit = 39 USDT
strategyCapital = 130 + 39 = 169 USDT
3rd trade (rolling):
Position size = 169 USDT // Continue compounding
...
Advantages of this design:
- Capital isolation: The strategy only uses the designated 100 USDT, without affecting other account funds
- Automatic compounding: Each profit is automatically added to the capital pool, naturally using larger amounts for the next position
- Controlled risk: Worst case scenario is losing 100 USDT, never exceeding expectations
- Clear tracking: You can precisely know how much the strategy has grown from 100 USDT 3.3 Rolling Decision: Continue or Stop After Take-Profit? This is the soul of the rolling position strategy: after a take-profit order is filled, we must make a critical decision—continue rolling or stop?
Decision scenario:
Suppose we're long on BTC:
- Entry price: 45,000 USDT, opened position with 100 USDT
- Take-profit price: 49,500 USDT (10% increase)
- Take-profit filled, profit of 30 USDT
- Current capital pool: 130 USDT
Here's the question:
Option A: Stop, exit with 130 USDT, return to empty position
Option B: Continue, open another long position with 130 USDT (rolling)
How to choose?
This decision cannot rely on "intuition"; it must have clear criteria. Our judgment logic is: Is the trend still continuing?
Judgment method:
At the moment the take-profit order is filled, recalculate the latest technical indicators (EMA):
javascript
If the original direction is long:
Check if EMA5 is still above EMA10?
- Yes → Uptrend not broken → Continue long (rolling)
- No → Trend may be weakening → Stop, end this round
If the original direction is short:
Check if EMA5 is still below EMA10?
- Yes → Downtrend not broken → Continue short (rolling)
- No → Trend may be weakening → Stop, end this round
3.4 Rolling Position Execution Flow
If the decision is "continue rolling":
pine
1. Update capital pool
strategyCapital = Original capital + Current profit
2. Reopen position based on new capital pool
New position size = strategyCapital × Leverage
3. Place new take-profit order
New take-profit price = New entry price × (1 + Take-profit ratio)
4. Set new stop-loss price
New stop-loss price = New entry price × (1 - Stop-loss ratio)
5. Increment rolling counter
rolls = rolls + 1
If the decision is "stop":
pine
1. Save statistics for this round
- Number of rolls
- Total profit
- How much 100 grew to
- Duration
2. Retain capital pool amount
strategyCapital keeps current value
3. Return to empty position
Wait for next entry signal
Key points of this flow:
- Judge immediately after each take-profit, no delay
- Judgment criteria are objective (moving average relationship), not subjective speculation
- If continuing, increase position size; if stopping, preserve gains 3.5 The Power and Cost of Compounding Let's feel the power of compounding through a complete example:
Success case:
Initial capital: 100 USDT
Take-profit ratio: 10%
Leverage: 3x
Round 1: 100 USDT → Profit 30 → Capital pool 130
Round 2: 130 USDT → Profit 39 → Capital pool 169
Round 3: 169 USDT → Profit 50.7 → Capital pool 219.7
Round 4: 219.7 USDT → Profit 65.9 → Capital pool 285.6
Round 5: 285.6 USDT → Profit 85.7 → Capital pool 371.3
Rolling 5 consecutive times, 100 becomes 371.3, a 271% increase!
Failure case:
javascript
Round 1: 100 USDT → Profit 30 → Capital pool 130
Round 2: 130 USDT → Profit 39 → Capital pool 169
Round 3: 169 USDT → Trend reverses → Stop-loss triggered
Stop-loss ratio 5%, loss: 169 × 3 × 5% = 25.35 USDT
Remaining capital: 169 - 25.35 = 143.65 USDT
Originally rolled from 100 to 169, after one stop-loss only 143.65 remains
This is the double-edged sword of rolling positions:
- When successful: Exponential growth, exhilarating
- When failed: Rapid giveback, or even losses
IV. Question Three: When to Stop? — Stop-Loss Is the Last Line of Defense
4.1 Two Types of Exit
Active exit: Trend weakening
— This situation was already addressed in "Question Two"—after take-profit, if the trend doesn't support continuation, we actively choose to stop. This is the ideal exit method, leaving with profits.
Passive exit: Stop-loss triggered
— This is what we need to focus on now—when the market moves against us, price hits the stop-loss line, and we're forced to close the position.
4.2 The Necessity of Stop-Loss
Many people dislike stop-losses because:
- Stop-loss means admitting you were wrong
- Stop-loss results in actual losses
- Sometimes the price bounces back after a stop-loss But in the rolling position strategy, stop-loss is the lifeline for survival. Think about it:
python
Without stop-loss:
Round 1: 100 → Rolled to 169
Round 2: 169 → Trend reverses, no stop-loss
Price keeps falling: 169 → 150 → 120 → 80 → 50...
Could eventually lose everything, or even get liquidated
python
With stop-loss:
Round 1: 100 → Rolled to 169
Round 2: 169 → Trend reverses, stop-loss triggered
Stop-loss 5%: Loss of 25.35
Remaining: 143.65
Although a loss occurred, most of the capital is preserved
Can wait for the next opportunity
The essence of stop-loss: Use small, certain losses to avoid large, uncertain risks.
4.3 Game Over Conditions
Remember the "rational adventurer's game" we mentioned? This game has clear ending conditions:
Condition 1: Capital pool reaches zero
If strategyCapital <= 0:
→ Game over
→ This adventure failed
→ 100 USDT completely lost
Condition 2: Voluntary exit
javascript
If strategyCapital >= Target amount (e.g., 500):
→ Can choose to exit voluntarily
→ Lock in profits
→ Start a new round with 100 USDT
Condition 3: Maximum rolling count reached
python
Can set a safety threshold:
If consecutive rolls >= 10:
→ Exit voluntarily even if trend continues
→ Because duration is too long, risk accumulates
→ Quit while you're ahead
4.4 Balancing Risk and Reward
The core of the entire rolling position strategy design is finding balance between risk and reward:
Reward side:
- Compound growth: Capital pool grows after each take-profit
- Trend capture: Continuous profits during uptrends/downtrends
No ceiling: Theoretically can roll indefinitely
Risk side:Stop-loss protection: Maximum loss of X% of capital pool per trade
Capital isolation: Maximum loss of 100 USDT
Trend judgment: Avoid frequent stop-losses in ranging markets
Backtest reference:
Analysis of TRUMP_USDT Binance futures listing day backtest (January 20, 2025 to January 21, 2025):
V. The Essence and Limitations of the Strategy
5.1 What Is This Strategy Simulating?
Through the analysis above, we can clearly see that this strategy is essentially simulating:
The trading behavior of a rational adventurer:
- Has clear entry rules (not impulsive trading)
- Has take-profit targets (not greedy)
- Has stop-loss discipline (doesn't hold losing positions stubbornly)
- Has rolling position judgment (knows how to utilize profits)
Has capital limits (controls risk)
Its core logic is:Set aside fixed capital (100 USDT) to try
When encountering a trend, follow the trend to make money
After making money, use profits to continue trading (compound interest)
If the trend weakens, stop promptly
If the judgment is wrong, cut losses quickly
Continue until capital is depleted or rolled to a satisfactory amount
5.2 Limitations of the Strategy
Limitation 1: Depends on trending markets
This strategy performs poorly in ranging markets because:
- Frequent false breakouts occur
- Price retraces after take-profit, unable to roll positions
- Repeated stop-losses deplete the capital pool Limitation 2: Parameter sensitivity
Parameters like 10% take-profit and 5% stop-loss are not optimal:
- Different coins have different volatilities
- Different market conditions require different parameters
- Fixed parameters cannot adapt to all situations Limitation 3: Cannot predict explosive moments
As mentioned earlier, using technical indicators for entry is essentially "relying on luck":
- May miss truly significant moves
- May enter on false breakouts
Cannot position in advance like insiders
5.3 Directions for Improvement
Direction 1: Combine with workflows to screen coinsDon't just pick any random coin to roll
First use workflows to screen for trending coins with strong explosive potential
For example: surging social media discussions, abnormal trading volume, active on-chain data, etc.
Using the rolling position strategy on these coins will have a higher success rate
Direction 2: Dynamically adjust parametersAdjust take-profit and stop-loss ratios based on the coin's historical volatility
For highly volatile coins, widen the stop-loss range appropriately
For less volatile coins, lower the take-profit target
Direction 3: Multiple capital pools in parallelDon't put 100 USDT on a single coin
Instead, split it into 5 pools of 20 USDT, rolling simultaneously on 5 potential coins
Diversify risk and increase the probability of "hitting the jackpot"
Conclusion
Through the exploration of three core questions, we have fully demonstrated how to transform the trading idea of rolling positions into code logic. The essence of this process is: expressing a rational adventurer's trading mindset through precise rules and data structures.
Important note:
This is merely a simulated implementation of the rolling position concept. In reality, rolling positions is a trading strategy that requires significant market experience. This strategy is just a tool. When combined with workflows to identify trending or highly explosive coins in the future, using this tool may bring us more surprises.
Remember:
- Maximum loss is 100 USDT, risk is controllable
- If you're lucky enough to catch a major trend, you could multiply your capital several times or even tens of times
- But more often, it may be small wins and small losses, repeatedly testing
This is a game that requires patience and discipline
There is no strategy that guarantees profits without losses—rolling positions is just a tool. What truly determines success or failure is whether you can:Find coins with potential (combined with workflow screening)
Consistently execute stop-losses (don't hold stubbornly)
Dare to roll positions when major trends arrive (don't exit too early)
Stay rational (don't let emotions take control)
Wishing everyone success in finding their own "big break" on the path of quantitative trading!

Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.