Download MetaTrader 5

Candlepattern Class, CPriceSeries::GetData: invalid buffer error.

To add comments, please log in or register
Rodolfo Andrade
987
Rodolfo Andrade  

Hello, I tried to make this simple script test below, but I getting this error: CPriceSeries::GetData: invalid buffer.

Please anybody can help me to understand?

Here you can find Candlepattern class: https://www.mql5.com/en/code/291 

 

#include <Indicators\CandlePatterns.mqh>
 
void OnStart() {
   CCandlePattern candle;
   
   if(candle.CheckPatternAllBearish()) Alert("Bearish pattern detected!"); else
    if(candle.CheckPatternAllBullish()) Alert("Bullish pattern detected!"); else Alert("Nothing!");
}
MQL5 Wizard - Candlestick Patterns Class
MQL5 Wizard - Candlestick Patterns Class
  • votes: 11
  • 2011.02.16
  • MetaQuotes Software Corp.
  • www.mql5.com
The class can be used for creation of trade signal classes with reversal candlestick patterns.
Alain Verleyen
Moderator
33598
Alain Verleyen  

This is class was written for first version of MQL5 Wizard and is now obsolete (for the wizard). There is a new version, you can find it in the last post of this topic All about MQL5 Wizard : create robots without programming.

Owen Fausd
57
Owen Fausd  

Hello,


I also tried to use this class, first with the old version (Revision 2011.02.23) then with the new version you posted in the link (Revision 2011.03.18).

With both versions I get the Error:

"CPriceSeries::GetData: invalid buffer"

I also get this Error, when I create objects for Open, High, Low, Close, Spread, Time, TickVolume, RealVolume and pass the to the methods

SetPriceSeries(...)

and

SetOtherSeries(...)

I also had the idea of calling

InitIndicators(...)

with a new Object of "Indicators".

When I do this, the method blocks endless.

I followed the Error by debugging and found out, the Function

CSeries::CheckServerHistory(...)

runs in an endless-while-loop, where it checks "SeriesInfoInteger(..., SERIES_SERVER_FIRSTDATE, ...)"

Is this the proper use of this class?

If yes, how can I fix this endless-loop-problem?

Thanx a lot!

Owen Fausd
57
Owen Fausd  
Alain Verleyen:

This is class was written for first version of MQL5 Wizard and is now obsolete (for the wizard). There is a new version, you can find it in the last post of this topic All about MQL5 Wizard : create robots without programming.

I tested the newest version I found with Revision 2011.11.10.

I still get this error "CPriceSeries::GetData: invalid buffer" if I just create an object.

I can only guess, that I have to call "InitIndicators(...)". If I do, it blocks endless in "CSeries::CheckServerHistory(...)".

Looks like the call of "m_MA.BufferResize(50);" in function "bool CCandlePattern::InitMA(CIndicators *indicators)" in line 163 is responsible for this.

If I cut this out the initialisation works well and I get candlepattern-results.

But are they correct now? Is this Buffer-resizing nessecary? Why does that Check-Function run endless?


I also may not call two functions, which seem to be needed by the other Signal-Classes, I get those errors:

CExpertBase::SetPriceSeries: changing of timeseries is forbidden
CExpertBase::SetOtherSeries: changing of timeseries is forbidden

To add comments, please log in or register