//+------------------------------------------------------------------+ //| Signal.mq5 | //| Copyright 2010,SSN | //| | //+------------------------------------------------------------------+ #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh> #include <Trade\PositionInfo.mqh> #include <Expert\ExpertSignal.mqh> class CSignal : public CExpertSignal { protected: CiTickVolume *m_Ticks; CiVolumes *m_volumes; double m_adjusted_point; // point value adjusted for 3 or 5 points CSymbolInfo m_symbol; // symbol info object\ public: CSignal(); //--- virtual bool Init(CSymbolInfo* symbol,ENUM_TIMEFRAMES period,double adjusted_point); virtual bool InitIndicators(CIndicators *indicators); //--- protected: int InitPeriods(string speed); bool InitTicks(CIndicators *indicators); bool InitVolumes(CIndicators *indicators); //--- public: long Ticks(int ind) { return(m_Ticks.GetData(ind)); } double Tvolumes(int ind) { return(m_volumes.Main(ind)); } }; CSignal signal; void CSignal::CSignal() { //--- initialize protected data m_Ticks =NULL; m_volumes =NULL; } bool CSignal::Init(CSymbolInfo* symbol,ENUM_TIMEFRAMES period,double adjusted_point) { if(CheckPointer(m_Ticks)==POINTER_INVALID) { printf("CSignal: ticks Pointer is invalid, EA halted"); return(false); } if(CheckPointer(m_volumes)==POINTER_INVALID) { printf("CSignal: volumes Pointer is invalid, EA halted"); return(false); } //--- ok return(true); } bool CSignal::InitIndicators(CIndicators *indicators) { if(!InitTicks(indicators)) return(false); if(!InitVolumes(indicators)) return(false); //--- ok return(true); } bool CSignal::InitTicks(CIndicators *indicators) { //--- create volume indicator and add it to collection if(m_Ticks==NULL) if((m_Ticks=new CiTickVolume)==NULL) return(false); if(!indicators.Add(m_Ticks)) return(false); //--- initialize volume indicator if(!m_Ticks.Create(m_symbol.Name(),PERIOD_M1)) return(false); //--- ok return(true); } bool CSignal::InitVolumes(CIndicators *indicators) { //--- create volume indicator and add it to collection if(m_volumes==NULL) if((m_volumes=new CiVolumes)==NULL) return(false); if(!indicators.Add(m_volumes)) return(false); //--- initialize volume indicator if(!m_volumes.Create(m_symbol.Name(),PERIOD_H1,VOLUME_TICK)) return(false); //--- ok return(true); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- int i,p; long ticks; double volumes; p=7; ticks=0; volumes=0; for(i=1;i<p;i++) { ticks+=signal.Ticks(i); volumes+=signal.Tvolumes(i); } Print(" ticks : ",ticks ," volumes r : ",volumes); } //+------------------------------------------------------------------+
Here is also a snap of my journal
Have you read those articles?
Thanks for your comments, I was able to resolve that.
I now have another problem. Having upgraded to build 350, My strategy tester cannot run any tests despite having all the relevant price data.
I get this message in my journal
2010.10.30 13:01:04 Core 1 EURUSD,Daily: 0 ticks (0 bars) generated within 0 ms (total bars in history 311)
...there are 'no errors' as well...? what could be the problem?
Thanks for your comments, I was able to resolve that.
I now have another problem. Having upgraded to build 350, My strategy tester cannot run any tests despite having all the relevant price data.
I get this message in my journal
2010.10.30 13:01:04 Core 1 EURUSD,Daily: 0 ticks (0 bars) generated within 0 ms (total bars in history 311)
...there are 'no errors' as well...? what could be the problem?
Have you tried to recompile your EA?
Is your problem reproducing now?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
My EA compiles well but on debugging it throws up this error prior to any trade. How does one access h1 volume? Below are excerpts of my source