Direct costs that can change results
“Pine Script Forex” usually means a strategy or indicator written in TradingView’s Pine Script and applied to foreign-exchange data. When you later place orders (manually or with execution tools), several direct costs can reduce returns or change outcomes.
First, the bid–ask spread: in FX, the price used to enter/exit can effectively differ because buys execute near the ask and sells near the bid. Second, commissions: some providers charge a per-trade fee or an account fee that is separate from the spread. Third, financing/overnight charges (swap): holding a position across a rollover can create additional charges or credits depending on the instruments and account rules.
Because these costs are instrument- and account-specific, any calculation you do must state assumptions such as: what spread is used, whether commissions apply per side, and whether financing is charged each rollover or only under certain conditions.
Indirect costs from execution and data mismatch
Even if you account for explicit fees, results can still differ due to execution-related and modeling differences.
Slippage is a key example: the real fill price may be worse than the reference price, especially when markets move quickly or when orders do not fill immediately. Another common issue is backtest realism—many educational setups assume fills at the bar’s price (or at a simplified rule). In live trading, the sequence of ticks within a bar and the exact timing of order placement can produce different fills.
Also consider latency and order timing: if the decision is computed on candle close, an order placed at that moment may execute at the next available price, not the close price. That gap is not a “fee,” but it functions like one because it changes entry/exit prices.
Mechanics: assumptions you must separate
To reason about costs, separate stable mechanics from variable conditions:
- Stable mechanics (within the code and the charting model): how the strategy defines entry/exit, whether it uses market or limit-like behavior, and what price series it relies on.
- Variable provider/account conditions: spread width, commission schedule, and financing/overnight rules.
- Variable market conditions: volatility, liquidity, and whether prices gap across your decision points.
In practice, costs affect results through a simple pathway: entry price and exit price are shifted by costs, and then the strategy’s position sizing and compounding (if any) amplify the impact. Any example should state which price source is used and how each cost component is applied (per order, per side, per day/rollover).
Limitations and failure modes
At least one material limitation often appears: missing or simplified cost modeling. If backtests omit commissions or swap, they can overstate performance even if you include spreads. Another failure mode is unrealistic fill assumptions: strategies may assume perfect fills at the displayed candle price, while real executions face slippage, partial fills, or rejection.
Finally, timing mismatch can be decisive. If the script triggers on a candle boundary, the real execution might occur later than the model assumes. Historical relationships also do not guarantee future results; market microstructure and cost levels can change.
Verification: how to independently confirm the relevant facts
You can verify costs without guessing by using a repeatable checklist:
- Match the price basis: compare the prices used by the strategy (as shown in the charting environment) to the prices your account actually uses for order fills.
- Confirm fee inputs from primary documents: use the provider’s publicly documented pricing for spreads/commissions and the account terms for financing/overnight charges.
- Reconcile trades to account statements: for a sample of trades, total the reported commissions and financing, then compare to the modeled trade-by-trade impact.
- Test sensitivity to assumptions: run the same strategy logic conceptually under different spreads and slippage assumptions to see which cost component dominates.
If the verification cannot be completed because the provider does not disclose needed details, treat the strategy’s cost impact as uncertain.