Tarasik, se mea en ti... Idiota. Mira el código que tenemos después de tus sugerencias... Se llama "enseñar a no hacerlo", y quien no lo entienda, es su culpa.
Y ahora nos ponemos personales y discutimos lo malo que es.
Alexey Viktorov:
Es de mala educación mentir tan descaradamente. Borras tu post y le echas la culpa de tu analfabetismo a otro. Mentiroso.
Tengo un indicador estocástico con allert, da una señal al cruzar las líneas móviles. Por favor, díganme cómo hacer que dé una señal cruzando en movimiento sólo cuando esté por encima o por debajo de la zona de sobrecompra y sobreventa.
Por favor, asesórese
#property indicator_separate_window#property indicator_buffers4#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_level180#property indicator_level220#property indicator_maximum100#property indicator_minimum0//---- input parameters/*************************************************************************
PERIOD_M1 1
PERIOD_M5 5
PERIOD_M15 15
PERIOD_M30 30
PERIOD_H1 60
PERIOD_H4 240
PERIOD_D1 1440
PERIOD_W1 10080
PERIOD_MN1 43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
MODE_SMA 0 Simple moving average,
MODE_EMA 1 Exponential moving average,
MODE_SMMA 2 Smoothed moving average,
MODE_LWMA 3 Linear weighted moving average.
You must use the numeric value of the MA Method that you want to use
when you set the 'ma_method' value with the indicator inputs.
**************************************************************************/externint TimeFrame=240;
externint KPeriod=5;
externint DPeriod=3;
externint Slowing=3;
externint MAMethod=0;
externint PriceField=0;// PriceField: 0=Hi/Low 1=Close/Closeexternstring note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN";
externstring __MA_Method = "SMA0 EMA1 SMMA2 LWMA3";
externstring __PriceField = "0=Hi/Low 1=Close/Close";
//extern string __Price = "0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6";double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
datetime last_t=0;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
//---- indicator lineSetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
SetIndexLabel(0, "MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+")TF"+TimeFrame+"");
SetIndexLabel(1,"MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+")TF"+TimeFrame+"");
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,233);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(3,DRAW_ARROW);
SetIndexArrow(3,234);
//---- name for DataWindow and indicator subwindow label switch(TimeFrame)
{
case1 : string TimeFrameStr="Period_M1"; break;
case5 : TimeFrameStr="Period_M5"; break;
case15 : TimeFrameStr="Period_M15"; break;
case30 : TimeFrameStr="Period_M30"; break;
case60 : TimeFrameStr="Period_H1"; break;
case240 : TimeFrameStr="Period_H4"; break;
case1440 : TimeFrameStr="Period_D1"; break;
case10080 : TimeFrameStr="Period_W1"; break;
case43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
IndicatorShortName("MTF_Stochastic("+KPeriod+","+DPeriod+","+Slowing+") "+TimeFrameStr);
start();
return(0);
}
//----//+------------------------------------------------------------------+//| MTF Stochastic |//+------------------------------------------------------------------+int deinit()
{
for (int i=Bars;i>=0;i--){
ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
}
return(0);
}
bool up_a=false;
bool dn_a=false;
int start()
{
datetime TimeArray[];
ArrayResize(TimeArray,Bars);
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined timeframe on to current timeframe
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
// limit=Bars-counted_bars+TimeFrame/Period(); //igorad
limit=Bars-1;
limit=MathMax(limit,TimeFrame/Period());
//limit=MathMin(limit,BarsToCount);for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
/***********************************************************
Add your main indicator loop below. You can reference an existing
indicator with its iName or iCustom.
Rule 1: Add extern inputs above for all neccesary values
Rule 2: Use 'TimeFrame' for the indicator timeframe
Rule 3: Use 'y' for the indicator's shift value
**********************************************************/
ExtMapBuffer3[i]=EMPTY_VALUE;
ExtMapBuffer4[i]=EMPTY_VALUE;
ExtMapBuffer1[i]=EMPTY_VALUE;
ExtMapBuffer2[i]=EMPTY_VALUE;
ExtMapBuffer1[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,y);
ExtMapBuffer2[i]=iStochastic(NULL,TimeFrame,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,y);
ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
if (NormalizeDouble(ExtMapBuffer1[i],Digits)>NormalizeDouble(ExtMapBuffer2[i],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)<=NormalizeDouble(ExtMapBuffer2[i+1],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)!=NormalizeDouble(ExtMapBuffer1[i],Digits) ){
ExtMapBuffer3[i]=ExtMapBuffer1[i];
ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
ObjectCreate("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),22,0,Time[i],Low[i]-5*Point);
ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),6,Blue);
ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),14,233);
}
if (NormalizeDouble(ExtMapBuffer1[i],Digits)<NormalizeDouble(ExtMapBuffer2[i],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)>=NormalizeDouble(ExtMapBuffer2[i+1],Digits) && NormalizeDouble(ExtMapBuffer1[i+1],Digits)!=NormalizeDouble(ExtMapBuffer1[i],Digits)){
ExtMapBuffer4[i]=ExtMapBuffer1[i];
ObjectDelete("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0));
ObjectCreate("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),22,0,Time[i],High[i]+5*Point);
ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),6,Red);
ObjectSet("st"+Symbol()+Period()+DoubleToStr(KPeriod+DPeriod+Slowing,0)+DoubleToStr(i,0),14,234);
}
}
////---- Refresh buffers ++++++++++++++ if (TimeFrame < Period()) TimeFrame = Period();
if (TimeFrame>Period()) {
int PerINT=TimeFrame/Period()+1;
datetime TimeArr[]; ArrayResize(TimeArr,PerINT);
ArrayCopySeries(TimeArr,MODE_TIME,Symbol(),Period());
for(i=0;i<PerINT+1;i++) {if (TimeArr[i]>=TimeArray[0]) {
/********************************************************
Refresh buffers: buffer[i] = buffer[0];
************************************************************/
ExtMapBuffer1[i]=ExtMapBuffer1[0];
ExtMapBuffer2[i]=ExtMapBuffer2[0];
} } }
//+++++++++++++++++++++++++++++++++++++++++++++++++++++ Raff if (ExtMapBuffer3[0]!=EMPTY_VALUE && !up_a){
up_a=true;
dn_a=false;
Alert("MTF Stochastic Long cross Signal on "+Symbol());
}
if (ExtMapBuffer4[0]!=EMPTY_VALUE && !dn_a){
dn_a=true;
up_a=false;
Alert("MTF Stochastic Short cross Signal on "+Symbol());
}
return(0);
}
Tengo un indicador estocástico con allert, da una señal al cruzar las líneas móviles. Por favor, díganme cómo hacer que dé una señal cruzando en movimiento sólo cuando esté por encima o por debajo de la zona de sobrecompra y sobreventa.
Por favor, avisa.
***
Por favor,inserte el códigocorrectamente: cuando edite una entrada, haga clic en e inserte su código en la ventana emergente.
Вы недавно зарегистрировались и у вас возникли вопросы: Как вставить картинку в сообщение на форуме, как красиво оформить исходный код MQL5, где находятся ваши Личные сообщения? В этой статье мы подготовили для вас несколько практических советов, которые помогут быстрее освоиться на сайте MQL5.community и позволят в полной мере воспользоваться доступными функциональными возможностями.
//| mymacd v2 12/11/05/////////////////////////////////////////////////////////////////////////////////////////////#property link"jpygbp@yahoo.com"#property indicator_buffers5#property indicator_separate_window#property indicator_color1 HotPink //macd#property indicator_color2 Lime //signal#property indicator_color3 Gray //histogram#property indicator_color4 Blue //macd[1]#property indicator_color5 Black //zero line//---- buffersdouble Buffer1[]; //macddouble Buffer2[]; //signaldouble Buffer3[]; //histogramdouble Buffer4[]; //macd[1]double Buffer5[]; //zero line//externint FastEMA = 9;
externint SlowEMA = 64;
externint SignalSMA = 112;
//extern bool plotMACD = true;//extern bool plotSignalLine = true;//extern bool plotHistogram = true;//extern bool plotMACDOneBarAgo = true;//extern bool plotZeroLine = true;externbool plotArrows = false;
externdouble HistThreshold = 0;
/////////////////////////////////////////////////////////////////////////////////////////////////int limit = 0;
int fontsize=10;
int i = 0;
bool InLTrade = false;
bool InSTrade = false;
/////////////////////////////////////////////////////////////////////////////////////////////int init()
{
ObjectsDeleteAll();
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);//macd
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);//signal
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);//hist
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);//macd[1]
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,1);//zero//SetIndexBuffer(0,Buffer1);
SetIndexBuffer(1,Buffer2);
SetIndexBuffer(2,Buffer3);
SetIndexBuffer(3,Buffer4);
SetIndexBuffer(4,Buffer5);
//
SetIndexDrawBegin(1,SignalSMA);
//
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//
IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
//
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
SetIndexLabel(2,"Histogram");
SetIndexLabel(3,"MACD[1]");
SetIndexLabel(4,"Zero");
//return(0);
}
/////////////////////////////////////////////////////////////////////////////////////////////string NewArrow(datetime T1, double P1, color collor)
{
string N=StringConcatenate("A",collor,"-",TimeToStr(T1));
int AC=SYMBOL_STOPSIGN;
if(collor==Blue)
AC=SYMBOL_ARROWUP;
if(collor==Red)
AC=SYMBOL_ARROWDOWN;
//ObjectCreate(N, OBJ_ARROW, 0, T1, P1);
ObjectSet(N, OBJPROP_ARROWCODE, AC);
ObjectSet(N, OBJPROP_COLOR, collor);
ObjectSet(N, OBJPROP_WIDTH, 1);
ObjectsRedraw();
return(N);
}
/////////////////////////////////////////////////////////////////////////////////////////////int deinit()
{
ObjectsRedraw();
return(0);
}
/////////////////////////////////////////////////////////////////////////////////////////////int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);//---- check for possible errorsif(counted_bars>0) counted_bars--;//---- last counted bar will be recounted
limit=Bars-counted_bars;
//for(i=0; i<limit; i++)//---- macd counted in the 1-st buffer histogram
Buffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//for(i=0; i<limit; i++)//---- signal line counted in the 2-nd buffer line
Buffer2[i]=iMAOnArray(Buffer1,Bars,SignalSMA,0,MODE_SMA,i);
//for(i=0; i<limit; i++)//---- histogram is the difference between macd and signal line
{
Buffer3[i]=Buffer1[i]-Buffer2[i];
Buffer5[i]=0;
}
//for(i=1; i<limit; i++)//---- macd[1]
Buffer4[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i-1)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i-1);
//if (plotArrows)
{
ObjectsDeleteAll();
InLTrade = false;
InSTrade = false;
for(int i=Bars;i>=0;i--)
{
if ((Buffer3[i-1] > 0) && (Buffer3[i] < 0) && Buffer3[i-1] > HistThreshold)//Long Begin
{
string upArrow1=NewArrow(Time[i-1], High[i-1]+0.0005, Blue);
InLTrade = true;
}
if ((Buffer3[i-1] < 0) && (Buffer3[i] > 0) && Buffer3[i-1] < -HistThreshold)//Short Begin
{
string dnArrow1=NewArrow(Time[i-1], Low[i-1]-0.0003, Red);
InSTrade = true;
InLTrade = false;
}
if ((InSTrade == true) && (Buffer3[i-1] > Buffer3[i]))//Short End
{
string upArrow2=NewArrow(Time[i-1], Low[i-1]-0.0003, Aqua);
InSTrade = false;
}
if ((InLTrade == true) && (Buffer3[i-1] < Buffer3[i]))//Long End
{
string dnArrow2=NewArrow(Time[i-1], High[i-1]+0.0005, Aqua);
InLTrade = false;
}
}
}
////return(0);
}
/////////////////////////////////////////////////////////////////////////////////////////////
Necesito ayuda, hay un indicador -Macd, pero al añadirlo al gráfico y al cambiar de marco temporal, desaparecen todos los niveles y objetos gráficos, cómo se puede solucionar.
Por favor, aconseja mql5, quiero recoger estadísticas sobre el tamaño medio de, por ejemplo, una vela de 12 horas, por ejemplo, hoy es viernes, y quiero tomar los datos del jueves, miércoles, martes y lunes para los cálculos.
Tomo time[] convierto TimeToString, luego SplitString y TD. ¿Hay una forma más rápida y menos engorrosa de referirse a la misma vela de tiempo un día o más atrás? Por supuesto, podría ejecutar el número de velas del marco temporal actual en 24 horas, pero me temo que si hay algunos huecos en las cotizaciones, se desplazarán.
Para iniciar sesión y usar el sitio web MQL5.com es necesario permitir el uso de Сookies.
Por favor, active este ajuste en su navegador, de lo contrario, no podrá iniciar sesión.
Ha iniciado sesión. La autenticación de dos factores se ha desactivado. Vuelva a configurarla y escanee un nuevo código QR, o continúe con la autenticación de dos factores desactivada.
Tarasik, se mea en ti... Idiota. Mira el código que tenemos después de tus sugerencias... Se llama "enseñar a no hacerlo", y quien no lo entienda, es su culpa.
Y ahora nos ponemos personales y discutimos lo malo que es.
Es de mala educación mentir tan descaradamente. Borras tu post y le echas la culpa de tu analfabetismo a otro. Mentiroso.
Aquí vamos, y luego nos ponemos personales y hablamos de lo malo que es.
¿Quién es el mentiroso?)Lee mis posts en la página anterior sobre eso.
Sí, no lo he borrado, es que no he encontrado inmediatamente ese mensaje.
¡Pero! Sigue retractándose de quién es ustedrábano)
rábano)
¿Responde esto a su pregunta?
Foro sobre comercio, sistemas de comercio automatizados y pruebas de estrategias
Cualquier pregunta de los novatos en MQL4 y MQL5, ayuda y discusión de algoritmos y códigos
Alexey Viktorov, 2021.06.02 17:41
Sí, no lo he borrado, sólo que no he encontrado inmediatamente el mensaje
:-)))
la forma más fácil y sencilla es obtener los nombres de las líneas horizontales o de tendencia del indicador.
- haga clic con el botón derecho del ratón en el gráfico y busque el elemento LISTA DE OBJETOS(copie y pegue en el Asesor Experto)
Gracias por la ayuda. Volví a mirar su Asesor Experto y utilicé el código:
double precio_linea_up=ObjectGetDouble(0, "Top",OBJPROP_PRICE);
double precio_línea_abajo=ObjectGetDouble(0, "Fondo",OBJPROP_PRICE);
escribiendo los nombres de las líneas del indicador. Me salen los valores pero aún no los he comprobado todos. Creo que debería funcionar.
Hola a todos. Chicos, necesito vuestra ayuda.
Tengo un indicador estocástico con allert, da una señal al cruzar las líneas móviles. Por favor, díganme cómo hacer que dé una señal cruzando en movimiento sólo cuando esté por encima o por debajo de la zona de sobrecompra y sobreventa.
Por favor, asesórese
Hola a todos. Chicos, necesito vuestra ayuda.
Tengo un indicador estocástico con allert, da una señal al cruzar las líneas móviles. Por favor, díganme cómo hacer que dé una señal cruzando en movimiento sólo cuando esté por encima o por debajo de la zona de sobrecompra y sobreventa.
Por favor, avisa.
***
Necesito ayuda, hay un indicador -Macd, pero al añadirlo al gráfico y al cambiar de marco temporal, desaparecen todos los niveles y objetos gráficos, cómo se puede solucionar.