$_
Console
Clear
×
[ready]
Trading Algo Generator ready
[info]
Select data file, configure prompts, and click Generate
</>
Trading Algo Generator
AI-powered trading strategy generation with automatic error fixing
-
/
-
today
multi-provider
$_
Console
1
Strategy Prompt
2
Code Generation
3
Execute & Test
4
Auto-Fix Errors
Demo limit reached. Add your own API key above for unlimited use, or wait until midnight.
<>
Configure Generation
AI Provider & Model
Moonshot AI
Anthropic
OpenAI
Loading...
No key? Demo mode uses Moonshot (2 req/day). Add your own key for unlimited use. |
Moonshot
·
Anthropic
·
OpenAI
Data File (OHLCV CSV)
Loading files...
Upload CSV
Select a data file or upload your own OHLCV CSV
Static Prompt
You are an expert Python developer specializing in algorithmic trading with the backtesting library (https://pypi.org/project/backtesting/). Your task is to write a complete, robust Python script that performs all steps below, using only the backtesting library for both backtesting and visualization. 1. Data Format & Preparation Input CSV file: [[csv_file]] CSV Columns: time,open_price,close_price,high_price,low_price,coin_volume Use only the last 2 years of data (relative to the latest date in the CSV). Parse date/time robustly. Prepare data in a format compatible with the backtesting library. 2. Strategy Implementation [[strategy_prompt]] 3. Backtest Parameters Initial balance: $10,000 Position size: Exactly 5% of current portfolio value for each trade (use integer rounding if required). Only 1 trade open at a time (no pyramiding or overlapping positions). Transaction fees: 0.03% for opening a position, 0.06% for closing. Futures trading: Support both LONG and SHORT positions. Use only the last 2 years of data. 4. Logging & Performance Metrics Print to the console: Each trade: open/close time, type (long/short), entry/exit price, size, fees, P&L per trade, running balance after each trade Total number of trades, win/loss counts, win rate (profit ratio) Overall P&L at end of backtest Maximum drawdown, Sharpe Ratio, Profit Factor, and any common performance metrics 5. Visualization Use ONLY the built-in plotting functionality of the backtesting library (no Plotly, no matplotlib, no Backtrader plotting) After running the backtest, save the interactive plot as plot.html in the working directory, but do NOT display it to the user (i.e., do not call plot.show() or any function that opens a window; just save the file). 6. Error Handling & Robustness Implement full error handling for file loading, data parsing, and invalid/missing columns. The script must be executable end-to-end as a single file with no user modification. Add clear comments and set all configurable parameters (fees, position size, etc.) at the top of the script. 7. Code Quality Modular, clean, and well-commented code. Follow best practices for Python scripting.
Use [[csv_file]] for data file and [[strategy_prompt]] for strategy.
Auto-Generation Instruction
Create a prompt that will generate a detailed trading strategy based on these requirements: 1. Define specific entry and exit conditions using technical indicators 2. Include risk management rules and position sizing guidelines 3. Specify any additional parameters needed for the strategy 4. Detail how to handle different market conditions 5. Include any special requirements for futures trading The prompt should be professional, precise, and focus on quantitative rules that can be implemented in code. Include 3-5 main trading rules or conditions that are clear and testable.
AI will generate a detailed strategy prompt from these instructions.
Generate & Run
Clear
-
Status
-
Attempts
-
Time (sec)
-
Lines of Code
▲
Interactive Plot
Download HTML
▼
</>
Generated Strategy Code
Download .py
Copy
▼
Saved:
-
>
Program Output
▼
$
Execution Log
▼
■
Generated Charts
▼
✦
AI-Generated Strategy Prompt
▼
☰
Final Combined Prompt
▼
×