MetaTrader 5 Python User Group - how to use Python in Metatrader - page 33

 
jaffer wilson:

How do you change the MetaEditor skin? Please let me know.

I used a dark Windows10 theme
Look carefully on the website for compatibility with your version of Windows.
If the theme doesn't install correctly, you could lose your operating system.
So first install your version of Windows on VirtualBox, and try it out on a virtual machine.
If it's OK, you can then install it on the production machine.

MetaEditor colours I have customized

Elements Text Background
Text 200,200,170 35,35,35
Selected text 255,255,255 61,85,109
Indent Default 50,50,50
Keywords 66,142,200 Default
Comments 128,128,128 Default
Numbers 181,206,168 Default
Operators 192,192,192 Default
Strings 214,157,133 Default
Macros 190,183,255 Default
Functions and entry points 216,16,223 Default
Indicators 100,200,70 Default
Predefined variables 255,140,0 Default
Input variables 210,105,30 Default
Non ASCII characters 255,20,147 Default

This is what I ended up with



Placebo
Placebo
  • 7themes.su
Порт одной из лучших тем которая была создана на семерку. Сейчас тема Placebo стала доступной на Windows 10, при этом во всей оригинальной красе. Поддерживается стилизация панели задач и меню...
 
I installed Visual Studio 2019 (immediately noted something about Python) and oh wonder! Now the scripts work in both Studio and MetaEditor!
 
Renat Fatkhullin:
Is python enabled in visual studio?

Because of the zoo of pythons deployed indirectly or automatically by different systems, it is easy to get libraries installed in another python copy and then try to run other copies.

Sort out the pythons, please. Those who move to python must be prepared to spend the rest of their lives battling with libraries, dependencies, and incompatibilities.

This is the fate of a pythonist - to build an environment of libraries and pray that some library update doesn't mess up another unknown number of libraries.

In general, I don't understand why you support integration of Python and actively reject R. Although there is "kolkhoz", as you put it, but there is more order there. And as for the current state, Python is used in R as native, but it is harder to reverse it.

Just a thought out loud.

Good luck

 
Vladimir Perervenko:

In general, it is not clear why you support integration of Python and actively reject R. Although there is "kolkhoz" there, as you put it, but there is more order. As for the current state, Python is used in R as native, but the reverse is more difficult.

The future is played out very quickly and simply.

R is lost.

 
Vladimir Karputov:
I installed Visual Studio 2019 (immediately noted something about Python) and oh wonder! Now the scripts work in both Studio and MetaEditor!

We'll figure it out, just in conjunction with a complete rewrite of the library.

Apparently they left some extra stuff in the package.
 
Renat Fatkhullin:

We'll sort it out, just in conjunction with a complete rewrite of the library.

It must have been left out of the package.

Parallelization of njit (parallel=True) doesn't work, there are errors
parallel=False script runs

#!/usr/bin/env python3

from numba import njit, prange
import time


@njit(parallel=True, fastmath=True, cache=False)
def calc_pi(num_steps):
    x, sum1 = 0.0, 0.0
    step1 = 1.0 / num_steps
    for i in prange(num_steps):
        x = (i + 0.5) * step1
        sum1 = sum1 + 4.0 / (1.0 + x * x)
    return sum1 * step1


calc_pi(1)  # minus jit compilation time
start_time = time.time()
pi = calc_pi(1000000000)
msvcr = time.time() - start_time

print(f"--- {msvcr} seconds --- The value of PI is {pi}")
 
Roman :

Paralleling njit (parallel=True) does not work, errors are thrown
parallel=False script runs

What error is being thrown?

 
jaffer wilson:

Which error is being thrown?

There are a lot of them, I don't know what they may be related to.
I tried to run the code from the python command line, same errors.
It turns out that the problem is in the installed python, maybe a package is needed, but does not write which one.
Python was installed from the installer, which is downloaded from Tools -> Settings -> Compilers


 
Roman:

There are a lot of them, I don't understand what it might be about.

It has nothing to do with Metatrader.

The error is also when running the script separately with parallelism enabled.

 
Renat Fatkhullin:

This has nothing to do with Metatrader.

The error also occurs when running the script separately with parallelism enabled.

Yes it is, errors appear on windows python, python is installed from the compilers tab.
On linux I have Spyder and VSCode environment, this code runs without problems and errors there.

Reason: