Questions from Beginners MQL4 MT4 MetaTrader 4 - page 50

 
You can tweak it yourself to open new charts without a grid and with candlesticks.
 
Андрей:
You can tweak it yourself to open new charts without the grid and with candlesticks.
Create a template of the type you want new charts to open and save it with the name default
 

Is the loop on order counting correct and if it is not, could you explain how it should be done?

for(int i=OrdersTotal()-1;i>=0;i--)

{

if(OrderSelect(i,SELECT_BY_POS))

{

if(OrderMagicNumber()==magic) // if(ourMagic

{

if(OrderType()==OP_BUY) sdel_b++; // count bai

if(OrderType()==OP_SELL) sdel_s++; // Count sels

if(OrderType()==OP_BUYSTOP) otl_b++; // Count pending bystops

if(OrderType()==OP_SELLSTOP) otl_s++; // Count pending sellstops

}

}

}

And another question. Why the pending orders are placed without limit (error 148 -Number of open and pending orders has reached the limit set by the broker), while in the condition of opening there should be no order

if (OrdersTotal()==0);

{

OrderSend (Symbol(),OP_BUYSTOP,lot,Vhod1,20,SL2,TP,NULL,magic,0,clrNONE); //place the pending orders

OrderSend (Symbol(),OP_SELLSTOP,lot,Vhod2,20,SL,TP2,NULL,magic,0,clrNONE); //

}

this is the whole code, I've left the minimum, because it's not clear why it can go this way

 
wishmast:

Is the order counting loop correct, and if not, can you explain how it should be? because it seems to me they are simply not counted

This is all code, the minimum is left as I do not understand why it may be so

All code is code that compiles and runs. And use Ctrl+Alt+M, please.

The loop, in principle, works, but without seeing the full code, you can't tell where the problem comes from.

 
I can't activate USD/RUB pair trading on mt4 how do I make it active?
 

Hi, can someone help here: need a replacement forFileWrite() via winapi

int start()
  {
    /*int hFile = FileOpen("WriteFileUsingWinAPI.txt", FILE_CSV|FILE_WRITE);
    FileWrite(hFile, "Testing write outside MT4 directory \r\nSecond Line \r\nThird Line \r\n 4 string \r\n 5 строка");*/

    int hFile = CreateFileW(FileName,GENERIC_WRITE,_FILE_SHARE_READ,0,CREATE_ALWAYS,0,0);    
    if(hFile!=_INVALID_HANDLE)
    {
      Print("File created.");
      int BytesWritten[1];
      BytesWritten[0]=0;
      uchar arr[];
      string Buffer="Testing write outside MT4 directory \r\nSecond Line \r\nThird Line \r\n 4 string \r\n 5 строка";
      StringToCharArray(Buffer, arr);     
      int FileLength =  2*ArraySize(arr);
      WriteFile(hFile,Buffer,FileLength,BytesWritten,0);
      if(FileLength==BytesWritten[0]) 
        Print("File written successfully.");
      else
        Print("Write Failed");
        
    // WriteToFile(hFile,"first");

     CloseHandle(hFile);
    }
    else
      Print("Create File Failed",hFile);
      CloseHandle(hFile);
    return(0);
  }

The text seems to be written, but when opening the file in WinHex this is the difference:

What's wrong? The whole file is in the \Scripts folder underneath.


Files:
 
925016189:
I can't activate USD/RUB pair trading on mt4, how do I make it active?
By changing your brokerage company. It depends on them on which instrument you can trade.
 
Hello!
Can you tell me where I can read about the #property strict property ?
 
Leo59:
Hello!
Can you tell me where I can read about the #property strict property?
In MQL4 Reference. What is not clear there?
 
Vitalie Postolache:
In the MQL4 language help. What is unclear there?
Thank you!
Reason: