Ayuda a la codificación - página 202

 

No se puede mover la salida de texto en el gráfico sin errores?

La salida de texto de información de rango actual está cubierta por velas de precios. Mis habilidades de codificación son inadecuadas y cada intento termina en errores. Sólo estoy tratando de mover la salida de texto en el gráfico como se ilustra. ¿Puede alguien ayudarme? Muchas gracias de antemano!!!ant-gubreakout.mq4

Archivos adjuntos:
 
daytrade5:
La salida de texto de información de rango actual está cubierta por velas de precio. Mis habilidades de codificación son inadecuadas y cada intento termina en errores. Sólo estoy tratando de mover la salida de texto en el gráfico como se ilustra. ¿Puede alguien ayudarme? Muchas gracias de antemano!!!ant-gubreakout.mq4

daytrade5

Al utilizar metatrader 4 no podemos elegir el ancla para los objetos de tipo texto (metatrader 4 siempre utiliza un ancla fija para este tipo de objetos que no podemos cambiar). Adjuntamos una versión que modifica la posición del texto (usamos TEXT_OFFSET para ello) pero a veces tendremos que cambiar su valor y la alineación no es 100% perfecta

Archivos adjuntos:
 
mladen:
daytrade5 Al utilizar metatrader 4 no podemos elegir el ancla para los objetos de tipo texto (metatrader 4 siempre utiliza un ancla fija para este tipo de objetos que no podemos cambiar). Adjuntamos una versión que modifica la posición del texto (usamos TEXT_OFFSET para ello) pero a veces hay que cambiar su valor y la alineación no es 100% perfecta

OK....muchas gracias. Nunca me hubiera dado cuenta de eso.

 

Buen amarre, por favor ayuda con esta alerta de orden mq4 - cuando una orden se cierra enviará una alerta pero ahora envía para cada símbolo por gráfico abierto en el perfil en lugar de sólo el símbolo relevante actuado.

Saludos cordiales,

Archivos adjuntos:
 
zigflip:
Buen amarre, por favor ayuda con esta alerta de orden mq4 - cuando una orden se cierra enviará una alerta pero ahora envía para cada símbolo por gráfico abierto en el perfil en lugar de sólo el símbolo relevante actuado. saludos cordiales,

zigflip

Pruébalo ahora

Archivos adjuntos:
 

no sé cómo obtener los valores de 4 cci

hola

tengo otra pregunta, el primer problema lo tengo resuelto. gracias por esto mladen

he encontrado el 4 cci aquí por mladen y me gusta mucho, sé que repinta pero todavía funciona muy consiguió para mí.

estoy intentando meter los 4 valores en otro indicador hecho por mi mismo pero no encuentro como.

he probado la línea bool de la página anterior con los valores del 4cci pero no me ha funcionado.

Supongo que hay una solución fácil para los códigos experimentados, pero ya he pasado mucho tiempo y no puedo averiguarlo.

gracias por el consejo

Bob

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

#property copyright "mladen"

#enlace de la propiedad "www.forex-tsd.cm"

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

#property indicador_separar_ventana

#property indicator_buffers 8

#property indicator_color1 LimeGreen

#property indicator_color2 PaleVioletRed

#propiedad indicator_color3 LimeGreen

#propiedad indicator_color4 PaleVioletRed

#Indicador de propiedad_color5 LimaVerde

#Indicador de propiedad_color6 PaleVioletRed

#Indicador de propiedad_color7 LimaVerde

#propiedad indicator_color8 PaleVioletRed

#propiedad indicador_mínimo 0

#propiedad indicador_máximo 5

//

//

//

//

//

extern string TimeFrame1 = "Marco temporal actual";

extern string TimeFrame2 = "next1";

extern string TimeFrame3 = "next2";

extern string TimeFrame4 = "next3";

extern int Period_CCI = 24;

extern string UniqueID = "4 Time CCI Slopes";

extern int LinesWidth = 0;

extern color LabelsColor = DarkGray;

extern int LabelsHorizontalShift = 5

extern double LabelsVerticalShift = 1,5;

extern bool alertsOn = false

extern int alertsLevel = 3;

extern bool alertsMessage = FALSE;

extern bool alertsSound = false

extern bool alertsEmail = false;

//

//

//

//

//

double gosc1u[];

double gosc1d[];

double gosc2u[]

double gosc2d[];

doble gosc3u[]

doble gosc3d[];

doble gosc4u[];

double gosc4d[];

int timeFrames[4];

bool returnBars;

string indicatorFileName;

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

//

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

//

//

//

//

//

int init()

{

SetIndexBuffer(0,gosc1u);

SetIndexBuffer(1,gosc1d);

SetIndexBuffer(2,gosc2u);

SetIndexBuffer(3,gosc2d);

SetIndexBuffer(4,gosc3u);

SetIndexBuffer(5,gosc3d);

SetIndexBuffer(6,gosc4u);

SetIndexBuffer(7,gosc4d);

indicatorFileName = WindowExpertName();

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

//

//

//

//

//

for (int i=0; i<8; i++)

{

SetIndexStyle(i,DRAW_ARROW,EMPTY,LinesWidth); SetIndexArrow(i,110);

}

timeFrames[0] = stringToTimeFrame(TimeFrame1);

timeFrames[1] = stringToTimeFrame(TimeFrame2);

timeFrames[2] = stringToTimeFrame(TimeFrame3);

timeFrames[3] = stringToTimeFrame(TimeFrame4);

alertsLevel = MathMin(MathMax(alertsLevel,3),4);

IndicatorShortName(UniqueID);

return(0);

}

int deinit()

{

for (int t=0; t<4; t++) ObjectDelete(UniqueID+t);

return(0);

}

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

//

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

//

//

//

//

//

double trend[][6];

#define _up 0

#define _dn 1

#define _hl1 2

#define _hl2 3

#define _hl3 4

#define _hl4 5

int inicio()

{

int i,r,count,counted_bars=IndicatorCounted();

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

if(barras_contadas>0) barras_contadas--;

int límite = MathMin(Bares-barras contadas,Bares-1);

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

if (timeFrames[0] != Period()) limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrames[0],indicatorFileName, "returnBars",0,0)*timeFrames[0]/Period()));

if (timeFrames[1] != Period()) limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrames[1],indicatorFileName, "returnBars",0,0)*timeFrames[1]/Period()));

if (timeFrames[2] != Period()) limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrames[2],indicatorFileName, "returnBars",0,0)*timeFrames[2]/Period()));

if (timeFrames[3] != Period()) limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrames[3],indicatorFileName, "returnBars",0,0)*timeFrames[3]/Period());

if (ArrayRange(trend,0)!=Bars) ArrayResize(trend,Bars);

//

//

//

//

//

bool initialized = false;

if (!initialized)

{

initialized = true;

int window = WindowFind(UniqueID);

for (int t=0; t<4; t++)

{

string label = timeFrameToString(timeFrames[t]);

ObjectCreate(UniqueID+t,OBJ_TEXT,window,0,0);

ObjectSet(UniqueID+t,OBJPROP_COLOR,LabelsColor);

ObjectSet(UniqueID+t,OBJPROP_PRICE1,t+LabelsVerticalShift);

ObjectSetText(UniqueID+t,label,8, "Arial");

}

}

for (t=0; t<4; t++) ObjectSet(UniqueID+t,OBJPROP_TIME1,Time[0]+Period()*LabelsHorizontalShift*60);

//

//

//

//

//

for(i = límite, r=Barras-i-1; i >= 0; i--,r++)

{

trend[r][_up] = 0

trend[r][_dn] = 0;

trend[r][_hl1] = trend[r-1][_hl1];

trend[r][_hl2] = trend[r-1][_hl2];

trend[r][_hl3] = trend[r-1][_hl3];

trend[r][_hl4] = trend[r-1][_hl4];

for (int k=0; k<4; k++)

{

int y = iBarShift(NULL,timeFrames[k],Time);

double cciNow = iCCI(NULL, timeFrames[k], Period_CCI, PRICE_TYPICAL, y);

double cciPre = iCCI(NULL, timeFrames[k], Period_CCI, PRICE_TYPICAL, y+1);

si (cciNow>cciPre) trend[r][k+2] = 1;

si (cciNow<cciPre) trend[r][k+2] = -1;

switch (k)

{

caso 0 : si (trend[r][k+2]==1) { gosc1u = k+1; gosc1d = EMPTY_VALUE;} si no { gosc1d = k+1; gosc1u = EMPTY_VALUE; } break;

caso 1 : if (trend[r][k+2]==1) { gosc2u = k+1; gosc2d = EMPTY_VALUE;} else { gosc2d = k+1; gosc2u = EMPTY_VALUE; } break

caso 2 : if (trend[r][k+2]==1) { gosc3u = k+1; gosc3d = EMPTY_VALUE;} else { gosc3d = k+1; gosc3u = EMPTY_VALUE; } break

caso 3 : if (trend[r][k+2]==1) { gosc4u = k+1; gosc4d = EMPTY_VALUE;} else { gosc4d = k+1; gosc4u = EMPTY_VALUE; } break;

}

if (trend[r][k+2]==1)

trend[r][_up] += 1;

si no, trend[r][_dn] += 1;

}

}

manageAlerts();

return(0);

}

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

//|

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

//

//

//

//

//

void manageAlerts()

{

si (alertsOn)

{

int whichBar = Bars-1;

if (trend[whichBar][_up] >= alertsLevel || trend[whichBar][_dn] >= alertsLevel)

{

si (trend[whichBar][_up] >= alertsLevel) doAlert("up" ,trend[whichBar][_up]);

si (trend[whichBar][_dn] >= alertsLevel) doAlert("down",trend[whichBar][_dn]);

}

}

}

//

//

//

//

//

void doAlert(string doWhat, int howMany)

{

static string previousAlert="nada";

static datetime previousTime;

mensaje de cadena;

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

previousAlert = doWhat;

previousTime = Time[0];

//

//

//

//

//

message = Symbol()+" en "+TimeToStr(TimeLocal(),TIME_SECONDS)+" "+howMany+" marcos de tiempo de las tendencias MA están alineados "+doWhat;

if (alertsMessage) Alert(message);

if (alertsEmail) SendMail(Symbol()+" 4 time frame MA trends",message);

if (alertsSound) PlaySound("alert2.wav");

}

}

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

//

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

//

//

//

//

//

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

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

//

//

//

//

//

int toInt(double value) { return(value); }

int stringToTimeFrame(string tfs)

{

tfs = stringUpperCase(tfs);

int max = ArraySize(iTfTable)-1, add=0;

int nxt = (StringFind(tfs, "NEXT1")>-1); if (nxt>0) { tfs = ""+Period(); add=1; }

nxt = (StringFind(tfs, "NEXT2")>-1); if (nxt>0) { tfs = ""+Period(); add=2; }

nxt = (StringFind(tfs, "NEXT3")>-1); if (nxt>0) { tfs = ""+Period(); add=3; }

//

//

//

//

//

for (int i=max; i>=0; i--)

if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable[toInt(MathMin(max,i+add))],Period());

return(Period());

}

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--)

{

int 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);

}
 
BobMorane1000:
Hola,

tengo otra pregunta, el primer problema lo tengo resuelto. gracias por esto mladen

he encontrado el 4 cci aquí por mladen y me gusta mucho, sé que repinta pero todavía funciona muy consiguió para mí.

estoy intentando meter los 4 valores en otro indicador hecho por mi mismo pero no encuentro como.

he probado la línea bool de la página anterior con los valores del 4cci pero no me ha funcionado.

Supongo que hay una solución fácil para los códigos experimentados, pero ya he pasado mucho tiempo y no puedo averiguarlo.

gracias por el consejo

Bob

BobMorane1000

¿Por qué no usas simplemente la llamada iCCI( ) en lugar de 4 veces (será mucho más simple incluso en cuanto a código)?

 

Tienes razón, lo haré.

Gracias de nuevo

 

por favor, alguien puede ayudarme a añadir flechas en la cruz de este estocástico

Archivos adjuntos:
 

[ATTACH]187655

Hola necesito ayuda:

Tengo un buen Trendindicatoe que está coloreando las velas verde y leer para la tendencia. Pero tiene un error: no es capaz de hacer que los colores permanezcan igual al cambiar el marco de tiempo. Pero peor es el hecho de que las pelucas apenas se ven y no puedo cambiar esto.

¿Podría alguien echarle un vistazo, por favor?

Muchas gracias. Adjunto el indicador

Archivos adjuntos:
t3_thv.ex4  5 kb