Ayuda a la codificación - página 288

 

Hola,

En primer lugar una disculpa si esto está en el lugar equivocado, es un pivote indi estoy mirando, pero mi pregunta es en relación con la codificación, podría haber puesto en MTF, así, pero pensé que era el mejor lugar para empezar.

En MT4 tenemos diario, semanal, mensual = W1, D1, MN1

pero hay una función de año, o una función de trimestre.

Así, por ejemplo, en el indicador de pivote adjunto cómo se obtiene 1 año, y es (o se puede elegir) un rollo de 12 meses o un ejemplo fijo prev año 2013. Y lo mismo para como consigo que calcule pivotes trimestrales.

Cualquier orientación sería apreciada, adjunto es un pivote mensual indi. estoy razonablemente seguro de que puedo modificar el adjunto, pero no sé cómo empezar a conseguir los datos en él para hacer que la salida trimestral o anual.

allpivots_monthly.mq4

Muchas gracias

Kevin

Archivos adjuntos:
 
mladen:
Lo cambiaste para usar "#pollan indy" no tengo ni idea de lo que hace ese indicador (si es como el resto de indicadores "pollan" entonces se repinta y eso puede causar tus problemas, pero solo estoy haciendo el juego de las adivinanzas ahora)

Estimado señor MLADEN...

¿Podría reemplazar esto (#pollan indy) con cualquier otro indicador que usted tiene ... puede ser llamada #VQ bares.... POR FAVOR, inténtelo.... porque tengo una lectura en el búfer del indicador como imagen adjunta... pero no pude llamar a través de iCustom en mi EA para probar más este '#pollan indy"...

Espero volver a saber de ti pronto... GRACIAS

Atentamente

AZRUL

Archivos adjuntos:
my_vq.jpg  48 kb
 
12BPRO:
Estimado señor MLADEN...

Podría reemplazar esto (#pollan indy) con cualquier otro indicador que tiene... puede ser llamada #VQ bares.... POR FAVOR, inténtelo.... porque tengo una lectura en el búfer del indicador como imagen adjunta... pero no pude llamar a través de iCustom en mi EA para seguir probando este '#pollan indy"...

Espero volver a saber de ti pronto... GRACIAS

Atentamente

AZRUL

No es necesario sustituir #VQ por #VQ (ya está calculando la calidad de la volatilidad)

Si funciona como debería con el #VQ normal la única conclusión lógica es que hay algo mal con "#pollan indy"

 

Ayuda a la codificación

Buenos días a todos

Hola mladen

Estoy intentando crear mis primeros códigos.

Aprender de otros códigos, ya que no hay manual de MT4 en mi idioma.

Ruego no se rían de mi código.

Por favor, puede ayudarme a que funcione.

Es un simple indicador que marca la creación de un Doji.

Les ruego que me ayuden.

Muchas gracias de antemano.

Saludos cordiales.

Hermo.

PD. Compila bien pero no funciona.

Archivos adjuntos:
 
Hermo:
Buenos días a todos

Hola mladen

Estoy intentando crear mis primeros códigos.

Aprender de otros códigos, ya que no hay manual MT4 en mi idioma.

Ruego no reírse de mi código.

Por favor, puede ayudarme a que funcione.

Es un simple indicador que marca la creación de un Doji.

Les ruego que me ayuden.

Muchas gracias de antemano.

Un saludo.

Hermo.

PD. Compila bien pero no funciona.

Hermo

Lo comprobaré

Esperando la conferencia de prensa del BCE ahora :):)

 
12BPRO:
Estimado señor MLADEN...

Es por eso que en primer lugar no he publicado mi #VQ.... puede ser que usted tiene razón acerca de que hay algo mal acerca de la "pollan indy" y SÍ repinta....

Para mí, me gustaría probar mi teoría, con este indicador sólo para ver cuál es el resultado....

La cosa es que no pude llamar al buffer del indicador en mi EA... puede ser causado por la versión modificada de mi #VQ que está bloqueando la llamada iCustom a mi EA....

Con el #VQ original funciona bien... y pude ejecutar mi EA.... pero con el #VQ modificado (el mío), no pude exceder pero todavía hay un valor como se muestra en el hilo anterior..

Creo que el problema es con mi versión MODIFICADA #VQ.... puede ser tan error de sintaxis... POR FAVOR si tienes tiempo echa un vistazo y mira si funciona como debería.....

GRACIAS... y perdón por cualquier entrada negativa.....

su servidor...

AZRUL

AZRUL

Sencillamente no puedo saber que pasa con tu "pollan indy" sin ver el código

Todo lo que puedo hacer es adivinar, y adivinar en la codificación es muy, muy malo

todo lo mejor

 
mladen:
No hace falta sustituir #VQ por #VQ (ya está calculando la calidad de la volatilidad) Si funciona como debería con el #VQ normal la única conclusión lógica es que hay algo que falla en "#pollan indy"

Estimado señor MLADEN...

Es por eso que en primer lugar no he publicado mi #VQ.... puede ser que usted tiene razón acerca de que hay algo mal acerca de la "pollan indy" y SÍ repinta....

Para mí, me gustaría probar mi teoría, con este indicador sólo para ver cuál es el resultado....

La cosa es que no pude llamar al buffer del indicador en mi EA... puede ser causado por la versión modificada de mi #VQ que está bloqueando la llamada iCustom a mi EA....

Con el #VQ original funciona bien... y pude ejecutar mi EA.... pero con el #VQ modificado (el mío), no pude exceder pero todavía hay un valor como se muestra en el hilo anterior..

Creo que el problema es con mi versión MODIFICADA de #VQ.... puede ser algún error de sintaxis... POR FAVOR si tienen tiempo echen un vistazo y vean si funciona como debe..... solo para el APRENDIZAJE....

GRACIAS... TENGO ESE EA CORRIENDO AHORA Y PROBANDO SI USTED ESTÁ INTERESADO EN AVERIGUAR EL RESULTADO VOY A PUBLICAR EN EL HILO POLLAN.....

un saludo...

AZRUL

 
mladen:
AZRUL

Simplemente no puedo saber qué está pasando con tu "pollan indy" sin ver el código

Todo lo que puedo hacer es adivinar, y adivinar en la codificación es muy, muy malo

todo lo mejor

TENGO ESE EA FUNCIONANDO AHORA Y PROBANDO SI TE INTERESA SABER EL RESULTADO LO PUBLICARÉ EN EL HILO DE POLLAN.....

ERA MI VERSIÓN DEL #VQ QUE NO FUNCIONABA...

GRACIAS...

un saludo...

AZRUL

 

Hola CODESGURUS,

Tengo una pregunta general sobre multi time frame.... como adjunto

la primera imagen de la izquierda es un indicador RSI en un marco de tiempo de 5M...

En la segunda es el RSI multi time frame del 5M en el timeframe de 15M...

La pregunta es por qué hay una diferencia en el valor como se indica en el círculo rojo....

¿Puede alguien por favor explicar y rectificar este RsiMA-MTF códigos........

#property indicator_separate_window

#property indicator_buffers 6

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_color3 Aqua

#indicador de propiedad_color4 Amarillo

#Indicador de propiedad_color5 Blanco

#Indicador de propiedad_color6 Magenta

#Propiedad indicator_width1 1

#Propiedad indicator_width2 1

#propiedad indicator_width3 1

#Propiedad indicator_width4 1

#propiedad indicator_width5 1

#propiedad ancho_indicador6 1

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

//-----

//extern string TimeFrames = "M15; M60";

extern bool TimeFrame1bool = true;

extern int TimeFrame1 = 0;

extern bool TimeFrame2bool = False;

extern int TimeFrame2 = 0;

extern bool TimeFrame3bool = False

extern int TimeFrame3 = 0;

//int period[]={1,5,15,30,60,240,1440,43200};

//string periodString[]={"M1","M5","M15","M30","H1","H4","D1",MN1"};

// crear una matriz más con los nombres de los indicadores

//string signalNameString[]={"MA"};

int ExtCountedBars=0;

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

int TF;

//---- buffers

double ExtMapBuffer1[];

double ExtMapBuffer2[];

double ExtMapBuffer3[];

double ExtMapBuffer4[];

doble ExtMapBuffer5[];

double ExtMapBuffer6[];

//-------

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

int init()

{

SetIndexBuffer(0, ExtMapBuffer1);

SetIndexBuffer(1, ExtMapBuffer2);

SetIndexBuffer(2, ExtMapBuffer3);

SetIndexBuffer(3, ExtMapBuffer4);

SetIndexBuffer(4, ExtMapBuffer5);

SetIndexBuffer(5, ExtMapBuffer6);

//-----

SetIndexStyle(0, DRAW_LINE);

SetIndexStyle(1, DRAW_LINE);

SetIndexStyle(2, DRAW_LINE);

SetIndexStyle(3, DRAW_LINE);

SetIndexStyle(4, DRAW_LINE);

SetIndexStyle(5, DRAW_LINE);

// SetIndexStyle(0,DRAW_LINE,EMPTY,1);

// SetIndexBuffer(0,ExtMapBuffer1);

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

int M1 = PERIOD_M1;

int M5 = PERIOD_M5;

int M15 = PERIOD_M15;

int M30 = PERIOD_M30;

int H1 = PERIOD_H1;

int H4 = PERIOD_H4;

int D1 = PERIOD_D1;

int WK1 = PERIOD_W1;

int MN1 = PERIOD_M1;

TF=Período();

if (TF==PERIOD_M1) { TimeFrame1 = M1; TimeFrame2 = M1; TimeFrame3 = M1;}

else if (TF==PERIOD_M5) { TimeFrame1 = M1; TimeFrame2 = M5; TimeFrame3 = M15;}

else if (TF==PERIOD_M15) { TimeFrame1 = M5; TimeFrame2 = M15; TimeFrame3 = H1; }

else if (TF==PERIOD_M30) { TimeFrame1 = M5; TimeFrame2 = M15; TimeFrame3 = H1; }

else if (TF==PERIOD_H1) { TimeFrame1 = M15; TimeFrame2 = H1; TimeFrame3 = H4; }

else if (TF==PERIOD_H4) { TimeFrame1 = H4; TimeFrame2 = H4; TimeFrame3 = D1; }

else if (TF==PERIOD_D1) { TimeFrame1 = H4; TimeFrame2 = D1; TimeFrame3 = WK1;}

else if (TF==PERIOD_W1) { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}

else if (TF==PERIOD_MN1) { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}

else { TimeFrame1 = D1; TimeFrame2 = WK1; TimeFrame3 = MN1;}

//-----

return(0);

}

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

int inicio()

{

datetime TimeArray1[];

datetime TimeArray2[];

datetime TimeArray3[];

int límite, i,y=0;

// int counted_bars = IndicatorCounted();

ExtCountedBars=IndicatorCounted();

if(ExtCountedBars < 0) return(-1);

if(ExtCountedBars > 0) ExtCountedBars--;

limit = Bares - ExtCountedBars;

//-----

ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),TimeFrame1);

ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TimeFrame2);

ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TimeFrame3);

for(i=0,y=0;i<limit;i++)

{

if(TimeFrame1bool)

{

if (Time<TimeArray1[y]) y++;

{

//ExtMapBuffer1

ExtMapBuffer1 = iCustom(NULL,TimeFrame1 , "#RSI-MA",0, y);

ExtMapBuffer2 = iCustom(NULL,TimeFrame1 , "#RSI-MA",3, y);

}

}

//-----

if(TimeFrame2bool)

{

if (Time<TimeArray2[y]) y++;

{

//ExtMapBuffer1

ExtMapBuffer3 = iCustom(NULL,TimeFrame2 , "#RSI-MA",0,y);

ExtMapBuffer4 = iCustom(NULL,TimeFrame2 , "#RSI-MA",3,y);

}

}

//-----

if(TimeFrame3bool)

{

if (Time<TimeArray3[y]) y++;

{

//ExtMapBuffer1

ExtMapBuffer5 = iCustom(NULL,TimeFrame3 , "#RSI-MA",0, y);

ExtMapBuffer6 = iCustom(NULL,TimeFrame3 , "#RSI-MA",3, y);

}

}

}

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

//=======================================================

return(0);

}

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

int deinit()

{

return(0);

}

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

Archivos adjuntos:
rsi-mtf_diff.jpg  290 kb
 

ESTA ES UNA COPIA DEL RSI-MA........

#property indicator_separate_window

#propiedad indicator_buffers 4

#propiedad indicador_color1 LimaVerde

#propiedad indicador_color2 Rojo

#propiedad indicador_color3 Amarillo

#property indicator_color4 Blanco ///Gris Oscuro

#property indicator_width1 3

#property indicator_width2 3

#property indicator_width3 3

#property indicator_width4 1

#propiedad indicator_levelcolor Aqua

extern string TimeFrame = "Marco temporal actual";

extern int RsiOma_Period = 13;

extern int RsiOma_Price = 0;

extern int RsiOma_Mode = MODE_LWMA;

extern int MaPeriod = 8;

extern int MaType = MODE_LWMA;

extern double levelOb = 88

extern double levelOs = 13

extern int OB_RSI = 80

extern int OS_RSI = 15;

extern string note = "encender Alerta = true; apagar = false";

extern bool alertsOn = true; ///false

extern bool alertsOnCurrent = true

extern bool alertsMessage = true

extern bool alertsSound = true; ///false

extern bool alertsEmail = false;

extern string soundfile = "connect.wav"; ///"alert2.wav";

extern string SoundUp = "ok.wav";

extern string SoundDown = "stops.wav";

double rsi[];

double rsida[];

double rsidb[];

double ma[];

double mab[];

double trend[];

double slope[];

string indicatorFileName;

int Char, timeFrame;

bool returnBars;

bool calculateValue;

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

int init()

{

IndicatorBuffers(7);

SetIndexBuffer(0,rsi);

SetIndexBuffer(1,rsida);

SetIndexBuffer(2,rsidb);

SetIndexBuffer(3,ma);

SetIndexBuffer(4,mab);

SetIndexBuffer(5,trend);

SetIndexBuffer(6,slope);

SetLevelValue(0,levelOs);

SetLevelValue(1,levelOb);

indicatorFileName = WindowExpertName();

calculateValue = (TimeFrame=="calculateValue"); if (calculateValue) return(0);

returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0);

timeFrame = stringToTimeFrame(TimeFrame);

IndicatorShortName(timeFrameToString(timeFrame)+" Rsi-Ma MaxMin ("+RsiOma_Period+", "+MaPeriod+")";

SetIndexLabel(0, "RSI");

SetIndexLabel(1, "RSIDA");

SetIndexLabel(2, "RSIDB");

SetIndexLabel(3, "MA");

return(0);

}

int deinit() { return(0); }

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

int inicio()

{

int barras_contadas=IndicadorContado();

int i,limit;

if(counted_bars<0) return(-1);

if(barras_contadas>0) barras_contadas--;

limit = MathMin(Bares-contados_barras,Bares-1);

if (returnBars) { rsi[0] = limit+1; return(0); }

if (calculateValue || timeFrame==Period())

{

if (slope[limit] == -1) ClearPoint(limit,rsida,rsidb);

for (i=limit; i >= 0; i--) mab = iMA(NULL,0,RsiOma_Period,0,RsiOma_Mode,RsiOma_Price,i);

for (i=limit; i >= 0; i--) rsi = iRSIOnArray(mab,0,RsiOma_Period,i);

for (i=limit; i >= 0; i--)

{

ma = iMAOnArray(rsi,0,MaPeriod,0,MaType,i);

rsida = EMPTY_VALUE;

rsidb = EMPTY_VALUE;

slope = slope;

tendencia = tendencia;

si ((rsi > rsi) && (rsi > OB_RSI))

slope= 1;

si ((rsi < rsi) && (rsi < OS_RSI))

slope=-1;

si ((rsi > ma) && (rsi > OB_RSI))

tendencia= 1;

si ((rsi < ma) && (rsi < OS_RSI))

trend=-1;

si (pendiente == -1)

PlotPoint(i,rsida,rsidb,rsi);

}

manageAlerts();

return(0);

}

limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName, "returnBars",0,0)*timeFrame/Period()));

if (slope[limit]==-1) ClearPoint(limit,rsida,rsidb);

for (i=limit;i>=0; i--)

{

int y = iBarShift(NULL,timeFrame,Time);

rsi = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,0,y);

rsida = EMPTY_VALUE;

rsidb = EMPTY_VALUE;

ma = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,3,y);

trend = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,5,y);

slope = iCustom(NULL,timeFrame,indicatorFileName, "calculateValue",RsiOma_Period,RsiOma_Price,RsiOma_Mode,MaPeriod,MaType,6,y);

}

for (i=limit;i>=0;i--) if (slope==-1) PlotPoint(i,rsida,rsidb,rsi);

manageAlerts();

return(0);

}

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

string sTfTable[] = {"M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN"};

int iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

for (int i=ArraySize(iTfTable)-1; i>=0; i--)

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period());

return(Periodo());

}

string timeFrameToString(int tf)

{

for (int i=ArraySize(iTfTable)-1; i>=0; i--)

if (tf==iTfTable) return(sTfTable);

return("");

}

stringUpperCase(string str)

{

string s = str;

for (int length=StringLen(str)-1; length>=0; length--)

{

Char = StringGetChar(s, longitud);

if((Char > 96 && Char 223 && Char < 256))

s = StringSetChar(s, length, Char - 32);

else if(Char > -33 && Char < 0)

s = StringSetChar(s, length, Char + 224);

}

return(s);

}

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

void ClearPoint(int,double& first[],double& second[])

{

if ((second != EMPTY_VALUE) && (second != EMPTY_VALUE))

second = EMPTY_VALUE;

si no

if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))

first = EMPTY_VALUE;

}

void PlotPoint(int,double& first[],double& second[],double& from[])

{

if (first == EMPTY_VALUE)

{

if (first == EMPTY_VALUE)

{

first = from;

first = from;

segundo = EMPTY_VALUE;

}

si no

{

second = from;

second = from;

first = EMPTY_VALUE;

}

}

else

{

first = from;

segundo = EMPTY_VALUE;

}

}

void manageAlerts()

{

if (!calculateValue && alertsOn)

{

if (alertsOnCurrent)

int whichBar = 0;

else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));

if (trend[whichBar] != trend[whichBar+1])

{

if (trend[whichBar] == 1)

//doAlert(whichBar, "trend");

doAlerts( whichBar, "UP RSI-MA "+Symbol()+" (tf: "+Period()+")",SoundUp);

if (trend[whichBar] ==-1)

//doAlert(whichBar, "no trend");

doAlerts( whichBar, "DOWN RSI-MA "+Symbol()+" (tf: "+Period()+")",SoundDown);

}

}

}

void doAlerts(int forBar, string doWhat, string SoundFile) {

static string previousAlert="nada";

static datetime previousTime;

string mensaje;

if (previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" rsioma ",doWhat);

if (alertsMessage) Alert(message);

if (alertsSound) PlaySound(SoundFile);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," rsioma "),message);

}

}

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

void doAlert(int forBar, string doWhat)

{

static string previousAlert="nada";

static datetime previousTime;

string mensaje;

if (previousAlert != doWhat || previousTime != Time[forBar]) {

previousAlert = doWhat;

previousTime = Time[forBar];

message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," - ",timeFrameToString(timeFrame)+" rsioma ",doWhat);

if (alertsMessage) Alert(message);

if (alertsEmail) SendMail(StringConcatenate(Symbol()," rsioma "),message);

if (alertsSound) PlaySound(soundfile);

}

}

GRACIAS TODO.....

saludos cordiales

AZRUL..........

PS ... ¿cómo puedo adjuntar estos archivos de código en aquí..... Perdón por el desorden....

Razón de la queja: