MetaEditor HelpDeveloping programsCopilot coding assistant

Copilot coding assistant

MetaEditor provides integration with the advanced automatic coding assistant Copilot. It is powered by the OpenAI-based models. Write a trading idea in a natural language, and Copilot 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 Copilot" in the menu or press Ctrl+Alt+\. The neural network will analyze your prompt and will offer you code options to implement your idea.

Copilot 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, Copilot can explain the existing one. Select the desired code part and click "Explain via Copilot". Code explanation generated by the neural network will be added as a comment above the selected part.

Copilot can explain the existing code

Copilot settings #

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

Copilot 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. text-davinci-003 and gpt-3.5-turbo are currently available. Support for gpt-4 will be added soon.
  • 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.