File shape
Declare const definition and a top-level function calc(ctx, p, { ta }). Return an array of supported shapes.
AI INDICATOR GUIDE
Use this page as reference when you ask an AI to write an indicator. It does not automatically train or change an AI model.
If your AI can browse, give it this page URL. Or copy the starter prompt below.
In TradeSetupPRO, open My scripts and choose Copy AI prompt. It includes the API, available helpers and worked examples.
State the formula, adjustable inputs, whether it belongs on price or in a separate pane, colours and signal conditions.
Paste the complete JavaScript file into the editor and choose Save & compile. If it reports an error, use Fix with AI to send the error and code back.
TradeSetupPRO indicators use the app’s JavaScript API. They do not use TradingView Pine Script.
Declare const definition and a top-level function calc(ctx, p, { ta }). Return an array of supported shapes.
ctx provides candles, source and time. Each candle has time, open, high, low, close and volume.
Use supported shapes such as line, histogram, band, vspan, hline, vline, marker, label, hprofile and barcolor.
Code runs in a sandboxed worker without DOM, window, network, storage or timers. Keep calculations efficient over large histories.
A successful compile only means the code passed the compiler. Check plotted lines and signals against known values or reference conditions on the chart.
Pine Script cannot be pasted into this app as-is. The AI must rewrite its logic in JavaScript using the attached API brief, report anything that cannot map directly, and never silently drop a feature.
Lines and series use line or histogram; filled areas use band; background shading uses vspan; horizontal levels use hline; signals use marker or label; candle recolouring uses barcolor. Return these as shapes described by the API brief.
Pine syntax and ta.* calls must be rewritten in JavaScript with only the helpers listed in the API brief. If a formula has no helper, implement it and explain the calculation. The app builds Style controls from returned shapes, so give each output a clear title.
A dashboard/table pinned to the screen, Pine Visibility rules, status-line/price-scale display options and some input types such as free-text or session inputs have no direct equivalent in the current API. State the limitation and offer an alternative before coding.
Visibility rules that restrict where an indicator appears differ from requesting data from another timeframe. If the source uses request.security or other-timeframe data, state what the API brief supports before proceeding; do not invent an API.
For example, HMA, ATR and level lines may be rewritten, but a dashboard, proximity sensitivity or signal rule only survives the port if the AI actually implements it. Seeing lines on the chart or passing compilation does not prove the result matches the source.
COPY AND USE
Attach the complete Pine Script (or screenshots/lists of every Inputs, Style and Visibility setting) and Copy AI prompt from the app. Require a feature mapping before code, and do not allow unsupported features to disappear silently.
Before code: a feature-by-feature mapping to the app, including unsupported or uncertain items. After code: the complete JavaScript file, a summary of changes or omissions, and steps to check the chart output.
Port or write an indicator for TradeSetupPRO. Read https://tradesetuppro.com/features/ai-indicator-guide/ and follow the complete API brief I attach. Use the app's JavaScript API, not Pine Script, and do not invent APIs or helpers.
For a port, first provide a feature-by-feature mapping covering formulas/rules, inputs and defaults, outputs/plots, Style, pane, timeframe/visibility, dashboard/alerts, and limitations. Mark each item “supported”, “adapted”, or “unsupported by this API”. Do not silently omit items or guess rules. Ask me if source code or requirements are incomplete.
Then return the complete JavaScript file in one code block. It must declare const definition and function calc(ctx, p, { ta }), return supported shapes, and give each output a clear title. After the code, summarize changes/unsupported items and how to compare the chart output. Compilation alone does not prove the result matches the source.
My source code and requirements: