Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 900

 
Hello! How do I connect a custom indicator to an EA as a resource?
 
Oleg Kolesov:
Hello! How do I connect a custom indicator to an EA as a resource?
#resource "\\Indicators\\indicator.ex4"
 

Hello Taras! Been working with you. Good to meet you. I connected the indicator to my Expert Advisor as a resource. I am not sure if I did it correctly?

//|www.koles.75@inbox.ru |
//+------------------------------------------------------------------+
#resource "\\Indicators\\\KChange.ex4"
#property copyright "Koles"
#property link "https://www.koles.75@inbox.ru"
#property version "1.00"
#property strict

int start()

{
H=iCustom(NULL,TF,"::Indicators\\\KChange.ex4",History,Period_1,Period_2,MA_method,0,1);

The compiler has not found any errors, but the tester is working much slower? Is it normal?

//-----------------------------------------------------------------------------------------------------------------

The MQL4 manual says: reference to variables in theinitialization function?

//+------------------------------------------------------------------+

//| Expert initializationfunction|
//+------------------------------------------------------------------+
intOnInit()
{
//--- get the value of the custom indicator
doublevalue=iCustom(_Symbol,_Period,"::Indicators\\\SampleIndicator.ex4",0,0);

Reference to indicator variables in theinitialization function , not in the start function? Please advise experienced people!

 
Oleg Kolesov:
Hello! How do I connect a custom indicator to an EA as a resource?

Help at the top:"Documentation" is called.

Please refer to "MQL5 Programs --> Resources --> " there see"Working with custom indicators connected as resources".

Everything is clear and simple. And often with examples.

Документация по MQL5: Программы MQL5 / Ресурсы
Документация по MQL5: Программы MQL5 / Ресурсы
  • www.mql5.com
В данном примере показано как проигрывать звуки из файлов Ok.wav и timeoit.wav, входящих в стандартную поставку терминала. Эти файлы находятся в папке означает папку, из которой запущен клиентский терминал MetaTrader 5.  Программным путем из mql5-программы каталог терминала можно узнать следующим образом: Расположение каталога данных терминала...
 
Artem indicator and EA files EX4.
 
Oleg Kolesov:
Artem indicator and EA files EX4.

The indicator must be inserted into the EA as an executable file (.ex4/.ex5), but if the EA is also an executable file, and there is no source file, then there is no way.

 

Hello, I would like to write an EA which will place a pending order at every tick. But it will put BuyStop on the first tick and then not put it again. There is an error 130. What is the problem? Please help me.


#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include  <Init_Deinit.mqh> 

// Переменные
extern double lots    = 0.01;
extern int    Level   = 200;
extern double StopL   = 300;
extern double TakeP   = 1000;


// Start Programm
void OnTick() 
  { 
  //--- вычисленные значений для BuyStop
   double price_buystop=Ask+Level*Point; 
   StopL =NormalizeDouble(price_buystop-StopL*Point,Digits); 
   TakeP =NormalizeDouble(price_buystop+TakeP*Point,Digits); 
   
//--- Размещаем отложный ордер BuyStop
   int ticket=OrderSend(Symbol(),OP_BUYSTOP,lots,price_buystop,3,StopL,TakeP,"Rupture",1111,0,clrGreen); 
   if(ticket<0) 
     { 
      Print("BuyStop завершилась с ошибкой #",GetLastError()); 
          } 
   else 
      Print("Функция BuyStop успешно выполнена"); 
      
    }
    

 
Artem wrote the indicator and the Expert Advisor himself. Create with MQL4 Wizard an Expert Advisor(template), custom indicator, script, library, include file(mqh), new class? Include files (#include)?
 
Oleg Kolesov:
Artem wrote the indicator and the Expert Advisor himself. Create with MQL4 Wizard an Expert Advisor(template), custom indicator, script, library, include file(mqh), new class? Include files (#include)?

If you wrote it yourself, you have the source code of the Expert Advisor - insert the indicator as a resource into it.

 
Doszhan:

Hi, I want to write an EA that will place a pending order at every tick. But it will put BuyStop on the first tick and will not put it next. I have an error 130. What is the problem? Please help me.


  1. The order setting price is not normalised.
  2. All prices should be checked against the StopLevel - if the order distance in points from the price is less than the StopLevel value, then there will be an error 130 - wrong stops
Какие проверки должен пройти торговый робот перед публикацией в Маркете
Какие проверки должен пройти торговый робот перед публикацией в Маркете
  • www.mql5.com
Все продукты Маркета перед публикацией проходят обязательную предварительную проверку, так как небольшая ошибка в логике советника или индикатора может привести к убыткам на торговом счете. Именно поэтому нами разработана серия базовых проверок, призванных обеспечить необходимый уровень качества продуктов Маркета. Если в процессе проверки...
Reason: