Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 428

 
vitali-attila:
Hello. Could you please tell me where the account information file is stored? I need to change the stoplevel and spread for the strategy tester. If there is another way, please tell me about it.
StopLevel does not change, but the spread is easy to change in the Strategy Tester settings - under the choice of Period there is a choice of Spread size
 
Mr.Profit:

Greetings, dear friends!

How do I know the full name of the file (with path) where my Expert Advisor/Script writes to using FileOpen/FileWrite?

TerminalPath() + "\\\experts\\files\\" on Win7 x64 with UAC enabled points to "C:\Program Files (x86)\Alpari Limited MT4\experts\files\", whereas I would like to get "C:\Users\<CurrentUser>AppData\Local\VirtualStore\Program Files (x86)\Alpari Limited MT4\experts\files\"

Taki - no one knows?
 

I would try fileopen("%userprofile%\AppData\Local\VirtualStore "+ truncate the line TerminalPath()+"\\experts\\\files\\\"

Better yet, finish up with the virtualisation.

 
splxgf:

I would try fileopen("%userprofile%\AppData\Local\VirtualStore "+ truncate the line TerminalPath()+"\\experts\\\files\\\"

Better to finish with virtualisation.

I don't understand about virtualization... This is all happening on a normal Win7 computer, if anything (not on virtualization).

Digging out part of path from TerminalPath() and adding it to %userprofile% - perversion, and it will only work if terminal is installed in Program Files. But if it is installed in X:\a\b\c\d - what part of path should be added to %userprofiles%?

 
artmedia70:

It's been here before, and more than once. It should help if you're smart:

how to calculate based on available funds and lot how many pips (in points) the price can go negative??? anyone have such a code???
formula: Lot=Money/(Staples*Tick)
Money - earned/lost
Stoplos - broker's pips
Tick - MarketInfo( MODE_TICKVALUE)
From here, twist as you wish:
Stopplus=Money/(Lot*Tick)
Money=Lot*Stopplus*Tick




Yes, it all worked out, thank you!
 
Mr.Profit:

About virtualisation - misunderstanding... This all takes place on a normal Win7 PC, if anything (not on virtualization).

Digging out part of path from TerminalPath() and adding it to %userprofile% - perversion, and it will only work if Terminal is installed in Program Files. But if it's installed in X:\a\b\c\d - what part of path should be added to %userprofiles%?

п.1. Disable UAC or run as administrator.

What is the problem and why do you need the full path? The file functions in MT4 are per se virtualized and limited to the experts\files directory.

If you want full functionality, go to windows api https://www.mql5.com/ru/forum/112692 or see point 1.

 
splxgf:

п.1. Disable UAC or run as administrator.

What is the problem and why do you need the full path? The file functions in MT4 are per se virtualised and limited to the experts\files directory.

If you need full functionality, go to windows api https://www.mql5.com/ru/forum/112692 or see point 1.

My script generates some kind of HTML report. I have an irresistible ( ;-) ) desire to have the report automatically opened in a browser by calling ShellExecuteA() from shell32.dll - I need the full path for that.

The reason why I don't want to use step 1 is because I want a universal solution.

 
Well then maybe try to create a file using win api (CreateFileA), it will most likely be created in the user's profile folder, and then calculate the full path from the handle.
 

Guys, please check the function, I have some doubts about it

void CloseHalfOrders(int otype) // ф-ция закрытия половины ордеров сетки
{
  int count = 0; double CTbuy = CountTrades(OP_BUY); double CTsell = CountTrades(OP_SELL);
  double n = NormalizeDouble (CTbuy/2,1); double k = NormalizeDouble (CTsell/2,1); 
  for (int i =0; i<OrdersTotal();)
  {
    if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES))
    {
       if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType() == otype)
       {
         if (otype == OP_BUY)
         {
           if (count<n)
           OrderClose(OrderTicket(),OrderLots(),Bid,0,Lime);
           count++;
           Sleep(1000);
         } //if (otype == OP_BUY)
           if (otype ==OP_SELL)
           {
             if (count<k)
             OrderClose(OrderTicket(),OrderLots(),Ask,0,Lime);
             count++;
             Sleep(1000);
           }//if (otype ==OP_SELL)
         }//if (OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType() == otype)
           else i++;    
         }//if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES))
       }//for (int i =0; i<OrdersTotal();)
     }//void CloseHalfOrders(int otype)
 
Trader7777:

Guys, please check the function, I have some doubts about it


Well, if it's closing, it's better to loop backwards.