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

 

Expert Advisor based on ZUP with modified pitchforks

When using indicator with pitchforks, in the tester, for some reason the indicator pitchforks turn in the opposite direction (backwards)

What can cause this reversal

 
Cmu4:
Gentlemen, if you don't mind, please send me the function that trawls equity. I can't find it...

https://www.mql5.com/ru/code/8781

And there's plenty in codebase.

 
Help me find a slippage-aware order placement function with no 130-134 errors.
 
xrust:

https://www.mql5.com/ru/code/8781

And there's plenty in the codebase

I'll add Igor Kim's advisor.
 
Roman.:


Hi, Dimitri. For my part, I am ready to suggest you the following variant. For analogy, see the triggering of the trading criteria of this article - there are also two signals - namely, see after the second picture "The first thing you should wait for on the DeMarker chart is the moment when the DeMarker crosses the fast and slow MA line near 0.7 for a short position. This is the first preliminary signal. Then we wait for the crossing of the MA lines themselves. This is the main signal, after which the Taichi indicator readings can be taken. If the MA lines are not crossed, it is considered a false signal and the price movement will continue. Here is how it is implemented in my code - in the included inclusion of owls that are responsible for triggering of trade criteria.

The main trick is that we work through the two below mentioned fi nds by setting and resetting flags when one or another trading criterion is triggered.

You will additionally save the current time when the main criterion is triggered using TimeCurrent, i.e. you will specify an expression of type x = TimeCurrent beforereturn(OP_BUY); orreturn(OP_SELL); where x is a global variable of datetime type by analogy in the firstint_op_DeMarker function. Then do the same with the secondint type_op_MA function... - there you memorize variable y = TimeCurrent;

Then in the block of trade criteria calculation you compare the plus sign and the value of these two variables, as follows (it turns out that you don't need the analogue of working with UTC values - instead you take a comparison of time of receipt of your two trade signals):

P.S. Plus I am sending you a function for the possibility to optimize the value of the working TF.

P.P.S. This is how this code structure is organized in my code. I do not exclude that there are much better code variants for fulfilling such conditions of the EA. :-)))

Thank you very much, your answer was very helpful
 
demlin:
Thank you very much, your answer was very helpful

:-))) And I was beginning to think that you had swallowed it and sent me away with all those analogies, examples, etc. .... :-)))
 
Roman.:

:-))) I thought you'd swallowed it and sent me away with all those analogies, examples, etc. .... :-)))
I haven't come near my computer for some time))). Just did not quite understand about the function of optimization of the working TF. What is it?
 
demlin:
Haven't been near the computer for a while))). Just didn't quite understand about the function to optimise the working TF. What is it?

It's just a kind of "adapter", which allows optimizing EA's timeframes through external variables of owl to set the best (-those, in case of owl working on several TFs) for its operation... A good and useful feature...
 
Roman.:

It's just a kind of "adapter" that allows to optimise EA timeframes via external owl variables to set the best (-those, in case of owl operation on several TFs) for its operation... A good and useful feature...
How to get it?
 
demlin:
How do you get it?


In my answer, look carefully at the code - it's listed right after the end of Criterion {... return (0)}... in the external variables block:

extern int t_trend_period =6; // для оптимизации по всем периодам от 0 до 7 шаг 1
                              // на каком ТФ работаем: 1-М1, 2-М5, 3-М15, 4-М30, 5-Н1, 6 - Н4, 7-день

and how to use it to obtain indicator values:

//--------------------------------------------------------------- 3 --
int Criterion()                        // Пользовательская функция
  {
  //--------------------------------------------------------------- 4 --
int trend_period=GetPeriod(t_trend_period); // для выбора оптимального значения рабочего ТФ

   // Параметры технич. индикат:
                 
double Taichi_1 = iCustom (Symbol(), trend_period, "Cronex Taichi",Tenkan, Kijun, Senkou, FlatSE, 0, 1);
...
...
//--------------------------------------------------------------- 6 --
   return(0);                          // Выход из пользов. функции
  }
//--------------------------------------------------------------- 7 --

//для оптимизации по всем ТФ
int GetPeriod(int period)
{int periodres;
 switch(period)
  {
   case 1: periodres=1;break;
   case 2: periodres=5;break;
   case 3: periodres=15;break;
   case 4: periodres=30;break;
   case 5: periodres=60;break;
   case 6: periodres=240;break;
   case 7: periodres=1440;break;
   case 8: periodres=10080;break;
   default: periodres=1;break;
  }
return(periodres);
}