Useful features from KimIV - page 6

 
Lukyanov:
Just might come in handy. :-)
Don't mind if you put it out there :-) :-)
 
Hello
Can you tell me if there is any "office" that provides its own server for testing EAs. That is, I upload my EA to their server, where it is tested in "on line" mode on a demo account.
 
KimIV:

Warning! In my post of 12.03.2008 07:24 I have changed the attachment SetOrder.mq4

I've tried your code, but it didn't work (maybe my hands are wrong :( ... ). When compiling shows a lot of errors.
Message' - the function is not defined - what is it?
'break' - 'break' or 'continue' used within some cycle only - what is wrong with loops?
'GetNameTF' - function is not defined - how to define it?
...etc. :(
I still can't figure it out. Please help me, if you're not in trouble.

 
sasa999 писал (а):
'Message' - function is not defined - what is it?
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 01.09.2005                                                     |
//|  Описание : Вывод сообщения в коммент и в журнал                           |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    m - текст сообщения                                                     |
//+----------------------------------------------------------------------------+
void Message(string m) {
  Comment(m);
  if (StringLen(m)>0) Print(m);
} 
sasa999 wrote:
'break' - 'break' or 'continue' used within some loops only - what's wrong with loops?

Ignore the break for now. Sort out the function descriptions first.

sasa999 wrote:
'GetNameTF' - function is not defined - how to define it?
//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 01.09.2005                                                     |
//|  Описание : Возвращает наименование таймфрейма                             |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    TimeFrame - таймфрейм (количество секунд)      (0 - текущий ТФ)         |
//+----------------------------------------------------------------------------+
string GetNameTF(int TimeFrame=0) {
  if (TimeFrame==0) TimeFrame=Period();
  switch (TimeFrame) {
    case PERIOD_M1:  return("M1");
    case PERIOD_M5:  return("M5");
    case PERIOD_M15: return("M15");
    case PERIOD_M30: return("M30");
    case PERIOD_H1:  return("H1");
    case PERIOD_H4:  return("H4");
    case PERIOD_D1:  return("Daily");
    case PERIOD_W1:  return("Weekly");
    case PERIOD_MN1: return("Monthly");
    default:         return("UnknownPeriod");
  }
}

Look for the ExistOrders function in this thread. I have already posted it. ErrorDescription is plugged in with the compiler directive:

#include <stdlib.mqh>

Okay, there is still the GetNameOP function:

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 01.09.2005                                                     |
//|  Описание : Возвращает наименование торговой операции                      |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    op - идентификатор торговой операции                                    |
//+----------------------------------------------------------------------------+
string GetNameOP(int op) {
  switch (op) {
    case OP_BUY      : return("Buy");
    case OP_SELL     : return("Sell");
    case OP_BUYLIMIT : return("Buy Limit");
    case OP_SELLLIMIT: return("Sell Limit");
    case OP_BUYSTOP  : return("Buy Stop");
    case OP_SELLSTOP : return("Sell Stop");
    default          : return("Unknown Operation");
  }
}
 
KimIV:
sasa999 wrote (a):
'Message' - function is not defined - what is it?
sasa999 wrote (a):
'break' - 'break' or 'continue' used within some cycle only - what's wrong with cycles?

Ignore the 'break ' for now. Sort out the function descriptions first.

sasa999 wrote:
'GetNameTF' - function is not defined - how to define it?

Look for the ExistOrders function in this thread. I have already posted it. ErrorDescription is plugged in with the compiler directive:

#include <stdlib.mqh>

Okay, there's still the GetNameOP function left:


I feel like I should put the libraries (both of them) out there and do some outreach. The libraries will not be refused.
 
Thank you - very helpful, but there are other problems again... :(
now all these functions show - Function "ххххххххх" is not referenced and will be removed from exp-file
maybe I put them in the wrong place... :( I hope you can help.
..it's hard for a beginner in MQL4 :)
 
Vinin:
I feel like I need to put the libraries (both of them) out there and do some explanatory work. I won't give up the libraries.

I'll probably post it... but not before we've gone through all the features... otherwise what am I here for? Put it on codebase, people would download it and forget about it. I'm like that myself :-) I've got a bunch of other people's code lying around untouched. And when you have the opportunity to probe, ask questions, it's quite another matter.

SZY. My files with prefix test_ compile and run fine.

 
sasa999:
Thank you - very helpful, but other problems again... :(
now all of these functions show - Function "xxxxxxxxxx" is not referenced and will be removed from exp-file
Maybe I put them in the wrong place... :( Hope you can help.
..I'm having a hard time with MQL4 :)
Look how everything is put together in test_SetOrder.mq4
 



If I understand correctly, replacing OrderSend with OrderModify

can be used when modifying an order?
as well as when closing... ??

...but how can we combine these functions in one function?

also...

if (mn<0 || OrderMagicNumber()==mn)

why mn<0 ? can't Magic be negative?

 
sasa999 писал (а):
if i understand correctly, by replacing OrderSend with OrderModify

can be used to modify an order?
?? as well as for closing ... ??

but how to combine this into one function so it doesn't repeat itself?

Later on there will be a function to modify

sasa999 wrote (a):
more...
if (mn<0 || OrderMagicNumber()==mn)
why mn<0 ? can't Magic be negative?
it can... But in my EAs, I only use positive Magic in YYYYMMDD format, e.g., 20080323. This is the date when the EA was developed.