Questions from a "dummy" - page 142

 
Yedelkin:
I can't find my way around, where in the Reference does it say that in exchange execution a request should not contain TP/SL?

I don't remember that in the reference. But as far as I know it is true. It is more correct to say SL/TP as far as I understand on the exchange you have to put separate orders (having a certain type and specification).

In principle you can look at stock terminals like exactly, grey box or say in Quik

PS

This for example may be related to the law. As far as I know the US law requires stops to be marked in a certain way (and not otherwise).

For their wrong execution certain penalties are imposed. i can not say for sure, but those who traded on the NYSE (or similar exchanges) i think they should know exactly what and how.

 

Please tell me how to take the values of all iBands.

https://www.mql5.com/ru/articles/31

there is something useful here, but the editor didn't find it when compiling

"#include <GetIndicatorBuffers.mqh>"

MQL5 для "чайников": Получение значений технических индикаторов в своих экспертах
MQL5 для "чайников": Получение значений технических индикаторов в своих экспертах
  • 2010.03.05
  • Sergey Pavlov
  • www.mql5.com
Для получения в торговом советнике значений встроенного или пользовательского индикатора, необходимо предварительно создать его хендл с помощью соответствующей функции. На примерах показано, как воспользоваться тем или иным техническим индикатором при разработке своих программ. Речь идёт о индикаторах, которые непосредственно встроены в язык MQL5. Статья предназначена для начинающих разработчиков торговых стратегий и предлагает простые и ясные способы работы с индикаторами с использованием приложенной библиотеки функций.
 
lazarev-d-m:

Please tell me how to take the values of all iBands.

https://www.mql5.com/ru/articles/31

there is something useful here, but at compilation the editor didn't find

"#include <GetIndicatorBuffers.mqh>"

Attached to the article below.
 

Please advise where to place the file uploaded by the Expert Advisor. I tried it in MQL5/Files. The tester gives error 5004. The indicator finds the same file in MQL5/Files right away. What is error 5004?

Please read more:

A file with .txt extension. The request is like this

   int filehandle=FileOpen(fname,FILE_READ|FILE_ANSI,"\n");
   if(filehandle!=INVALID_HANDLE) Print("FileOpen: ",FileSize(filehandle)," bytes");
   else Print("Operation FileOpen failed, error ",GetLastError());

 

 

The error is

2012.05.09 21:14:14 Core 01 2011.01.01 00:00:00 Operation FileOpen failed, error 5004

The file is located in the MQL5/Files folder. Checked it 1000 times. And the tool loads it without any problems.

Build 642.

 
gpwr:

Please advise where to place the file uploaded by the Expert Advisor. I tried it in MQL5/Files. The tester gives error 5004.

Each tester has its own file sandbox, the data file should be placed exactly in the sandbox of the tester, it is not very convenient, so it is better to place the data file in the common folder of all terminals, it is accessed through the FILE_COMMON flag.

The file located in the shared folder can be accessed both from the terminal and the tester.

The public folder can be opened from MetaEditor - File - Open public data folder.

 
Yurich:
Each tester has its own file sandbox, the data file must be placed exactly in the tester sandbox, this is not very convenient, so it is better to put the data file in the common folder of all terminals, it is accessed via the FILE_COMMON flag.

The file located in the shared folder can be accessed both from the terminal and the tester.

The public folder can be opened from MetaEditor - File - Open public data folder.

Thank you, the download via FILE_COMMON was successful. The tester's sandbox did not work. But never mind. The developers should have simplified this process and let the Expert Advisors take the data files from the same folder where the indices are loaded from. And it would be nice if we could specify the path to the file in its name.
 
gpwr:
There's no way it worked through the tester sandbox.
It's been a long time since I've checked the file handling in the local tester sandbox. But before, to have access to the file from the tester, I had to put "read only" attribute on the file, because the tester cleared its sandbox before launching the Expert Advisor.
 

Hello!

Can you please tell me what to do to make the minute charts draw a vertical line at the right hour. My attempts are going nowhere:

//Vertical lines at a certain time

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots 1
//+----------------------------------------------+
//| Image rendering parameters |
//+----------------------------------------------+
//---- indicator line drawing
#property indicator_type1 DRAW_HISTOGRAM
#property indicator_color1 blue
#property indicator_width1 1
#property indicator_label1 "Time-line"

#define RESET 0 // constant for returning the command to the terminal to recalculate the indicator
//+----------------------------------------------+
//| Indicator input parameters |
//+----------------------------------------------+
input intHour1=10; //time 1
//+----------------------------------------------+
int StartBars;
bool GoodTime;
//---- declaration of dynamic arrays, which will be
//---- be further used as indicator buffers
double TimeDataBuffer[]; //
//+------------------------------------------------------------------+
//| class for working with date|
//+------------------------------------------------------------------+
class MyDateClass
{
private:
int m_year; // year
int m_month; // month
int m_day; // day of month
int m_hour; // hour in a day
int m_minute; // minutes
int m_second; //seconds
public:
//--- default constructor
MyDateClass(void);
};
//+------------------------------------------------------------------+
//| default constructor|
//+------------------------------------------------------------------+
MyDateClass::MyDateClass(void)
{
MqlDateTime dt;
datetime DT=TimeCurrent(dt);
TimeToStruct(DT,dt);
m_hour=dt.hour;
m_minute=dt.min;
m_second=dt.sec;
if (m_hour==Hour1 && m_minute==0) GoodTime=true;
DT=StructToTime(dt);
Print(DT);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---- initialisation of global variables for the indicator marks
StartBars=7;
//----
SetIndexBuffer(0,TimeDataBuffer,INDICATOR_DATA);
ArraySetAsSeries(TimeDataBuffer,true);
//---
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---- check for sufficiency of bars for calculation
if(rates_total<StartBars) return(RESET);

int limit,bar; //

//---- calculation of the required number of copied data
//---- and start number limit for the bar_calculated cycle
if(prev_calculated>rates_total || prev_calculated<=0)//check for the first start of the indicator calculation
limit=rates_total-StartBars; // start number for the calculation of all the bars
else limit=rates_total-prev_calculated; // start number for calculating new bars
//---

//---- main indicator calculation cycle
for(bar=0; bar<limit; bar++)
{
TimeDataBuffer[bar]=0.0;

if (GoodTime==true) TimeDataBuffer[bar]=2.0;
}
//--- return value of prev_calculated for next call
//---
return(rates_total);
}

Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
Документация по MQL5: Основы языка / Препроцессор / Свойства программ (#property)
  • www.mql5.com
Основы языка / Препроцессор / Свойства программ (#property) - Документация по MQL5
 
Here...
Files:
V_line.mq5  3 kb
 
papaklass:

Here is the code for the vertical line:

SPS!