Questions from Beginners MQL5 MT5 MetaTrader 5 - page 735

 
Good afternoon:

Questions about history (I couldn't find some things in help):

I was placing a sell bet:

1. what is "buy" at the end of a bet, I was putting a sell?

2. 0.99946 is the take profit setting I assume?

3. and why is "out" 0.99934 different from take profit 0.99946? or is it the difference equal to spread?

4. "market" - is it manual order setting/clearing?

Thanks in advance for the answer.

 

I have this function and it works in an EA/script

double cLot(double Percent, string symbol, ENUM_ORDER_TYPE action=ORDER_TYPE_BUY)
  {
   double One_Lot=0.0;
   double price=0.0;
   double volume=0.0;
   double MinLot=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);
   double Free=AccountInfoDouble(ACCOUNT_FREEMARGIN);
   double Step=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP);
   if(action==ORDER_TYPE_BUY)price=SymbolInfoDouble(symbol,SYMBOL_ASK);
   if(action==ORDER_TYPE_SELL)price=SymbolInfoDouble(symbol,SYMBOL_BID);
   if(!OrderCalcMargin(action,symbol,1.0,price,One_Lot))return(MinLot);
   if(One_Lot!=0 && Step!=0)volume = MathFloor(Free*Percent/100.0/One_Lot/Step)*Step;
   if(volume!=0)return(volume);
   return(MinLot);
  }

Question:how to get the maximum possible lot in the indicator,OrderCalcMargin does not work in the indicator for some reason? In mt4 the"MarketInfo(symbol,MODE_MARGINREQUIRED)" works fine, in mt5 it doesn't, but there is some fragment ofthe OrderCalcMargin that does not work in the indicator

Thank you!

 
Vitaly Muzichenko:

I have this function and it works in an EA/script

double cLot(double Percent, string symbol, ENUM_ORDER_TYPE action=ORDER_TYPE_BUY)
  {
   double One_Lot=0.0;
   double price=0.0;
   double volume=0.0;
   double MinLot=SymbolInfoDouble(symbol,SYMBOL_VOLUME_MIN);
   double Free=AccountInfoDouble(ACCOUNT_FREEMARGIN);
   double Step=SymbolInfoDouble(symbol,SYMBOL_VOLUME_STEP);
   if(action==ORDER_TYPE_BUY)price=SymbolInfoDouble(symbol,SYMBOL_ASK);
   if(action==ORDER_TYPE_SELL)price=SymbolInfoDouble(symbol,SYMBOL_BID);
   if(!OrderCalcMargin(action,symbol,1.0,price,One_Lot))return(MinLot);
   if(One_Lot!=0 && Step!=0)volume = MathFloor(Free*Percent/100.0/One_Lot/Step)*Step;
   if(volume!=0)return(volume);
   return(MinLot);
  }

Question:how to get the maximum possible lot in the indicator,OrderCalcMargin does not work in the indicator for some reason? In mt4 the"MarketInfo(symbol,MODE_MARGINREQUIRED)" works fine, in mt5 it doesn't, but there is some fragment ofthe OrderCalcMargin that does not work in the indicator

Thank you!

Look atSYMBOL_MARGIN_INITIAL, i used to struggle with this issue too.

I don't remember if it was solved or not. - You can get it for one lot. and then check for the right one.

There is also a margin for hedge.

 
Vladislav Andruschenko:

Look towardsSYMBOL_MARGIN_INITIAL, I was struggling with this issue too.

I don't remember whether I solved it or not. - You can get it for one lot, and then check it for the right lot.

There is also a margin for hedge.

SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL) gives exactly "0.0". You think I haven't tried it)
 
TraSer:

Hello!

I am trading on MT5 platform with Just2Trade broker.

When I run my robot in "OHLC on M1" mode on Gazprom shares I get good results. For almost all parameter sets - profit. The best run shows more than 25% profit with about 5% drawdown.

I switch to"every tick based on real ticks" mode. Immediately half of the results are unprofitable. The best result is profit less than 10%.

What can it be related to? Maybe, the commission is charged in the second case, while it is not charged in the first one?

By the way, I enter and exit the trade on the first tick of the minute.

Does anyone have any thoughts?
 
TraSer:
Does anyone have any thoughts?
Run the tester in visualisation mode and look at your trades - maybe your strategy is pipsqueak or some other heavy reliance on quotes.
 
TraSer:
Does anyone have any thoughts?
No asks in all modes except the actual ticks.
 

Is there a way to find out the contents of a directory via MQL in order to batch process files in it?

 
-Aleks-:

Is there any way to find out the directory contents via MQL for the purpose of batch processing of files in it?

Pure MQL: in subfolder MQL5\Files (or directory_agent_testing\MQL5\Files in case of testing). If FILE_COMMON is specified among the flags, then in the common folder of all the client terminals\Terminal\Common\Files.

MQL + WinAPI (search in any folder):

 
Vladimir Karputov:

Pure MQL: in subfolder MQL5\Files (or folder_agent_testing\MQL5\Files in case of testing). If FILE_COMMON is specified among the flags, then in the common folder of all client terminals \Terminal\Common\Files.

MQL + WinAPI (search in any folder):

Thank you.

Reason: