Files:
candlepatterns.mqh
41 kb
#include <Expert\Expert.mqh> #include <candlepatterns.mqh> ulong Expert_MagicNumber =3434; // bool Expert_EveryTick =false; // //+------------------------------------------------------------------+ //| Global expert object | //+------------------------------------------------------------------+ CExpert ExtExpert; CCandlePattern *fican; //+------------------------------------------------------------------+ //| Initialization function of the expert | //+------------------------------------------------------------------+ int OnInit(){ if(!ExtExpert.Init(Symbol(),Period(),Expert_EveryTick,Expert_MagicNumber)) {//--- failed printf(__FUNCTION__+": error initializing expert"); ExtExpert.Deinit(); return(INIT_FAILED); } //--- Creating signal CExpertSignal *signal = new CExpertSignal; if(signal==NULL){ printf(__FUNCTION__+": error creating signal"); ExtExpert.Deinit(); return(INIT_FAILED); } ExtExpert.InitSignal(signal); CIndicators *indicators = new CIndicators; if(indicators==NULL){ printf(__FUNCTION__+": IND NIJE dignut signal"); ExtExpert.Deinit(); return(INIT_FAILED); } //ExtExpert.InitIndicators(indicators); //--- Creating filter CMySignalEnvelopes //CMySignalEnvelopes *filter0=new CMySignalEnvelopes; CCandlePattern *filter0 = new CCandlePattern; fican = filter0; if(filter0==NULL){ printf(__FUNCTION__+": error creating filter0"); ExtExpert.Deinit(); return(INIT_FAILED); } filter0.MAPeriod(22); //--- Tuning of all necessary indicators if(!ExtExpert.InitIndicators()){ printf(__FUNCTION__+": error initializing indicators"); ExtExpert.Deinit(); return(INIT_FAILED); } if(!filter0.InitIndicators(indicators)){ printf(__FUNCTION__+": error initializing CC "); ExtExpert.Deinit(); return(INIT_FAILED); } filter0.ValidationSettings(); filter0.InitSignal(signal); signal.AddFilter(filter0); //--- Set filter parameters return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| "Tick" event handler function | //+------------------------------------------------------------------+ void OnTick(){ ExtExpert.OnTick(); // fican.InitIndicators(indicators); fican.CheckPatternAllBullish(); // Print(fican.CheckPatternAllBullish()); Print("Read price "+ExtExpert.Low(0)+" O1 "+ExtExpert.Open(1)+" C1 "+ExtExpert.Close(1)+" O2 "+ExtExpert.Open(2)); }
Try this.
nicholishen:
Try this.
You're genius!
Finally, the real answer
Now I can go on
Thank You very much!!
nicholish en:
Try this.
Hi. I'm trying to use your suggested code but its not working.
i get this error in tester journal:
2020.07.14 16:18:11.114 2018.05.01 00:00:00 invalid pointer access in 'candlepatterns.mqh' (156,20)
2020.07.14 16:18:11.114 OnInit critical error
can anyone help?
(problem occured whle back-testing the same code as above written and the same " candlepatterns.mqh " which topic started with)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register