As the indicator data are stored in only one array: ExtOutputBuffer
you should find the e.g. value4 (newest bar) => ExtOutputBuffer[0], value3 (prev. bar) => ExtOutputBuffer[1], value2 => ExtOutputBuffer[n], value4 => ExtOutputBuffer[n+1];
To use garch.mq4 in an EA read about iCustom(..)
zerrow: how to get these values from it
| Just read them, it has just one buffer. Detailed explanation of iCustom - MQL4 forum |
Thanks, I'll try to figure it out.
OK. I have some coding done. But it is just to make it work without any sophisticated logic. I understand that my coding is very dirty. My question is does exist any normal debugger like in other languages to see result of functions and variables, because I cannot understand what's wrong. Please check my modified expert and ea, may be you can find errors. Here is my indicator:
Here is my EA:
//+------------------------------------------------------------------+ //| garch_expert_v.3.mq4 | //| Copyright 2014, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2014, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "3.00" #property strict //--- input parameters input double GarchVar=0.001; double GarchNum; double indicator_call; extern double control_line; extern int e_type_data = PRICE_CLOSE; extern int e_reverse_data = 1; extern double e_alpha = 0.010; extern double e_beta = 0.080; int order_send; extern double LOTSize=0.01; double price; extern int stoploss = 100; extern int takeprofit = 200; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert logic | //+------------------------------------------------------------------+ int start() { indicator_call = iCustom(NULL ,0 ,"garch_mod_1",3, GarchNum); if (GarchNum > 0.00001) order_send = OrderSend(Symbol(),OP_BUY,1,price,3,stoploss,takeprofit,"My order",0,clrGreen); if (GarchVar <0.0001) OrderClose( "My order" , 0.5, Bid, 2 ); return 0; } // errors string Error(int error_code) { string error_string; switch(error_code) { case 0: error_string="Net oshibok";break; case 1: error_string="Net oshibki, no rezul'tat neizvesten"; break; case 2: error_string="Obshhaja oshibka"; break; case 3: error_string="Nepravil'nye parametry"; break; case 4: error_string="Torgovyj server zanjat"; break; case 5: error_string="Staraja versija klientskogo terminala"; break; case 6: error_string="Net svjazi s torgovym serverom"; break; case 7: error_string="Nedostatochno prav"; break; case 8: error_string="Slishkom chastye zaprosy"; break; case 9: error_string="Nedopustimaja operacija narushajushhaja funkcionirovanie servera"; break; case 64: error_string="Schet zablokirovan"; break; case 65: error_string="Nepravil'nyj nomer scheta"; break; case 128: error_string="Istek srok ozhidanija sovershenija sdelki"; break; case 129: error_string="Nepravil'naja cena"; break; case 130: error_string="Nepravil'nye stopy"; break; case 131: error_string="Nepravil'nyj ob#em"; break; case 132: error_string="Rynok zakryt"; break; case 133: error_string="Torgovlja zapreshhena"; break; case 134: error_string="Nedostatochno deneg dlja sovershenija operacii"; break; case 135: error_string="Cena izmenilas'"; break; case 136: error_string="Net cen"; break; case 137: error_string="Broker zanjat";break; case 138:error_string="Novye ceny Ask="+DoubleToStr(Ask,Digits)+" Bid="+DoubleToStr(Bid,Digits); break; case 139: error_string="Order zablokirovan i uzhe obrabatyvaetsja"; break; case 140: error_string="Razreshena tol'ko pokupka";break; case 141: error_string="Slishkom mnogo zaprosov"; break; case 145: error_string="Modifikacija zapreshhena, tak kak order slishkom blizok k rynku"; break; case 146: error_string="Podsistema torgovli zanjata"; break; case 147: error_string="Ispol'zovanie daty istechenija ordera zapreshheno brokerom"; break; case 148: error_string="Kolichestvo otkrytyh i otlozhennyh orderov dostiglo predela, ustanovlennogo brokerom.";break; case 4000: error_string="Net oshibki"; break; case 4001: error_string="Nepravil'nyj ukazatel'funkcii"; break; case 4002: error_string="Indeks massiva - vne diapazona"; break; case 4003: error_string="Net pamjati dlja steka funkcij"; break; case 4004: error_string="Perepolnenie steka posle rekursivnogo vyzova"; break; case 4005: error_string="Na steke net pamjati dlja peredachi parametrov"; break; case 4006: error_string="Net pamjati dlja strokovogo parametra"; break; case 4007: error_string="Net pamjati dlja vremennoj stroki"; break; case 4008: error_string="Neinicializirovannaja stroka"; break; case 4009: error_string="Neinicializirovannaja stroka v massive"; break; case 4010: error_string="Net pamjati dlja strokovogo massiva"; break; case 4011: error_string="Slishkom dlinnaja stroka"; break; case 4012: error_string="Ostatok ot delenija na nol'"; break; case 4013: error_string="Delenie na nol'"; break; case 4014: error_string="Neizvestnaja komanda"; break; case 4015: error_string="Nepravil'nyj perehod"; break; case 4016: error_string="Neinicializirovannyj massiv"; break; case 4017: error_string="Vyzovy DLL ne razresheny"; break; case 4018: error_string="Nevozmozhno zagruzit' biblioteku"; break; case 4019: error_string="Nevozmozhno vyzvat' funkciju"; break; case 4020: error_string="Vyzovy vneshnih bibliotechnyh funkcij ne razresheny"; break; case 4021: error_string="Nedostatochno pamjati dlja stroki, vozvrashhaemoj iz funkcii"; break; case 4022: error_string="Sistema zanjata"; break; case 4050: error_string="Nepravil'noe kolichestvo parametrov funkcii"; break; case 4051: error_string="Nedopustimoe znachenie parametra funkcii"; break; case 4052: error_string="Vnutrennjaja oshibka strokovoj funkcii"; break; case 4053: error_string="Oshibka massiva"; break; case 4054: error_string="Nepravil'noe ispol'zovanie massiva-tajmserii"; break; case 4055: error_string="Oshibka pol'zovatel'skogo indikatora"; break; case 4056: error_string="Massivy nesovmestimy"; break; case 4057: error_string="Oshibka obrabotki global'nyeh peremennyh"; break; case 4058: error_string="Global'naja peremennaja ne obnaruzhena"; break; case 4059: error_string="Funkcija ne razreshena v testovom rezhime"; break; case 4060: error_string="Funkcija ne razreshena"; break; case 4061: error_string="Oshibka otpravki pochty"; break; case 4062: error_string="Ozhidaetsja parametr tipa string"; break; case 4063: error_string="Ozhidaetsja parametr tipa integer"; break; case 4064: error_string="Ozhidaetsja parametr tipa double"; break; case 4065: error_string="V kachestve parametra ozhidaetsja massiv"; break; case 4066: error_string="Zaproshennye istoricheskie dannye v sostojanii obnovlenija"; break; case 4067: error_string="Oshibka pri vypolnenii torgovoj operacii"; break; case 4099: error_string="Konec fajla"; break; case 4100: error_string="Oshibka pri rabote s fajlom"; break; case 4101: error_string="Nepravil'noe imja fajla"; break; case 4102: error_string="Slishkom mnogo otkrytyh fajlov"; break; case 4103: error_string="Nevozmozhno otkryt' fajl"; break; case 4104: error_string="Nesovmestimyj rezhim dostupa k fajlu"; break; case 4105: error_string="Ni odin order ne vybran"; break; case 4106: error_string="Neizvestnyj simvol"; break; case 4107: error_string="Nepravil'nyj parametr ceny dlja torgovoj funkcii"; break; case 4108: error_string="Nevernyj nomer tiketa"; break; case 4109: error_string="Torgovlja ne razreshena.Neobhodimo vkljuchit' opciju Razreshit' sovetniku torgovat' v svojstvah jeksperta."; break; case 4110: error_string="Dlinnye pozicii ne razresheny. Neobhodimo proverit' svojstva jeksperta."; break; case 4111: error_string="Korotkie pozicii ne razresheny. Neobhodimo proverit' svojstva jeksperta."; break; case 4200: error_string="Ob#ekt uzhe sushhestvuet"; break; case 4201: error_string="Zaprosheno neizvestnoe svojstvo ob#ekta"; break; case 4202: error_string="Ob#ekt ne sushhestvuet";break; case 4203: error_string="Neizvestnyj tip ob#ekta"; break; case 4204: error_string="Net imeni ob#ekta"; break; case 4205: error_string="Oshibka koordinat ob#ekta"; break; case 4206: error_string="Ne najdeno ukazannoe podokno"; break; default: error_string="Oshibka pri rabote s ob#ektom"; } return(error_string); } //+------------------------------------------------------------------+
Here is my indicator:
double GarchNum; : indicator_call = iCustom(NULL ,0 ,"garch_mod_1",3, GarchNum); if (GarchNum > 0.00001) //| GARCH.mq4 | extern double control_line_1 = 0.001; //control line l extern double control_line_2 = 0.00001 ; //control line 2 extern int e_type_data = PRICE_CLOSE; extern int e_reverse_data = 1; extern double e_alpha = 0.010; extern double e_beta = 0.080; IndicatorBuffers( 3 ); //how many buffers we have
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- Your iCustom calls "garch_mod_1.ex4" but your posted code for "garch.mq4"
- Your indicator takes five (5) parameters you are passing none - using the defaults.
- Your indicator has three (3) buffers, indexed [0 .. 2] but your iCustom call tries to access buffer 4 (index 3)
- The last parameter for iCustom is the shift number, an int. Your iCustom call passes a double that has a random value (GarchNum never initialized.)
- Even if the iCustom call worked, you assign the value to the double indicator_call which you never use. and then read the random value of GarchNum to determine opening an order.
- Detailed explanation of iCustom - MQL4 forum
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am not a creator of Garch indicator therefore I have some problems to get some values from it. If somebody get an ideas how to get these values from it, I would be very appreciated.
I mean previous highest value of dot 1 and reverse value of dot 2,
Last lowest value of dot 3 and reverse value of dot 4.
I think the out put value of indicator has to be "GarchNum"
Here is the code: