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
//+----------------------------------------------------------------------------+ 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.
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
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
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.
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.
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.
Alex, ¿estás aquí por mí? Soy nuevo en mql4. Estoy tratando de entender este código.
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
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.