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
I need some advice to help me using sting type data in my zigzag class or structure.
I have problem with this error
'indname' - parameter conversion not allowed indicatorclass_zigzag rev1.mq5 48 13
#property copyright "@min" #include <indicators/indicators.mqh> #include <indicators/Custom.mqh> double fracUP_MAC[]; double fracDW_MAC[]; int frac_MACR_Handle; struct ZigzagSettings { ENUM_TIMEFRAMES tf; int Depth; int Deviation; int BackStep; }; class MyZIGZAGs : public CIndicators { public: static string indname; ~MyZIGZAGs(void){}; CiCustom* operator[](int i) { return this.At(i); } bool create(ZigzagSettings &settings[]) { for (int i=0; i<ArraySize(settings); i++) { CiCustom *zigzag = new CiCustom(); bool create = zigzag.Create( _Symbol, settings[i].tf, IND_CUSTOM, 4, indname, settings[i].Depth, settings[i].Deviation, settings[i].BackStep ); if (!create || !this.Add(zigzag)) return false; } return true; } }; string MyZIGZAGs:: indname={"Examples\\ZigzagColor"}; MyZIGZAGs g_zigzags; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- ArraySetAsSeries(fracUP_MAC,true); ArraySetAsSeries(fracDW_MAC,true); ZigzagSettings settings[] = { {PERIOD_M1, 12, 5, 3}, {PERIOD_M3, 20, 5, 3} }; g_zigzags.Clear(); if (!g_zigzags.create(settings)) return INIT_FAILED; //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- for (int i=0; i<g_zigzags.Total(); i++) { CiCustom *zigzag = g_zigzags[i]; frac_MACR_Handle = zigzag.Handle(); CopyBuffer(frac_MACR_Handle,0,3,1000,fracUP_MAC); CopyBuffer(frac_MACR_Handle,1,3,1000,fracDW_MAC); } } //+------------------------------------------------------------------+