Develop proprietary indicators for algorithmic trading strategies
Build proprietary technical indicators in Python to enhance your algorithmic trading strategies and gain a competitive edge.
Investfly's algorithmic trading platform provides a comprehensive library of standard technical indicators such as SMA, RSI, MACD, and more. These built-in indicators serve as the foundation for many successful algorithmic trading strategies and can be utilized in screeners, automated trade signals, and backtesting engines.
For algorithmic traders seeking a competitive advantage, Investfly enables you to develop custom technical indicators using Python code. These proprietary indicators can detect unique market patterns or signals that standard indicators might miss. Once defined, your custom indicators integrate seamlessly with all platform features (screening, trading strategies, backtesting) just like the standard indicators, giving you a powerful edge in your automated trading systems.
This guide assumes proficiency with Python programming and object-oriented concepts for developing algorithmic trading indicators.
The Indicator
class provides the foundational framework for
creating any type of technical indicator for algorithmic trading. Its
flexible design accommodates indicators based on various data inputs,
including price action, volume patterns, market sentiment, or alternative
data sources.
While we provide the SecurityDataProvider
class for historical
market data access, advanced algorithmic traders can incorporate external
data sources using Python's requests
module to create
indicators based on unique datasets like social media sentiment, options
flow, or macroeconomic indicators.
To develop a proprietary trading indicator, extend the
Indicator
base class and implement these required methods:
The IndicatorSpec
class defines the metadata for your custom
algorithmic trading indicator, including its name, description, required
parameters, and output value type. This specification serves as the
blueprint for how your indicator will be presented and used throughout the
Investfly platform.
When implementing the getIndicatorSpec
method, you must return
an instance of IndicatorSpec
with all required metadata
properly defined:
Your custom indicator code runs in a restricted and sandboxed Python environment for security reasons. This ensures that the code cannot perform any malicious tasks on our servers. Only a few white-listed safe modules can be imported. System operations such as file IO are not allowed, and wildcard imports are also restricted.
If you find any safe function that is blocked, please contact us, and we can make it available.
The core functionality of your custom indicator is implemented in the
computeSeries
method. This method receives historical price data and
your indicator's parameters, and must return a series of dated values representing
your indicator's calculations.
Your algorithm should be optimized for performance since it will be executed in real-time when used in live trading strategies. The platform imposes a 1-second execution limit to ensure system responsiveness.
Below is a complete example of a custom indicator that generates buy signals when a fast moving average crosses above a slow moving average:
After defining your custom indicator class, you need to register it with Investfly's platform to make it available for use in your trading strategies, screeners, and charts.
Navigate to User Settings > Custom Indicators in the Investfly platform. Paste your Python code into the editor and click "Save & Compile". Once successfully validated, your custom indicator will be available throughout the platform alongside standard indicators.
After deployment, your custom algorithmic trading indicator can be:
When developing custom indicators for algorithmic trading strategies, consider these best practices:
Optimize your code for speed using vectorized operations with NumPy whenever possible. The platform imposes a 1-second execution limit to maintain responsiveness during live trading.
Implement robust error handling to manage edge cases like insufficient data points or unexpected input values. Return appropriate fallback values when calculations cannot be performed.
Ensure your indicator only uses data that would have been available at each historical point to prevent unrealistic backtesting results and false trade signals.
Extensively backtest your custom indicators across different market conditions and timeframes to validate their reliability before using them in live algorithmic trading.
Custom indicators are the cornerstone of sophisticated algorithmic trading strategies. By developing proprietary technical indicators tailored to your specific trading methodology, you can gain a significant competitive advantage in the markets. Start creating your custom indicators today to enhance your automated trading systems.
Start automating your trading strategies today with our free 14-day trial.
Start Free TrialNo credit card required.