[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 281

 
 
DDFedor >> :

no... no need for brakes... while researching myself I don't remember encountering one, so I asked... loops, slips, and delays are not the solution... Thanks!

By the way, if calculation is long, you can visualize passing on certain stages of the code by changing object's colour. It will be cool, but it takes resources for visualization anyway; the slowest functions are work with files and functions with objects.

 
granit77 писал(а) >>
Flashing text.

Great! >> thanks!

 

Can anyone show me an example of code for reading from *.csv file to 1D/2D array in MQL5?

There were no problems with writing.

Thank you.

It would be great to have an example with classes.

 
joo >> :

Can someone show me an example of code for reading from *.csv file to 1D/2D array in MQL5...?

>>: >>:::::::::::::::::::::::::::::::::::::.

What a "newbies" come :))) It's time to make a separate thread for the "middle class".

 
Oh, man, it's getting crazy. :) -during the work with beta products. Before that I was struggling with arrays. I upgraded - it worked...
 

For MQL4:

void start()
{
double m[]={1.1,2.2,3.3,4.4,5.5,6.6};//Массив источник
double m_[6]; //Массив приемник

ArrayInitialize(m_,0);

string str;
int handle;
//=======Запись в массив============
handle=FileOpen("p.csv", FILE_CSV|FILE_WRITE,";");
//Цикл записи строчек в файл
for(int i=0; i<6; i++)
{
str=DoubleToStr(m [i], 8);
FileWrite (handle,str);
}
FileClose(handle);
//==================================

//========Чтение из файла===========
FileOpen("p.csv",FILE_CSV|FILE_READ,";");
int cnt;
while(FileIsEnding(handle)!=true)
{
m_[cnt]=StrToDouble(FileReadString(handle));
cnt++;
}
FileClose(handle);
//==================================

//Посмотрим, что там записалось в массив?
for(i=0;i<6;i++)
{
Alert(m_[i]);
}
}

And for MQL5, it turns out, you have to do this:

void OnStart()
{
double m[]={1.1,2.2,3.3,4.4,5.5,6.6};//Массив источник
double m_[6]; //Массив приемник

ArrayInitialize(m_,0);

string str;
int handle;
//=======Запись в массив============
handle=FileOpen("p.csv",FILE_CSV|FILE_WRITE,";");
//Цикл записи строчек в файл
for(int i=0;i<6;i++)
{
str=DoubleToString(m[i],8);
FileWrite(handle,str);
}
FileClose(handle);
//==================================

//========Чтение из файла===========
FileOpen("p.csv",FILE_CSV|FILE_READ,";");
for(int i=0;i<6;i++)
{
m_[i]=StringToDouble(FileReadString(handle));
}
FileClose(handle);
//==================================

//Посмотрим, что там записалось в массив?
for(int i=0;i<6;i++)
{
Alert(m_[i]);
}
}

Attention, question: "Why?"

 

Can we implement this algorithm?
1. What would the Expert Advisor look at another timeframe and use, for example, the Moving Average to filter out false signals?
2. What if I want my Expert Advisor to pull a Stop Loss not to break-even level? For example, if a stop loss is initially set at 50 pips, and when it reaches 30 pips, I would pull the Stop Loss by 20 pips.

Thanks in advance!

 
How to simplify the pattern from the article "Relying on the power of patterns" by removing SL, TP, pending orders and their modification. Otherwise it is impossible to experiment.
 
shap писал(а) >>
How to simplify a template from article "Relying on the power of templates", by removing SL, TP, pending orders and their modification. Otherwise it is impossible to experiment.

For a correct pattern, their presence (SL, TP) is not a hindrance. And modification is usually not a hindrance. You may disable it. To be more exact do not call this function.