One of the advantages of open-source indicators is being able to see exactly what they do. You do not need to be a programmer: most indicators follow the same structure, and recognizing it already lets you answer the most important questions before using a script in your trading.
The four parts of an indicator
- Parameters: the values you can adjust, such as an average's period or a standard deviation multiple.
- Input data: which chart columns the indicator uses: open, high, low, close, volume.
- Calculation: the operations that turn the input data into the result.
- Output: what is drawn on the chart (lines, bands, histogram) and sometimes buy and sell signals.
An annotated example
The snippet below is a simplified, generic example of a moving average crossover written with the pandas library. It does not follow any platform's exact syntax; the point is to show the structure.
# 1) Parameters
short_period = 9
long_period = 21
# 2) Input data: the close column
close = data["close"]
# 3) Calculation: two exponential moving averages
short_ma = close.ewm(span=short_period, adjust=False).mean()
long_ma = close.ewm(span=long_period, adjust=False).mean()
# 4) Output: signal when the short average crosses above the long one
crossed_up = (short_ma > long_ma) & (short_ma.shift(1) <= long_ma.shift(1))Notice the shift(1): it compares the current candle with the previous one, which is how the exact moment of the crossover is identified. The logic is the same described in the guide on the moving average crossover.
What to check before using a script
- Does it use future data? Calculations that look at candles ahead (for example, a
shift(-1)) make the indicator look perfect in the past and impossible to reproduce live. This is the most serious mistake. - Is the signal produced at the candle close? Signals calculated on a candle still forming can appear and disappear, the so-called "repaint".
- Which parameters exist and what are the defaults? Too many parameters invite overfitting, as explained in the guide on overfitting.
- Does what is drawn match the description? A script's description is a summary; the code is the truth.
On TessTrade
Scripts on the TessTrade marketplace are written in Python, and many have open source code you can read. The platform-specific syntax and available functions are documented in the SDK docs at learn.tesstrade.com. Before using a script with real money, read the code with the checklist above and run a test, as in the backtesting guide.
Educational content. The code example is illustrative and simplified. Nothing in this article is investment advice.
