CandleTrek Trail map

Stop 4 of 6 Backtesting

How to Backtest a Trading Strategy Without Coding

Turn an idea into explicit rules, choose a candle window, and see how costs affect a worked backtest.

By CandleTrek ·

Your mission

Take one set of rules into the research harbour and see what happens when you add trading costs.

To backtest a trading strategy without coding, write down exact rules, choose a window of historical candles, set execution and cost assumptions, and run a simulation. Start by making the rules precise enough that two people using the same data would know when the condition was met.

Turn a description into rules you can inspect

“Follow a strong trend” leaves too many decisions open. Here is an illustrative moving-average crossover test used only to demonstrate the workflow.

  • Use closed, one-hour candles. Record a simulated position when the five-period exponential moving average crosses above the twelve-period average.
  • Check the crossover at the candle close. The example uses the next candle’s opening price for the simulated fill.
  • Set the protective threshold at 1.5 times the 14-period average true range, a measure of recent candle variability. Define the other closing threshold at twice that initial distance.

In the CandleTrek extension, open Test a strategy, enter a description, and select Turn into rules. Read the output for assumptions or unsupported conditions before choosing candles. AI helps translate the description. CandleTrek runs the simulation in the browser using the resulting rules and available candles. If you use candle data from a file, check whether your account has access to CSV testing.

Run the same rules with two cost assumptions

We ran the rules above through CandleTrek’s strategy engine using the 500-hour synthetic CSV. The settings below change only the price cost per simulated trade. One R is the initial price distance used to measure a simulated position’s risk.

Cost in price unitsCompleted tradesAverage after costsSample assessment
0.0000072.00 RToo few trades to judge
0.0002071.81 RToo few trades to judge

In both runs another simulated position was still open at the end and excluded from the completed trade statistics. Costs reduced the average result in the sample. Seven completed trades is still too little evidence for a verdict, and the example uses generated prices.

See what costs change

Switch to a cost of 0.00020. Compare the average result and the number of completed trades.

Completed trades
7
Average after costs
2.00 R

Both runs used the same 500 candles and produced too few trades to judge. The selector switches between those two recorded runs.

Ready? Take the trail check

Check the assumptions before interpreting a report

  • Data and timing. Check for missing, duplicate, or unfinished candles. A condition based on a final close can only be evaluated after that close is known.
  • Simulated execution. An hourly candle records its high and low. If both closing thresholds are touched within that hour, OHLC data alone gives you no reliable sequence for the two events. Record how the simulator resolves the case.
  • Data you did not tune on. Write down your rules and try them on a separate historical window. Repeatedly changing them to improve the same period can overfit the sample.
  • No completed trades. Check the available history, warm-up requirements, and whether the conditions ever occurred. Record the zero count as part of the result.

TradingView’s strategy documentation covers broker simulation, costs, lookahead bias, and other pitfalls. The same questions matter when you use a no-code tester. TradingView’s backtesting methodology

Trail check

What changed when you added costs to this example?

The average fell from 2.00 R to 1.81 R. Both runs still had seven completed trades.