Trend indicators for EAs. - page 5

 
Petros Shatakhtsyan:

The best and fastest and most accurate indicator, is our brain, which processes visual charts instantly.

One who does not know how to trade with his hands, he will never be able to develop a profitable Expert Advisor.

Forex is not a case where a computer uses its capabilities to quickly determine e.g. fingerprints or teach a robot to walk using machine learning.

In forex such things do not work. It's not predictable, like a football game.

Brains yes. They are really cooler than a computer, but I would like to discuss trend indices rather than brains in this thread.

But I agree. Learned to trade by hand and managed to algorithmise my approach - wrote a profitable owl (one way).

 
Aleksey Ivanov:

Brains yes. They are really cooler than a computer, but I would like to discuss trend indices in this thread, not brains.

I do not think so. If I learned how to trade using hands and managed to algorithmize my approach I wrote a profitable owl (one of the ways).

As I already told you, no indicator is capable of determining the current trend. If it has already been done no one needs it.

 
Alexey Volchanskiy:

Hang it at breakeven and you will be happy. As Petros rightly pointed out, it is impossible to determine the beginning and the end.

Then try to break through the channel, at least it gives something.

I understand it very well. I would like to hear a positive opinion on the trend indices here but so far it is negative (may be there is truth in it).
 
Aleksey Ivanov:

Gentlemen! There are thousands of indicators on the Internet that are used for trend identification.

My question to active EA developers who studied this problem in practice: "In your opinion, what indicators are really promising to be used in EAs for reliable detection of a trend beginning?

In my opinion, it would be desirable for Expert Advisors to discuss (in terms of advantages and disadvantages) indicators with scales, say, the trend strength varies from -1 to 1 .

The difficulty in identifying a trend is that the boundary between a flat and a trend is a matter of fuzzy logic.

This issue is partially addressed in the article "How to reduce trader's risks " https://www.mql5.com/ru/articles/4233.

Как снизить риски трейдера
Как снизить риски трейдера
  • www.mql5.com
В первую очередь, эта статья пригодится начинающим трейдерам и аналитикам, которые работают над созданием собственной торговой системы. Надеюсь, что многие вопросы будут интересны и опытным участникам рынка. Это, например, классификация видов риска, использование свечного анализа для определения зон перекупленности/перепроданности, взаимосвязь...
 
Petros Shatakhtsyan:

The best and fastest and most accurate indicator, is our brain, which instantly processes visual charts.

One who does not know how to trade with his hands, he will never be able to develop a profitable Expert Advisor.

Forex is not a case where a computer uses its capabilities to quickly detect, for example, fingerprints or teach a robot to walk using machine learning.

In forex such things do not work. It is not predictable, like a football game.

Again you are wrong to be harshly categorical. ATS implements the result of your brain's activity in calmly discussing market problems and the brain has to reproduce adequate solutions. Your brain checks and rechecks your thought process hundreds of times and gives the correct verdict. But in real trading, with limited time, your brain can make mistakes, and you may not notice it, because your subconscious mind, which is out of your control, works too. In contrast, the computer executes the will of your brain accurately and error-free within the framework of the ATC. Are there any other arguments against ATC?

 
Aleksey Ivanov:
Yes I understand it well. I would like to hear a positive opinion on trend indices here, but so far it is negative (maybe there is truth in it).

Positive so positive....

Trend indicator line?

Trade it, here it is (let's say correct):

How many times has the signal changed for the EA?

 
Petros Shatakhtsyan:

I already told you, no indicator is capable of determining the current trend. And no one needs a past one.

I understand your opinion. Thank you. I would like to hear other opinions as well.

 
Aleksandr Masterskikh:

The difficulty in identifying a trend is that the boundary between a flat and a trend is a matter of fuzzy logic.

This issue is partly addressed in the article "How to reduce trader's risks" https://www.mql5.com/ru/articles/4233

Thank you. I will try to study it. Are there any tips on your Tool in the form of an inductor?
 
Aleksey Ivanov:
Here's a case in point. One turkey has already been composed. Cooking it (writing code) is a matter of five minutes. Let's get to the point.
//+------------------------------------------------------------------+
//|                                                      MAScale.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                             https://mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://mql5.com/ru/users/artmedia70"
#property version   "1.00"
#property description "Scale of moving average"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_plots   1
//--- plot MASC
#property indicator_label1  "MASC"
#property indicator_type1   DRAW_COLOR_HISTOGRAM
#property indicator_color1  clrRoyalBlue,clrOrangeRed,clrDarkGray
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2
//--- input parameters
input uint                 InpPeriod         =  14;            // Period
input ENUM_APPLIED_PRICE   InpAppliedPrice   =  PRICE_CLOSE;   // MA Applied price
input ENUM_MA_METHOD       InpMethod         =  MODE_EMA;      // MA method
input ENUM_APPLIED_PRICE   InpByPrice        =  PRICE_CLOSE;   // Distance from:
//--- indicator buffers
double         BufferMASC[];
double         BufferColors[];
double         BufferMA[];
double         BufferMA1[];
double         BufferATR[];
//--- global variables
int            period;
int            handle_ma;
int            handle_ma1;
int            handle_atr;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- set global variables
   period=int(InpPeriod<1 ? 1 : InpPeriod);
//--- indicator buffers mapping
   SetIndexBuffer(0,BufferMASC,INDICATOR_DATA);
   SetIndexBuffer(1,BufferColors,INDICATOR_COLOR_INDEX);
   SetIndexBuffer(2,BufferATR,INDICATOR_CALCULATIONS);
   SetIndexBuffer(3,BufferMA1,INDICATOR_CALCULATIONS);
   SetIndexBuffer(4,BufferMA,INDICATOR_CALCULATIONS);
//--- setting indicator parameters
   IndicatorSetString(INDICATOR_SHORTNAME,"Scale of moving average ("+(string)period+")");
   IndicatorSetInteger(INDICATOR_DIGITS,Digits());
//--- setting buffer arrays as timeseries
   ArraySetAsSeries(BufferMASC,true);
   ArraySetAsSeries(BufferColors,true);
   ArraySetAsSeries(BufferATR,true);
   ArraySetAsSeries(BufferMA1,true);
   ArraySetAsSeries(BufferMA,true);
//--- create MA's handles
   ResetLastError();
   handle_ma1=iMA(NULL,PERIOD_CURRENT,1,0,MODE_SMA,InpByPrice);
   if(handle_ma1==INVALID_HANDLE)
     {
      Print("The iMA(1) by ",EnumToString(InpByPrice)," object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }
   handle_ma=iMA(NULL,PERIOD_CURRENT,period,0,InpMethod,InpAppliedPrice);
   if(handle_ma==INVALID_HANDLE)
     {
      Print("The iMA(",(string)period,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }
   handle_atr=iATR(NULL,PERIOD_CURRENT,period);
   if(handle_atr==INVALID_HANDLE)
     {
      Print("The iATR(",(string)period,") object was not created: Error ",GetLastError());
      return INIT_FAILED;
     }
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//--- Проверка и расчёт количества просчитываемых баров
   if(rates_total<fmax(period,4)) return 0;
//--- Проверка и расчёт количества просчитываемых баров
   int limit=rates_total-prev_calculated;
   if(limit>1)
     {
      limit=rates_total-2;
      ArrayInitialize(BufferMASC,EMPTY_VALUE);
      ArrayInitialize(BufferATR,0);
      ArrayInitialize(BufferMA,0);
     }
//--- Подготовка данных
   int count=(limit>1 ? rates_total : 1),copied=0;
   copied=CopyBuffer(handle_ma,0,0,count,BufferMA);
   if(copied!=count) return 0;
   copied=CopyBuffer(handle_ma1,0,0,count,BufferMA1);
   if(copied!=count) return 0;
   copied=CopyBuffer(handle_atr,0,0,count,BufferATR);
   if(copied!=count) return 0;

//--- Расчёт индикатора
   for(int i=limit; i>=0 && !IsStopped(); i--)
     {
      BufferMASC[i]=(BufferATR[i]!=0 ? (BufferMA1[i]-BufferMA[i])/BufferATR[i] : 0);
      BufferColors[i]=(BufferMASC[i]>BufferMASC[i+1] ? 0 : BufferMASC[i]<BufferMASC[i+1] ? 1 : 2);
     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Aleksey Ivanov:

Gentlemen! There are thousands of indicators on the Internet that are used for trend identification.

My question to active EA developers who studied this problem in practice: "In your opinion, what indicators are really promising to be used in EAs for reliable detection of trend beginning?

For Expert Advisors, it would be desirable, in my opinion, to discuss (in terms of advantages and disadvantages) indicators with scales, say, the trend strength varies from -1 to 1 .

It is a good idea to start with determining the statistical trend model (even a simple one). There are two main options: TS-row or DS-row. This one may look like an unnecessary complication, but it may be useful later on. For example, it may give some ability to distinguish a correction from a trend break.