Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1102

 
EgorKim:

Like this.

And some optimiser passes coincide in the visualiser.

And some passes - not a single transaction at all.

Discrepancies may be due to uninitialized values in the indicator buffer - when the calculation passes, there may be rubbish in the buffer.


Simply print the buffer data when the signal appears.

 
Vladimir Karputov:

Discrepancies can occur due to uninitialised values in the indicator buffer - when the calculation passes over, there may be rubbish in the buffer.


Simply print out the buffer data when the signal appears.

Are you talking about the EA?

If about the EA - I am zeroing everything in the example.

And if you're talking about an indicator - you can do anything. I'm not the author.

 
EgorKim:

Are you talking about the EA?

If you're talking about an EA, I'm zeroing everything in the example.

But if you're talking about an indicator, it could be anything. I'm not the author.

I was talking about the indicator: if you miss some index in the buffer, there may be rubbish. In general, first a reliable indicator - and then the Expert Advisor using it.

 
EgorKim:

Like this.

And some optimiser passes coincide in the visualiser.

And some passes don't match any deals at all

I think the problem is in the indicator.

And as Artem has rightly pointed out, the problem is in the actual data.

It just does not want to tell me how to do it)

No, I was wrong in thinking that you have a multi-timeframe indicator.

You have the most common indicator whose data you want to retrieve from someone else's timeframe.

In an EA, you need to check the relevance of the data from the desired timeframe. If there is no data for this timeframe yet, then exit until the next tick.
And then, when all of the data from the olderframe is received in the correct volume - then call the indicator.

Try to do it this way.

 
Artyom Trishkin:

No, I was wrong in thinking that you have a multi-timeframe indicator.

You have the most common indicator whose data you want to retrieve from someone else's timeframe.

In the Expert Advisor, you need to check the relevance of data from the desired timeframe. If there is no data for this timeframe yet, then exit until the next tick.
And then, when all of the data from the older timeframe is received in the correct volume - then call the indicator.

Try to do it this way.

How do you do that? I mean to check its relevance.

Well, I check that it is not 0.0 (code above).

What else can I do? What the indicator gives me, I will take it.

This is what the indicator does.

 
EgorKim:

How do you do that? I mean to check if it's up to date.

Well I check that it's not 0.0 (code above).

What else can I do? What I get from the indicator, I get.

It is an indicator for this reason.

Did you take indicator from KodoBase? If so, can you give me its URL?

 
EgorKim:

How do you do that? I mean to check if it's up to date.

Well I check that it's not 0.0 (code above).

What else can I do? What I get from the indicator, I get.

It is an indicator for this reason.

The error is in the indicator itself.

I have rewritten a lot of Expert Advisors and this is the first time this problem occurs.

You may look and build the Expert Advisor yourself, I have given the logic above.

And you can see how badly the terminal and the tester behave. The results are different even if the indicator parameters are the same)

 
Vladimir Karputov:

Did you get the indicator from KodoBase? If so, can I have its URL?

Yes

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

Plombiers - Осциллятор в канале
Plombiers - Осциллятор в канале
  • www.mql5.com
Просмотров: 6747 Рейтинг: Опубликован: 2010.01.26 12:54 Обновлен: 2016.11.22 07:33 Пример использования канала и осциллятора Stochastic. Иногда полезно смотреть поведение осциллятора в канале. Оценка ситуации упрощается. Изменяя параметры, можно гибко настроить отображение индикатора. Bulls Bears Power...
 

In general, you can test it for now (works on the indicatorPlombiers - oscillator in the channel- the indicator should be in the folder [data folder]\MQL5\Indicators\plombiers.mq5)


Trading strategy idea

The Expert Advisor works using the custom indicatorPlombiers. For signals formation two lines of the indicator are considered: "Resistance" and "Support".

Plombiers EA

Signal forBUY position opening: Low price on bar #1 was below the "Support" line on bar #1

Signal to open aSELL position: price High on bar #1 was higher than the "Resistance" line on bar #1

//+------------------------------------------------------------------+
//| Search trading signals                                           |
//+------------------------------------------------------------------+
bool SearchTradingSignals(void)
  {
   double means[],resistance[],support[];
   MqlRates rates[];
   ArraySetAsSeries(means,true);
   ArraySetAsSeries(resistance,true);
   ArraySetAsSeries(support,true);
   ArraySetAsSeries(rates,true);
   int start_pos=0,count=3;
   if(!iGetArray(handle_iCustom,0,start_pos,count,means) || 
      !iGetArray(handle_iCustom,1,start_pos,count,resistance) || 
      !iGetArray(handle_iCustom,2,start_pos,count,support) || 
      CopyRates(m_symbol.Name(),Period(),start_pos,count,rates)!=count)
     {
      return(false);
     }

   int size_need_position=ArraySize(SNeedPosition);
   if(rates[1].low<support[1])
     {
      if(!InpReverse)
        {
         ArrayResize(SNeedPosition,size_need_position+1);
         SNeedPosition[size_need_position].pos_type=POSITION_TYPE_BUY;
         return(true);
        }
      else
        {
         ArrayResize(SNeedPosition,size_need_position+1);
         SNeedPosition[size_need_position].pos_type=POSITION_TYPE_SELL;
         return(true);
        }
     }
   if(rates[1].high>resistance[1])
     {
      if(!InpReverse)
        {
         ArrayResize(SNeedPosition,size_need_position+1);
         SNeedPosition[size_need_position].pos_type=POSITION_TYPE_SELL;
         return(true);
        }
      else
        {
         ArrayResize(SNeedPosition,size_need_position+1);
         SNeedPosition[size_need_position].pos_type=POSITION_TYPE_BUY;
         return(true);
        }
     }
//---
   return(true);
  }
 
Vladimir Karputov:

In general, you can test it for now (works on the indicatorPlombiers - oscillator in the channel- the indicator should be in the folder [data folder]\MQL5\Indicators\plombiers.mq5)


Trading strategy idea

The Expert Advisor works using the custom indicatorPlombiers. For signals formation two lines of the indicator are considered: "Resistance" and "Support".


Signal forBUY position opening: Low price on bar #1 was below the "Support" line on bar #1

Signal to open aSELL position: the High price on the bar #1 was higher than the "Resistance" line on the bar #1

Take the "Support" and"Resistance" values from the higher timeframe

I.e. the MTF indicator must be in the optimizer input

input ENUM_TIMEFRAMES TimeFramePlombiers=PERIOD_H4;

handle_Plombiers=iCustom(Symbol(),TimeFramePlombiers,"plombiers",итд);

Like this