Skip to content
Algo Trade Analytics Docs

Context & Attachments

Basic & Pro Plans

Context attachments allow you to share additional information with the AI beyond just your chat message. This includes code selections, full scripts, images, and most powerfully—your execution analysis reports.


The AI can only see what you share. Attachments provide:

  • Precision — Point the AI at exactly what you’re asking about
  • Data-Driven Insights — Let the AI analyze your actual trading performance
  • Visual Context — Share screenshots of charts or error messages
  • Multi-File Awareness — Reference code from multiple script tabs

Shares the complete contents of a script tab.

When to use:

  • Starting a new conversation about a strategy
  • Asking for a comprehensive review
  • Requesting refactoring of the entire script

How to attach:

  1. Click the 📎 button in the chat input
  2. Select “Share Active Tab” or choose a specific tab
  3. The script appears in your context area

Shares only the highlighted portion of your code.

When to use:

  • Asking about a specific function
  • Debugging a particular section
  • Requesting changes to targeted code

How to attach:

  1. Select code in the editor
  2. Click “Share Selection” in the chat toolbar
  3. The selection appears with line numbers

Upload screenshots or diagrams.

When to use:

  • Sharing TradingView chart screenshots
  • Showing error dialogs
  • Providing visual reference for desired output

How to attach:

  1. Click the 📎 button
  2. Select “Add Image”
  3. Choose a file from your computer

Supported formats: PNG, JPG, GIF, WebP

Attach saved execution reports from Backtest vs Alerts or Alerts vs Fills.

When to use:

  • Optimizing strategy based on real performance data
  • Debugging discrepancies between backtest and live
  • Getting AI recommendations for execution improvements

How to attach:

  1. Click the 📊 button
  2. Search or browse your saved reports
  3. Select a report to attach

This is the most powerful feature of the AI Editor—feeding your actual trading data to the AI.

When you attach a report, the AI has access to:

Data PointExample
Symbol & TimeframeBTCUSD, 15min
Date Range2024-01-01 to 2024-01-31
Match Statistics85% match rate, 15 missed alerts
Discrepancy Patterns”Most misses occurred at market open”
Time Drift AnalysisAverage drift of 45 seconds
Price Drift AnalysisAverage drift of 0.3%
  1. Complete a Backtest vs Alerts analysis showing 82% match rate with missed alerts.

  2. Click “Save Snapshot” to preserve the analysis.

  3. Click “Open in AI Editor” or navigate manually.

  4. The report is automatically attached (or use the 📊 button).

  5. Based on the attached report, my strategy is missing 18%
    of alerts. The pattern shows most misses happen when RSI
    changes rapidly. How can I fix this?
  6. The AI analyzes your execution data and suggests specific code changes.

You: Here’s my backtest report showing 15 missed alerts. Most occur during high volatility. What’s wrong with my strategy?

AI: Looking at your report, I see several patterns:

  1. Repainting Issue: Your RSI calculation may be reading future data
  2. Bar Timing: Alerts fire at bar close but your backtest assumes bar open
  3. Recommendation: Change barstate.isconfirmed check…

[AI provides specific code diff]


Above the chat input, you’ll see all active attachments:

Context:
├── 📄 RSI Strategy.pine (full) [×]
├── 📄 Lines 45-67 (selection) [×]
└── 📊 Backtest Report - Jan 2024 [×]

Click the × next to any attachment to remove it from context.

If you modify your code after attaching it, the attachment becomes “stale”:

  • Fresh — Code matches current editor state
  • Stale — Code has changed since attachment

AI models have limited context windows. The system automatically:

  1. Estimates tokens for each attachment
  2. Prioritizes based on recency and relevance
  3. Excludes older attachments if the budget is exceeded

Token indicators:

  • Green: Within budget
  • Yellow: Near limit
  • Red: Some context excluded
DoDon’t
Share relevant selectionsAttach entire scripts unnecessarily
Remove old attachmentsKeep stale context
Ask focused questionsInclude unrelated reports

  • Be selective — Share only what’s relevant to your question
  • Include context — If asking about a function, include its dependencies
  • Keep it fresh — Re-share after making changes
  • Save important analyses — Reports must be saved to attach them
  • Choose relevant reports — Attach reports that relate to your current work
  • Reference the data — Tell the AI what specific aspects to focus on
  • Crop to relevant area — Don’t include unnecessary screen elements
  • Use clear screenshots — Ensure text and charts are readable
  • Describe the image — Tell the AI what you want it to focus on

Some context is automatically shared without explicit attachment:

Auto-IncludedDescription
Active TabYour currently selected script
Tab NamesList of all open script tabs
Chat HistoryLast 10 messages in conversation