[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 454

 
smart:


How do I know which indicators are in the template? I installed an old template, but not all indicators are displayed. I forgot the names of indicators included in the template. Thank you!


Open the \templates\ folder, find your template, open it in notepad, look for <windows> tag and see which indicators are packed with which parameters.
 
tol64:

demlin20.06.2011 22:02

Hi all!

I have a question, I can't make the program determine the profit of the order in pips. Somebody help me.

Try all orders in loop.

For(i = 0; i < OrderHistoryTotal(); i++)

You select the one you want by certain criteria using OrderSelect(). Then you ask for OrderProfit(). This is the net profit in money. The point value is approximately as follows:

(OrderProfit()/10)/OrderLots()+(OrderSwap()/10)/OrderLots();

Check just in case)))

Thank you, I will try it
 

Write and read info from order comment. OrderComment().

When opening an order, I record the balance and Stop Loss level in the comment. When the order is opened, I look through the log. Everything is accurate.




The balance is 10000.00. Stop Loss 1.67740. The total number of characters is 15.
Then using string functions, I select the required characters and write them into csv file. But I faced such a problem. If a stop loss triggered, these characters [sl] are added to the end of comment.


And I have 19 digits, not 15. The matter is that I check the number of digits in the current balance and the number of digits in the price before I make a comment. I set these values to variables which then determine how many and which digits I need to get. But this [sl] gives me a hard time. After all, if the price has 7 digits, the file will contain 740, not 1.67740. I cannot figure out how to solve this problem). Please help me.
 
The easiest thing to do is to write the right thing in the comment at once. That is, put delimiters between the data. Then the length of the string will not matter, you will just pull the substring between the delimiters.
 
granit77:
The easiest way is to write it correctly in the comment at once. That is, put delimiters between the data. Then the length of the string won't matter, just pull the substring between delimiters.


Earlier I was offered this simple variant:

string comment = OrderComment(); comment = StringSubstr(comment, 0, 15); // trimmed to the right

It was a simple variant but I had some difficulties with it too but managed to solve the problem. )

Why, if you write everything correctly at once, won't [sl] characters be added? Can I have a small example with substring extraction from the order comment, if you don't mind?

 
tol64:


I was offered this simple option earlier:

The option is simple, but I had difficulty with it too, but decided. )

Why, if you write everything correctly at once, won't the [sl] characters be added? Can I have a small example with extracting a substring from the order comment, if you don't mind?

Let them be added. You want to retrieve your data, and you don't care what it adds or how long the string is.

   string _comment="10000.00"+"$"+"1.67740"+"#";//строка комментария. "$","#" - разделители (символы,какие понравятся) 
   int lenstring=StringLen(_comment);           //длина строки _comment
   int delim1,delim2;                           //позиции разделителей в строке _comment
   string balans,stoploss;                      //извлекаемые подстроки
   delim1=StringFind( _comment, "$", 0);        //определяем позиции разделителей в строке _comment
   delim2=StringFind( _comment, "#", 0);        //определяем позиции разделителей в строке _comment 
   balans   =  StringSubstr( _comment,0, delim1);                //извлекли строку баланс
   stoploss =  StringSubstr( _comment,delim1+1, delim2-delim1-1);//извлекли строку стоплосс 
   Comment("|",balans,"|",stoploss,"|");//проверка 
 
Good day to all. I have encountered a funny situation when two different computers can connect to the same account and even trade simultaneously on that account. Who can tell me if it is possible to control a remote computer, e.g. change variables ext or at least suspend an EA? I thank in advance, because I faced a strange situation when I can not take over the control of the terminal, which works at home (myself at work for example).
 
granit77:
Let them be added. You want to retrieve your data, and you don't care what is added or how long the string is.


)) Thank you. Great example! You get it all in one word. This is exactly the kind of example that is sometimes sorely lacking.
 
snail09:

Yeah, it's definitely boiling. Everyone's just answering your... questions. Maybe you are so uninformed?

If someone would tell me how to trace the crossing of the trend line by the price (a straight line), would it be enough for me, even a hint? Thanks immediately, as I don't expect an answer in the foreseeable future. You, Star, are a flooder, may the moderators forgive me...


I'm no wizard, it's my first time here myself. 8))))
 
peshihod:

You lack practice. You cannot run your programme, it does not work. A vicious circle: no workable option-> no skill-> no workable option.

Gotta think about it.... :-/


To continue the topic.

To learn, you need practice.

Do the following in the trading terminal:
1. A demo account must be opened.
Enter the account details into the trading terminal: File->Login->...
2.Use an open chart or open a new one:File->New_chart->...
3.Set maximum in: Service->Settings->Charts->Max Bar_History->250000
4.Set one minute timeframe: Charts->Period->M1_One_minute
5.Make update: Charts->Update
6.Open Strategy Tester: View->Strategy Tester
All other windows close (minimize), leave one window with a chart and a window with the tester.
------------------
Next, in the Strategy Tester settings:
7. Symbol: Select the symbol that has an open chart.
8.Model:By opening prices(.....)
<<<This model to use until OrderSend().>>>
9.Use date: Check the box.
Date: _From:<Yesterday(except Saturday and Sunday)>, _to:Today
10.Visualization: uncheck if checked.
11.Period: M1
12.Optimization: remove tick if present.
---------------------
Further open MetaEditor:
13.In the trading terminal menu:Service->Editor_MetaQuotes_Language
14.Write a program, for example:
//=====================

int i;
int const=5;
int Celoe, Ostatok;
bool flag_Odin_Raz=true;




int start()
{

if(flag_Odin_Raz==true)
{
//-------------
i=0;
while(i<22)
   {
   Celoe=i/const;
   Ostatok=MathMod(i,const);
   Print("При i=", i, " Celoe=", Celoe, " Ostatok=", Ostatok);
   i=i+1;
   }
//-------------
flag_Odin_Raz=false;
}
return(0);
}

//=============================

15.In MetaEditor, menu: File->Save_as: define the file name, save the extension .mq4, the folder should be 'experts'.
16.In MetaEditor in menu: File->Compile
---------------------------------------
Then in the tester in settings:
17.Advisor: find and select the file name of the program.
18.Click the 'Start' button by mouse click.
19. In the tester->log
We see the result of the programme by the Print() messages
-----------------------------------------
For easier viewing:
20. Right-click on any line in the log->Open
This will open logs folder with *.log file, which you can open using any text editor, Notepad, Word, etc.

PS
If the file is too big and no text editor is able to open it, then you should delete this file using the Windows means and restart the program by pressing the 'Start' button from the trading terminal. Tester folder: "...\Installation_folder\tester\logs", not to be confused with another: "...\Installation_folder\logs"

PPS
To learn how to program, you need a programming language compiler, which transforms the textual writing of the necessary actions into a "program" (human-readable), into a language of machine commands -- understandable to a computer. Without practice, it is impossible to learn. Mql4 doesn't create separate programs, *.mq4 turns into *.ex4, which is run from a program shell.
*.ex4 cannot be run directly, the algorithm described above bypasses this point.

Reason: