Questions from Beginners MQL5 MT5 MetaTrader 5 - page 232

 
Hi all!!! I'm a beginner. I want to ask: When I compile an EA, I get the following error message: 'StopLoss' - declaration without type.

Here's the code:

//--- To work with brokers using 3 and 5 digit quotes,
//--- multiply by 10 the values of SL and TP
StopLoss = STP;-and THERE'S WHERE TO CHANGE THAT ??????
TakeProfit = TKP;
if(_Digits==5 || _Digits==3)
{
SL = SL*10;
TP = TP*10;

}

Any advice?

 
vyacheslavovich:
Hello everyone!!! I'm a beginner. I want to ask: When compiling EA, I get in errors:'StopLoss' - declaration without type.
It means that StopLoss variable was not declared before.
 
vyacheslavovich:
Hi all!!! I'm a beginner. I want to ask: When I compile an EA, I get the following error message: 'StopLoss' - declaration without type.

Here's the code:

//--- To work with brokers using 3 and 5 digit quotes,
//--- multiply by 10 the values of SL and TP
StopLoss = STP;-and THERE'S WHERE TO CHANGE THAT ??????
TakeProfit = TKP;
if(_Digits==5 || _Digits==3)
{
SL = SL*10;
TP = TP*10;

}

Any advice?

   double StopLoss = STP;
   double TakeProfit = TKP;

This should be better.

 
Good afternoon. I've been struggling with running external files for the second day. Can you tell me what's wrong.
#import "shell32.dll"
   int ShellExecuteA(int hwnd, string lpOperation, string lpFile,string lpParameters,string lpDirectory,int nShowCmd);
#import
void OnStart()
  {
   ShellExecuteA(CHART_WINDOW_HANDLE,"open","F:\\222.mp3", NULL,NULL,1);
  }
 
Andrei-1:
Hello. I am struggling with launching external files for the second day. Please, advise what is wrong.
//+------------------------------------------------------------------+
//| Функция получает хэндл графика                                   |
//+------------------------------------------------------------------+
int ChartWindowsHandle(long chart_ID)
  {
//--- подготовим переменную для получения значения свойства
   long result=-1;
//--- сбросим значение ошибки
   ResetLastError();
//--- получим значение свойства
   if(!ChartGetInteger(chart_ID,CHART_WINDOW_HANDLE,0,result))
     {
      //--- выведем сообщение об ошибке в журнал "Эксперты"
      Print(__FUNCTION__+", Error Code = ",GetLastError());
     }
//--- вернем значение свойства графика
   return((int)result);
  }

But it will only be getting the handle of the graph. And the graph itself is contained in a higher class window (parent window). In ShellExecuteA you should substitute the handle of the parent window.

Look at the Transparent MetaTrader 5 script: it has the function of getting the handle of the terminal through ChartID().

Transparent MetaTrader 5
Transparent MetaTrader 5
  • votes: 19
  • 2014.03.10
  • Karputov Vladimir
  • www.mql5.com
Данный скрипт позволяет делать полупрозрачным весь терминал.
 
Greetings all!
MQL4 has a good function - Barshift. Unfortunately, it is not available in MQL5. As a variant to replace this function, you can copy timeseries data from the start date (for which the shift is looked for) and see the number of copied elements. But if we need to process a lot of different dates, we don't want to overload the computer by constant multiple copying of time series. Of course, we are forced to try to find the right values using array enumeration. And here we come to the question. :) After searching through the documentation, I have found only one standard function, which searches for values in an array: ArrayBSearch. But it does not work with arrays containing datetime data. Is there a standard function to search by date inside datetime array? Or is it possible to use some kind of data conversion?
 
BlackTomcat:
Greetings all!
MQL4 has a good function - Barshift. Unfortunately, it is not available in MQL5. As a variant to replace this function, you can copy timeseries data from the start date (for which the shift is looked for) and see the number of copied elements. But if we need to process a lot of different dates, we don't want to overload the computer by constant multiple copying of time series. Of course, we are forced to try to find the right values using array enumeration. And here we come to the question. :) After searching through the documentation, I have found only one standard function, which searches for values in an array: ArrayBSearch. But it does not work with arrays containing datetime data. Is there a standard function to search by date inside datetime array? Or is it possible to use some data conversion?
Analogues have already been written for a long time - search the site.
 
Is there any way to augment a file (especially csv) via FileOpen without overwriting it? I mean, FileOpen(name,FILE_CSV|FILE_WRITE|...) just recreates a clean file, not opens existing one if it already existed. The text one is sorted out, though not in a very elegant way: just read it into a variable beforehand and add it to the new record. But csv doesn't work...
 
Hello to all and good day!!! Today I tried to earn on GBP news, put two pending orders buy stop and sell stop, stop loss was put at 200 points, take profit of 100 points. After the news release price went straight up, but the buy stop order closed with -0.34$ when the price went straight up by 500 pts.
 
I don't know ... the spread must be
Reason: