[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 147

 

Figured out how to draw the indicator (recursive with initialization, in theory it should be initialized with a fixed date, so that exiting bars do not change the initial values of the indicator). The language seems to be good but there is a huge problem with the documentation of the language.

I managed to do it this way:

If (IndicatorCounted<0) return with an error

If the first occurrence (IndicatorCounted==0) and we want to calculate the entire history

{

if (Bars <= Length) { initialize variables with initial values}

if (Bars > Length) { if IndicatorCounted

}

If NOT first inclusion (IndicatorCounted>0) then count only Bars-IndicatorCounted-1 bars

{

if (IndicatorCounted-1 <= Length) { initialize variables with initial values up to Length}

{ if (IndicatorCounted-1 > Length) calculate IndicatorCounted-1

}

NOW QUESTIONS:

Is there any way to make this algorithm simpler? (it's too much text)

How to decrypt date and time, from Time function? (I think we need date and time of a certain bar)

Is there anywhere a complete enough mql4 tutorial (except Kirill's book and metaeditor's help) describing what and how it works (like above algorithm)?

Where can I find a description of stdlib mql library?

 

Вопрос другого уровня. Лучше свою тему создавать.

OK, thanks.
 

What causes error 130? How can I correct it?

In the tester the Expert Advisor works without errors... on demo can't open any trades...

 

130 error - you are specifying the wrong take profit and stop loss.

Probable causes:

- price is not normalized.

- stops are very close to the market. It can float. so it also needs to be monitored.

If you have them at 5-10 pips, look where they are coming from - the bid or the ask.

- The problem may also be that the broker is not allowed to place stops during market order execution (e.g. brokos). They have to be placed on an order that is already open.

 

Note: Files can only be opened in the terminal_directory/experts\files(terminal_directory\tester\files in case of expert testing) or its subfolders.

How can this be implemented? The program does not automatically find the file in subfolders.

 
beruk писал(а) >>

Note: Files can only be opened in the terminal_directory/experts\files(terminal_directory\tester\files in case of expert testing) or its subfolders.

How can this be done? The program does not automatically find the file in subfolders.

And how do you search them?

 

That's the question - how to search? I can't find anything in the documentation.

I use :

#import "kernel32.dll"//function library
int FindFirstFileA(string path, int & answer[]);//finds first file
bool FindNextFileA(int handle, int & answer[]);//finds subsequent files, one after another
bool FindClose(int handle);//does not search
#import

but judging by "or its subfolders" this can be done by means of MQL

 
beruk писал(а) >>

That's the question - how to search? I can't find anything in the documentation.

I use :

#import "kernel32.dll"//function library
int FindFirstFileA(string path, int & answer[]);//finds the first file
bool FindNextFileA(int handle, int & answer[]);//finds subsequent files one by one
bool FindClose(int handle);//does the search
#import

But according to "or subfolders", you can do it with MQL.

You can use MQL to create a file and write something in it. You can open an existing file and read something. Whether this file exists or not is up to you.

 

one more time:

files can only be opened in the terminal_directory\experts\files(terminal_directory\tester\files in case of testing an EA) or its subfolders.

I use for opening the standard

int handle;
handle=FileOpen('my_data.csv',FILE_CSV|FILE_READ,';');

so the file is created/opened in terminal_directory\experts\files, but not in subfolders!

I haven't found any instructions on how to create/open a file in subfolders either on the forum or in the documentation.

maybe it's a mistake in the documentation?

 
beruk >> :

..I haven't found how to create/open file in subfolders either on forum or in documentation.

Maybe try it this way (by creating files/my_dir folder beforehand)?

handle=FileOpen('my_dir/my_data.csv',FILE_CSV|FILE_READ,';');

Reason: