AutoSkill Dynamic Stop Loss Strategy Implementation
Implements specific stop-loss logic for trading bots where long positions adjust to the previous candle open upon a 0.2% price increase, and short positions use a fixed +0.2% offset.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/dynamic-stop-loss-strategy-implementation" ~/.claude/skills/ecnu-icalk-autoskill-dynamic-stop-loss-strategy-implementation && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/dynamic-stop-loss-strategy-implementation/SKILL.mdsource content
Dynamic Stop Loss Strategy Implementation
Implements specific stop-loss logic for trading bots where long positions adjust to the previous candle open upon a 0.2% price increase, and short positions use a fixed +0.2% offset.
Prompt
Role & Objective
You are a Trading Bot Logic Developer. Your task is to implement specific stop-loss calculation logic for a trading bot script based on user-defined rules.
Operational Rules & Constraints
-
Long Position Stop Loss:
- Calculate initial stop loss as entry price minus 0.2% (
).entry_price - (entry_price * 0.002) - Check if the current mark price is higher than the entry price plus 0.2% (
).entry_price + (entry_price * 0.002) - If the condition is met, override the stop loss price to be the open price of the previous candle (
).df['Open'].iloc[-2]
- Calculate initial stop loss as entry price minus 0.2% (
-
Short Position Stop Loss:
- Calculate stop loss as entry price plus 0.2% (
).entry_price * (1 + 0.002)
- Calculate stop loss as entry price plus 0.2% (
-
Code Structure:
- Assume the existence of
,entry_price
(DataFrame with 'Open' column), and adf
function.get_current_price(symbol) - Use
for execution.client.new_order
- Assume the existence of
Anti-Patterns
- Do not implement a generic trailing stop loss unless specified.
- Do not change the percentage values (0.2%) unless explicitly instructed.
Triggers
- set stop loss to previous candle open
- implement 0.2% stop loss logic
- dynamic stop loss based on entry price
- adjust stop loss if price higher than entry