Prompt Details
Model
Chat - (gpt-5.6)
Token size
1,202
Example input
[TARGET_VERSION]: Pine Script v6
[SCRIPT_TYPE]: Strategy
[EXECUTION_PLATFORM]: Custom Webhook
[ALERT_MODE]: Strategy Order Fill
[SOURCE_CODE_OR_LOGIC]: //@version=4 strategy("RSI EMA Cross Strategy", overlay=true) len = input(15, "RSI Length") ema_len = input(200, "EMA Length") half_len = len / 2 trend_filter = close > ema(close, ema_len) ? true : na rsi_val = rsi(close, len) ema_val = ema(close, ema_len) longCondition = crossover(rsi_val, 30) and trend_filter if (longCondition) strategy.entry("Long", strategy.long) shortCondition = crossunder(rsi_val, 70) if (shortCondition) strategy.close("Long")
Example output
### Section 1: Detected Configuration & Assumptions
- Source Version: Pine Script v4
- Target Version: Pine Script v6
- Script Type: Strategy
- Execution Target: Custom Webhook
- Alert Mode: Strategy Order Fill (using strategy.order.alert_message)
Assumptions Requiring Confirmation:
- Account sizing, commissions, and slippage settings were not defined in the source script and are left to user strategy defaults.
---
### Section 2: Migration, Repaint & Execution Audit Table
| Original Token or Behavior | Category | Risk Level | Applied Change | Behavior Impact |
| :--- | :--- | :--- | :--- | :--- |
| //@version=4 | Deprecated Compiler | High | Upgraded to //@version=6 | Migrates script to latest Pine Script v6 runtime environment. |
| input(15, "RSI Length") | Generic Input Type | Medium | Replaced with input.int(15, ...) | Enforces strict integer typing for lookback length. |
| len / 2 | Silent Semantic Drift (Integer Division) | High | Replaced with int(len / 2) | In v6, 15 / 2 evaluates to float 7.5 instead of integer 7. Explicit casting int(len / 2) preserves original integer truncation without compiler errors. |
| trend_filter = ... ? true : na | Silent Semantic Drift (Boolean Strictness) | High | Replaced with nz(trend_filter, false) | v6 disallows implicit na-to-false casting in compound conditions. Using nz() ensures deterministic false evaluation when trend condition is unmet. |
| Duplicate ema() calculation | Code Hygiene | Low | Consolidated into single ema_val reference | Eliminates redundant calculation; no behavior change, improves execution efficiency. |
| rsi(close, len) | Deprecated Built-in | High | Migrated to ta.rsi(close, len) | Adheres to modern namespace standards. |
| ema(close, ema_len) | Deprecated Built-in | High | Migrated to ta.ema(close, ema_len) | Adheres to modern namespace standards. |
| crossover(...) / crossunder(...) | Deprecated Built-in | High | Migrated to ta.crossover(...) / ta.crossunder(...) | Adheres to modern namespace standards. |
| Static order execution | Webhook Automation Gap | Medium | Added alert_message argument to entry and close | Passes dynamic JSON payloads directly upon strategy order execution. |
---
### Section 3: Converted Pine Script Code
//@version=6
strategy(title="RSI EMA Cross Strategy v6", shorttitle="RSI_EMA_v6", overlay=true)
// Inputs
len = input.int(15, title="RSI Length", minval=1)
ema_len = input.int(200, title="EMA Length", minval=1)
half_len = int(len / 2)
// Indicator Calculations
ema_val = ta.ema(close, ema_len)
trend_filter = close > ema_val ? true : na
rsi_val = ta.rsi(close, len)
// Trading Conditions (with strict boolean handling)
longCondition = ta.crossover(rsi_val, 30) and nz(trend_filter, false)
shortCondition = ta.crossunder(rsi_val, 70)
// Dynamic Alert Payloads (No authentication tokens embedded in script)
long_alert_payload = '{"action": "buy", "ticker": "' + syminfo.ticker + '", "price": "' + str.tostring(close) + '"}'
close_alert_payload = '{"action": "close", "ticker": "' + syminfo.ticker + '"}'
// Strategy Execution with Dynamic Alert Messages
if longCondition
strategy.entry("Long", strategy.long, alert_message=long_alert_payload)
if shortCondition
strategy.close("Long", alert_message=close_alert_payload)
// Visuals
plot(ema_val, color=color.yellow, title="200 EMA")
---
### Section 4: Webhook & Alert Configuration
TradingView Alert Setup Instructions:
1. Apply the converted script to your TradingView chart.
2. Click Create Alert (Alt + A).
3. Under Condition, select RSI EMA Cross Strategy v6.
4. In the Notifications tab, enable Webhook URL and paste the exact endpoint URL provided by your execution platform dashboard.
5. In the Message box, paste the placeholder below:
{{strategy.order.alert_message}}
Generic Webhook Schema Reference (REQUIRES PLATFORM-SIDE VERIFICATION):
{
"action": "buy",
"ticker": "{{ticker}}",
"price": "{{close}}",
"timestamp": "{{timenow}}"
}
---
### Section 5: Manual Verification Checklist & Disclaimer
* ( ) Compile in Pine Editor: Paste the code into TradingView Pine Editor and click "Add to chart" to identify and resolve remaining compiler errors.
* ( ) Check for Silent Semantic Drift: Compare historical backtest net profit, drawdowns, and trade counts between the original script and the converted script over identical date ranges to ensure calculations did not drift.
* ( ) Check Timeframe & Chart Scaling: Confirm that RSI and EMA calculations align with your expected timeframe.
* ( ) Review Slippage & Commission: Configure realistic slippage and broker fee percentages in Strategy Properties.
* ( ) Verify Dynamic Webhook Placeholder: Ensure the TradingView Alert Message field contains {{strategy.order.alert_message}}.
* ( ) Paper Trade First: Run the automated webhook signals in paper-trading or a testnet environment prior to live deployment.
⚠️ Trading Risk Disclaimer: Backtested metrics do not guarantee live trading performance. Language models assist with code formatting and migration but do not execute live broker tests. Always verify script compilation and test webhook payloads in a sandbox or paper-trading environment before risking live capital.
By purchasing this prompt, you agree to our terms of service
GPT-5.6
Migrate legacy Pine Script (v2–v5) or plain trading logic into clean Pine Script v6 or v5. This prompt audits syntax deprecations, evaluates repainting, detects v6 silent semantic drift (integer division and boolean strictness), constructs structured webhook alert payloads, and outputs a manual verification checklist to preserve your core strategy semantics safely.
...more
Added 2 days ago
