Skip to main content
Version: 3.0

Example R1: Signal from custom oscillator and external Python script

caution

This is not a ready-to-use trading strategy. A trading strategy requires adjustment to the timeframe and symbol, along with thorough backtesting. The example is intended as a foundation for your own custom strategy and to help you get familiar with the Expert Advisor Builder web application. To import and use an example, please follow the instructions provided here.

Description

This example integrates external Python scripts for sophisticated signal generation. The MyExternalOscillatorGenerator.py script performs calculations, sending results to the custom indicator. This enables machine learning, statistical analysis, or any Python-based strategy.

Python integration opens unlimited possibilities for strategy development. Modern data science tools, API connections, and complex algorithms become available while maintaining MetaTrader's execution capabilities. The visual display shows Python-generated signals clearly.

This advanced integration bridges modern programming with traditional trading platforms. Traders can leverage Python's vast ecosystem while benefiting from MetaTrader's market access and execution infrastructure.

caution

This example requires an external oscillator and an additional Python script. Please download, compile, and use the files listed below. Ensure the paths are correctly configured and the Python script is running during execution.

MQL 4 indicator example code: MyExternalOscillator.mq4

MQL 5 indicator example code: MyExternalOscillator.mq5

Python example script: MyExternalOscillatorGenerator.py

Recreate the Example

You can either import this example directly or set it up manually. To manually replicate the trading module, make sure a newly added module includes the following key settings and that the professional mode is activated:

Trade Basics

  • Operation type = Long signals only drawn
  • General signal visualization = Off

Signal Generation - CUS - Custom oscillator

  • Signal in use = On
  • Signal used for = Entry
  • Selected indicator = CUS - Custom oscillator
  • MetaTrader4 path to indicator file = \FEA Trading\MT4\MyExternalOscillator.ex4
  • MetaTrader5 path to indicator file = FEA Trading\MT5\MyExternalOscillator
  • Draw in chart = On
  • Drawing slot = 1

Screenshots

Example R1: Signal from custom oscillator and external Python script.webp
Example R1: Signal from custom oscillator and external Python script.webp