Topics
17 Dec 2020, 10:16
 1274
 6
Replies

leonavonm
21 Dec 2020, 22:34 ( Updated at: 21 Dec 2020, 22:38 )

RE:Source of problem

leonavonm said:

Good day!

I am using some ML packages in python to make predictions based on indicator data which should then be used to execute orders in cTrader. I found the following code on the internet, however  am not getting any output from the following program, where cmd is the directory of the python script. The python code is very simple it is just tester code that prints, thus, Print(1). I tried adding the line Console.ReadLine(); which did not help and I tried to write the python output to a new file start.Arguments = string.Format("{0} {1} > output.txt 2>&1", cmd, args); but I could not find the location of the file. Any help would be apprecaited 

private void run_cmd(string cmd, string args)
{
     ProcessStartInfo start = new ProcessStartInfo();
     start.FileName = "my/full/path/to/python.exe";
     start.Arguments = string.Format("{0} {1}", cmd, args);
     start.UseShellExecute = false;
     start.RedirectStandardOutput = true;
     using(Process process = Process.Start(start))
     {
         using(StreamReader reader = process.StandardOutput)
         {
             string result = reader.ReadToEnd();
             Print(result);
         }
     }
}

I did try to see where the problem lies and I found that the python script might not be executing correctly since when it is run with the following code the python script is supposed to write to a csv file with some new code but this isn't visible. Thus it is not that data is received and I can't access it, it is the fact that data is never sent, here is the new code I tried to use without solution. 

ProcessStartInfo start = new ProcessStartInfo();
            start.FileName = "Path\\To\\python.exe";
            start.Arguments = "Path\\To\\Thing.py";
            start.UseShellExecute = false;
            start.RedirectStandardOutput = false;
            using (Process process = Process.Start(start))
            {

            }


@leonavonm

leonavonm
18 Dec 2020, 09:13

RE:

PanagiotisCharalampous said:

Hi Leon,

The reason is probably that your broker does not allow trading such a low volume. As far as I know the minimum is 0.01 Lots.

Best Regards,

Panagiotis 

Join us on Telegram 

And there is no way this can be changed? I would really like to see what the martingale can do when it starts using 1(unit of currency) then 2,4 etc. Instead of using 0.01 lots since this is much more costly and in most cases blows up the account, I think that if the martingale is applied in a way as to not get rich fast but rather to secure a position it might be successful but I don't know how to change these settings because I am sure that there are Forex brokers that allows trades of less than 0.01 lots to be made. Can this be done artificially by increasing the capital in the virtual environment to 1,000,000 or is this not possible?

All the best

Leon 


@leonavonm

leonavonm
17 Dec 2020, 12:07 ( Updated at: 17 Dec 2020, 12:45 )

RE:

PanagiotisCharalampous said:

Hi Leon,

It is possible to open positions with a volume higher than your balance because of leverage. There is nothing you need to do to enable it, it is a built in feature. If you have a leverage of 1:100 and 1000 units balance then you can open positions worth of 100000 units.

Best Regards,

Panagiotis 

Join us on Telegram 

 

Thank you Panagiotis! I thought that might be the case. Will this also relate to the reason that I cannot make trades with lots of 0.001? Or are these two problems not related? 

I get errors saying "Your request to Buy 0.001 lots of EURUSD was not sent because the volume of the order" or is this a consequence of the variable types(double vs. long) which causes the problems? 


@leonavonm