# How to test and tune an AI-written Pine Script strategy Slug: how-to-test-and-tune-an-ai-written-pine-script-strategy. Canonical: https://tradingtune.com/blog/how-to-test-and-tune-an-ai-written-pine-script-strategy ## Summary Check an AI-written Pine Script strategy for code errors and test assumptions before tuning inputs and reviewing unseen data. ## Key facts - A script that compiles still needs a review of its trading rules and test assumptions. - Inspect individual simulated trades before comparing different input combinations. - Keep the script and test conditions fixed while comparing parameter values. - Use data held out from tuning to check the chosen version without revising it against that same data. ## Outline - How do you test an AI-written Pine Script strategy? (#how-do-you-test-an-ai-written-pine-script-strategy) - What should you ask the AI to explain before testing? (#what-should-you-ask-the-ai-to-explain-before-testing) - How do you check that the draft is a strategy? (#how-do-you-check-that-the-draft-is-a-strategy) - How can you check entries and exits on the chart? (#how-can-you-check-entries-and-exits-on-the-chart) - What data and timing problems need a review? (#what-data-and-timing-problems-need-a-review) - Which test assumptions should you record? (#which-test-assumptions-should-you-record) - How do you decide which inputs are worth tuning? (#how-do-you-decide-which-inputs-are-worth-tuning) - How can you compare input combinations by hand? (#how-can-you-compare-input-combinations-by-hand) - What should happen after you choose a candidate? (#what-should-happen-after-you-choose-a-candidate) - Sources (#sources)