[ARCHIVO]Cualquier pregunta de novato, para no saturar el foro. Profesionales, no lo dejéis pasar. No puedo ir a ningún sitio sin ti - 5. - página 308

[Eliminado]  
¿Cómo puedo ejecutar el script que acabo de editar sin reiniciar mt4?
[Eliminado]  
Lo estoy intentando pero no funciona, me da muchos errores en el código((.
[Eliminado]  
¿Quieres compartir algo? )
[Eliminado]  

Podría ser útil. Esto funciona bien.

En el meta-editor, pulse F5 para compilar.

Importante: El meta editor debe ser ejecutado desde la misma carpeta que el terminal.

[Eliminado]  

Alex, ¿estás aquí por mí? Soy nuevo en mql4. Estoy tratando de entender este código.



#propiedad ventana_del_gráfica_del_indicador
#property indicator_buffers 2
extern int TimeFrame=0;//Si=0, entonces el actual
extern int Distanse=0;//distancia de la línea del fractal en puntos
extern string FrApNam="Ap";//nombre de la línea correspondiente al fractal hacia arriba.
extern string FrDnNam="Dn";//nombre de la línea según el fractal hacia abajo.
extern color ClAp=Azul;//la línea de color corresponde a Fractal hacia arriba.
extern color ClDn=Red;//color de la línea según Fractal Down.
extern bool comment=true;//permiso para comentar
//-----------------------------------------------------------------------------+
doble FrPrise,znach1,znach2;
doble FrApPrise=0,FrDnPrise=0;
doble ind_buffer1[];
doble ind_buffer2[];
//+----------------------------------------------------------------------------+
void init()
{if(TimeFrame==0){TimeFrame=Period();}
SetIndexBuffer(0,ind_buffer1);//Buffer

SetIndexBuffer(1,ind_buffer2);
return;}
void deinit(){

return;}


//+----------------------------------------------------------------------------+
int inicio()
{
int barras_contadas=IndicadorContado();
int límite;
doble tmp;
int i, j,k;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Barras_contabilizadas;
//-----------------------------------------------------------------------------+
LineAp();
LineDn();
double FAP=NormalizarDoble((FrApPrise-Distanse*Punto),5);//Normalizar
double FDP=NormalizeDouble((FrDnPrise+Distanse*Point),5);
int diap=MathRound((FrApPrise-FrDnPrise)/Punto);
ind_buffer1[0]=FAP;
ind_buffer2[1]=FDP;
Comentario("TimeFrame="+TimeFrame+
"\nApPrise =",FAP,
"\N -Prise =",FDP,
"Canal nFractal ="
,diap+"Punto");



return(0);
}
//-----------------------------------------------------------------------------+
// busca una línea horizontal por nombre, la redibuja si el precio cambia |
//-----------------------------------------------------------------------------+
void LineDn(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_LOWER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise-Distancia*Punto,MarketInfo(Symbol(),MODE_DIGITS));
//Comentario(FrPrise);
if(ObjectFind(FrDnNam)==0){
if(ObjectGet(FrDnNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrDnPrise=FrPrise;
ObjectDelete(FrDnNam);
SetHLine(ClDn,FrDnNam,FrDnPrise,0,1);
WindowRedraw();
return;}
//-----------------------------------------------------------------------------+
// busca una línea horizontal por nombre, redibuja si el precio ha cambiado |
//-----------------------------------------------------------------------------+
void LineAp(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_UPPER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise+Distanse*Point,MarketInfo(Symbol(),MODE_DIGITS));
if(ObjectFind(FrApNam)==0){
if(ObjectGet(FrApNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrApPrise=FrPrise;
ObjectDelete(FrApNam);
SetHLine(ClAp,FrApNam,FrApPrise,0,1);
WindowRedraw();
return;}
//-----------------------------------------------------------------------------+
//| Descripción : Buscar el fractal más cercano. Devuelve un nivel de precios. |
//+----------------------------------------------------------------------------+
//| Parámetros: |
//| sy - nombre del instrumento ("" o NULL - símbolo actual) |
//| tf - timeframe ( 0 - TF actual) ||
//| modo - tipo de fractal (MODE_LOWER|MODE_UPPER) ||
//+----------------------------------------------------------------------------+
double FindNearFractal(string sy="0", int tf=0, int mode=MODE_LOWER) {
if (sy=="" | sy=="0") sy=Símbolo();
doble f=0;
int d=MarketInfo(sy, MODE_DIGITS), s;
if (d==0) if (StringFind(sy, "JPY"<0) d=4; else d=2;

for (s=2; s<100; s++) {
f=iFractales(sy, tf, mode, s);
if (f!=0) return(NormalizeDouble(f, d))
}
Print("FindNearFractal(): Fractal no encontrado");
return(0);
}

//+----------------------------------------------------------------------------+
//| Descripción : Establecer objeto OBJ_HLINE línea horizontal |
//+----------------------------------------------------------------------------+
//| Parámetros: |
//| cl - color de la línea |
//| nm - nombre ("" - hora de apertura de la barra actual) |
//| p1 - nivel de precios (0 - Oferta) |
//| st - estilo de línea (0 - línea simple) ||
//| wd - ancho de línea (0 - por defecto) ||
//+----------------------------------------------------------------------------+
void SetHLine(color cl, cadena nm="", double p1=0, int st=0, int wd=1) {
if (nm=="") nm=DoubleToStr(Time[0], 0);
if (p1<=0) p1=Bid;
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_HLINE, 0, 0,0;)
ObjectSet(nm, OBJPROP_PRICE1, p1);
ObjectSet(nm, OBJPROP_COLOR , cl);
ObjectSet(nm, OBJPROP_STYLE , st);
ObjectSet(nm, OBJPROP_WIDTH , wd);
}

Es necesario escribir un Asesor Experto para este indicador que pasaría el precio superior y el precio inferior en М1 y М5 marcos de tiempo.

 
palomnik:

Alex, ¿estás aquí por mí? Soy nuevo en mql4. Estoy tratando de entender este código.

#property indicator_chart_window
#property indicator_buffers 2 
extern int TimeFrame=0;//Если=0, то текуший
extern int Distanse=0;//Дистанция линии от фрактала в пунктах
extern string FrApNam="Ap";//Имя линии соотв.Фракталу вверх
extern string FrDnNam="Dn";//Имя линии соотв.Фракталу вниз
extern color ClAp=Blue;//Цвет линии соотв.Фракталу вверх
extern color ClDn=Red;//Цвет линии соотв.Фракталу вниз
extern bool comment=true;//Разрещение на комментарий
//-----------------------------------------------------------------------------+
double FrPrise,znach1,znach2;
double FrApPrise=0,FrDnPrise=0;
double ind_buffer1[];
double ind_buffer2[];
//+----------------------------------------------------------------------------+
void init()
{if(TimeFrame==0){TimeFrame=Period();}
SetIndexBuffer(0,ind_buffer1);//КОРОБКА

SetIndexBuffer(1,ind_buffer2);
return;}
void deinit(){

return;}


//+----------------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
double tmp;
int i, j,k;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//-----------------------------------------------------------------------------+
LineAp();
LineDn();
double FAP=NormalizeDouble((FrApPrise-Distanse*Point),5);//ЗНАЧЕНИЕ
double FDP=NormalizeDouble((FrDnPrise+Distanse*Point),5);
int diap=MathRound((FrApPrise-FrDnPrise)/Point);
ind_buffer1[0]=FAP;
ind_buffer2[1]=FDP;
Comment("TimeFrame="+TimeFrame+
"\nApPrise =",FAP,
"\nDnPrise =",FDP,
"\nFractal Channel ="
,diap+"Point");



return(0);
}
//-----------------------------------------------------------------------------+
// Ищет горизонтальную линию по имени перерисовывает если изменилась цена | 
//-----------------------------------------------------------------------------+
void LineDn(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_LOWER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise-Distanse*Point,MarketInfo(Symbol(),MODE_DIGITS));
//Comment(FrPrise);
if(ObjectFind(FrDnNam)==0){
if(ObjectGet(FrDnNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrDnPrise=FrPrise; 
ObjectDelete(FrDnNam);
SetHLine(ClDn,FrDnNam,FrDnPrise,0,1);
WindowRedraw();
return;} 
//-----------------------------------------------------------------------------+
// Ищет горизонтальную линию по имени перерисовывает если изменилась цена | 
//-----------------------------------------------------------------------------+
void LineAp(){
FrPrise=NormalizeDouble(FindNearFractal(0,TimeFrame,MODE_UPPER),MarketInfo(Symbol(),MODE_DIGITS));
FrPrise=NormalizeDouble(FrPrise+Distanse*Point,MarketInfo(Symbol(),MODE_DIGITS));
if(ObjectFind(FrApNam)==0){
if(ObjectGet(FrApNam,OBJPROP_PRICE1)==FrPrise){return;}}
FrApPrise=FrPrise; 
ObjectDelete(FrApNam); 
SetHLine(ClAp,FrApNam,FrApPrise,0,1);
WindowRedraw();
return;}
//-----------------------------------------------------------------------------+ 
//| Описание : Поиск ближайшего фрактала. Возвращает ценовой уровень. |
//+----------------------------------------------------------------------------+
//| Параметры: |
//| sy - наименование инструмента ("" или NULL - текущий символ) |
//| tf - таймфрейм ( 0 - текущий ТФ) |
//| mode - тип фрактала (MODE_LOWER|MODE_UPPER) |
//+----------------------------------------------------------------------------+
double FindNearFractal(string sy="0", int tf=0, int mode=MODE_LOWER) {
if (sy=="" || sy=="0") sy=Symbol();
double f=0;
int d=MarketInfo(sy, MODE_DIGITS), s;
if (d==0) if (StringFind(sy, "JPY")<0) d=4; else d=2;

for (s=2; s<100; s++) {
f=iFractals(sy, tf, mode, s);
if (f!=0) return(NormalizeDouble(f, d));
}
Print("FindNearFractal(): Фрактал не найден");
return(0);
}

//+----------------------------------------------------------------------------+
//| Описание : Установка объекта OBJ_HLINE горизонтальная линия |
//+----------------------------------------------------------------------------+
//| Параметры: |
//| cl - цвет линии |
//| nm - наименование ("" - время открытия текущего бара) |
//| p1 - ценовой уровень (0 - Bid) |
//| st - стиль линии (0 - простая линия) |
//| wd - ширина линии (0 - по умолчанию) |
//+----------------------------------------------------------------------------+
void SetHLine(color cl, string nm="", double p1=0, int st=0, int wd=1) {
if (nm=="") nm=DoubleToStr(Time[0], 0);
if (p1<=0) p1=Bid;
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_HLINE, 0, 0,0);
ObjectSet(nm, OBJPROP_PRICE1, p1);
ObjectSet(nm, OBJPROP_COLOR , cl);
ObjectSet(nm, OBJPROP_STYLE , st);
ObjectSet(nm, OBJPROP_WIDTH , wd);
}



Надо к данному индикатору написать советник.Передающий верхнюю и нижнюю цены.по М1 и М5 таймфреймам. 

¿No sabes para qué sirve el src? Borra tus garabatos.
 
¿Cómo puedo implementar esta función en mi EA? Cuando se activa el TP o el SL en cualquier orden de bahía, todas las órdenes de bahía deben cerrarse.
[Eliminado]  
David no es una función es un pequeño Asesor Exper to, en pocas palabras es la comparación de cuántas órdenes fueron y cuántas órdenes se cierran en la muestra, voy a ayudar en los detalles tan pronto como me ocupo de la transferencia de datos del indicador al Asesor Experto, ya he dado por encima de ToR
[Eliminado]  
Nunca he oído hablar de ello, simplemente no lo entiendo. Realmente describí el problema, pero obtuve una especie de silencio ((. https://forum.mql4.com/ru/52892/page308 palomnik 23.04.2013 09:56
 
palomnik:
Señor, ¿alguien entiende cómo pasar valores de un indicador a un EA? Necesito ayuda, yo mismo no lo entiendo, sólo un momento y luego se acabó. https://forum.mql4.com/ru/52892/page308 palomnik 23.04.2013 09:56
Hay muchas formas de hacerlo:

1. A través de una variable global.

2. A través de un archivo.

3. A través de iCustom().

4. A través de las variables gráficas globales.

5. La cartografía. Puede transferir datos de un terminal a otro. O en un terminal para transferir datos de una ventana a otra ventana sin limitación de variables globales de MT4.