Useful features from KimIV - page 112

 

Here is a description of the execution errors and recommendations on how to handle them. The general recommendation for errors 2, 64, 65 and 133 is to stop all trading attempts. To implement this recommendation, I use global EA variable gbDisabled, which I define in the header (i.e., before all functions start) as follows:

//------- Глобальные переменные советника -------------------------------------+
bool   gbDisabled   = False;           // Флаг блокировки советника

I check the state of this variable in the start() function:

//+----------------------------------------------------------------------------+
//|  expert start function                                                     |
//+----------------------------------------------------------------------------+
void start() {
  if (gbDisabled) {
    Message("Критическая ошибка! Советник ОСТАНОВЛЕН!"); return;
  }
}
 
KimIV:

Here is a description of the execution errors and recommendations on how to handle them. The general recommendation for errors 2, 64, 65 and 133 is to stop all trading attempts. To implement this recommendation, I use global EA variable gbDisabled, which I define in the header (i.e., before all functions start) as follows:

I check the state of this variable in the start() function:

Thanks.... )))
 
Good afternoon, Igor! In the function: void TrailingPositions(string sy="", int op=-1, int mn=-1) control is passed to ModifyOrder(sy, -1, pp+TrailingStopSell*p, 0, clModifySell) function, while ModifyOrder itself has 4 parameters, what is this about?
 
Lisi4ka330:
Good day, Igor! In function: void TrailingPositions(string sy="", int op=-1, int mn=-1) control is passed to function ModifyOrder(sy, -1, pp+TrailingStopSell*p, 0, clModifySell) while the function ModifyOrder itself has 4 parameters, what is it related to?

It's probably because you pulled the TrailingPositions function from somewhere. Maybe from one of my old EAs. Those functions that I have published did not become like that right away. They have evolved.

Please provide me the link to the TrailingPositions function. It is not in my list of published ones. I published SimpleTrailing().

 
here : http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=20 And thanks for the link, it took me a long time to remember where I saw it, but I couldn't find it)))))
 
I see... You must have already noticed that the parameter that passes the name of the trading symbol to ModifyOrder() function is redundant. There was this parameter before, and then I removed it...
 
Yes, figured it out)))) And even wrote my first EA, and even, as it turned out, with a small profit)))))))))))) Thank you so much Igor, only your features made it possible for me))))))))))))))))
 
Good afternoon!!!)))) Please explain the function Fibonacci(), in which cases is it used? It's not clear what kind of element it returns... it's not the price of the level...
 

Hi, do you happen to have a function that allows you to set take and stop levels in external variables when setting an order?

For example:

extern double sl = 0; // SL для открываемого ордера

extern double tp = 0; // ТР для открываемого ордера

SetOrder("", OP_BUY, ll, Ask, SL(), TP(), 0, 0);
{условие}

SetOrder("", OP_SELL, ll, Bid, SL(), TP(), 0, 0);

{условие}

SetOrder("", OP_BUYSTOP, ll, Ask, SL(), TP(), 0, 0);
{условие}

SetOrder("", OP_SELLSTOP, ll, Bid, SL(), TP(), 0, 0);

{условие}

SetOrder("", OP_BUYLIMIT, ll, Ask, SL(), TP(), 0, 0);
{условие}

SetOrder("", OP_SELLLIMIT, ll, Bid, SL(), TP(), 0, 0);

{условие}


 


Hi!

For some reason, when I plug in your library, the extern operator stops working, i.e. the variables are defined, everything compiles normally, and in principle the EA works, but at the same time the EA has no parameters when starting the type, even though there are quite a few parameters. What may be the reason for this?

Reason: