MetaEditor HelpDeveloping programsAI Assistant

AI coding assistant

MetaEditor features AI Assistant – the advanced automatic code completion tool powered by the OpenAI-based models. Write a trading idea in a natural language, and AI Assistant will offer its MQL5 implementation. This opportunity will be useful to everyone:

  • Beginners receive ready-made code snippets to learn and to implement ideas
  • Professionals will save time while coding

Code generation #

Add a comments with a prompt to the program code or part of the function you need to add. After that select "Prompt to AI Assistant" in the menu or press Ctrl+Alt+\. The neural network will analyze your prompt and will offer you code options to implement your idea.

AI Assistant coding assistant

Depending on the file type, the string "MQL5 language", "Python language" or "C++ language" is automatically inserted at each prompt beginning. Thus, the neural network will provide the result in the required language.

Code explanation #

In addition to writing new code, AI Assistant can explain the existing one. Select the desired code part and click "Explain via AI Assistant". Code explanation generated by the neural network will be added as a comment above the selected part.

AI Assistant can explain the existing code

AI Assistant settings #

AI Assistant is currently free and is already enabled in the editor. There are several options available under Tools \ Options \ AI Assistant:

AI Assistant settings

Payment settings:

  • Use MQL5 account – this option is currently available for free. Later, you will be able to pay for the subscription directly from your MQL5 account balance.
  • Use OpenAI API key – you can use it if you have already purchased the subscription and have the key.

Prompt settings:

  • Model – a neural network which will process your requests. GPT-3.5 Turbo, GPT-4 Turbo and GPT-4o are currently available.
  • Maximum tokens – the number of text units which the model can return in response to a prompt.
  • Variability – affects how strictly the neural network will follow the prompt. The higher the value, the greater the result randomness. This option corresponds to the temperature parameter in OpenAI models.