[AVISO FECHADO!] Qualquer pergunta de novato, para não desorganizar o fórum. Profissionais, não passem por aqui. Não posso ir a lugar algum sem você. - página 161
Como resultado, StrToTime(StartRange) e StrToTime(EndRange) produzem Zeros .
- Por que e como isso pode ser consertado?
//функция bool isTradeTimeString(string TimeBegin="00:00",string TimeEnd="00:00"){datetime dtBegin, dtEnd;// Время начала и окончания работыint hc, he;// Часы текущего времени и окончания работы
dtBegin=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+ TimeBegin);
dtEnd =StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+ TimeEnd);
hc =TimeHour(TimeCurrent());
he =TimeHour( dtEnd);if( dtBegin>= dtEnd){if( hc>= he) dtEnd+=24*60*60;else dtBegin-=24*60*60;}if(TimeCurrent()>= dtBegin &&TimeCurrent()<= dtEnd)return( True);elsereturn( False);}//+-------------------------------------------------------------------
вставить в глоб. переменные
//extern string TimeBegin = "00:00";//extern string TimeEnd = "00:00";
а это уже в код - проверка
/*
isTradeTimeString();//торговля по времениif( isTradeTimeString( TimeBegin, TimeEnd)){//торгуем}
*/
...... tem uma função... ou um pedaço de código... que conta o número de pips viajados depois que um pedido é aberto... Eu não posso fazer hoje (já que ontem o pote estava sem água), mas eu realmente preciso dele!
//---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+","+SMA+")"); SetIndexLabel(0,"MACD"); SetIndexLabel(1,"Signal"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st buffer for(int i=0; i<limit; i++) MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); //---- signal line counted in the 2-nd buffer for(i=0; i<limit; i++) SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i); //---- done for(i=0; i<limit; i++) EMABuffer[i]=iMAOnArray(MacdBuffer,Bars,SMA,0,MODE_SMA,i); //---- done return(0); } //+------------------------------------------------------------------+
como eu faço um MA com um offset negativo, por exemplo -5 barras, quando eu o defino para -5 ele desenha alguma besteira?
extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern int SMA=12; //---переменные---------- double k,k1,k2; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //----
//---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //----
//---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { k=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,0,0),5); k1=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,1,0),5); k2=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,2,0),5); if (OrdersTotal()<=2) { if (k>0 && k2>k1+0.0005) ObjectCreate("down"+Time[1], OBJ_ARROW, 0, Time[1], Open[1]+100*Point); ObjectSet("down"+Time[1], OBJPROP_ARROWCODE, 242); ObjectSet("down"+Time[1], OBJPROP_COLOR, Yellow); } return(0); } //+------------------------------------------------------------------+
Favor aconselhar como explicar os pontos de inflexão de linha no software, ou seja, ao especialista, ou seja, o especialista tem que distinguir entre duas opções de posição МА: МА subir, МА descer.
No Indicador que defini (para depois compará-los com o Tempo[i]):
Em seguida, no laço
Como resultado, StrToTime(StartRange) e StrToTime(EndRange) produzem Zeros .
- Por que e como corrigi-lo?
Oops. E como você consegue colocar uma variável de data/hora na função StrToTime? Deve haver um cordel nele!
Ou você acha que o formulário de trabalho D'1970.12.24' é um fio? Você está enganado.
Talvez você precise do TimeToStr?
Como resultado, StrToTime(StartRange) e StrToTime(EndRange) produzem Zeros .
- Por que e como isso pode ser consertado?
Obviamente foi um erro meu (exemplo mal interpretado
da documentação). Acontece que é possível comparar a variável "data/hora" diretamente com a variável Hora[i].
Obrigado pela ajuda!
//+------------------------------------------------------------------+
//| Custom MACD.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Silver
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_width1 2
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int SMA=12;
//---- indicator buffers
double MacdBuffer[];
double SignalBuffer[];
double EMABuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexDrawBegin(1,SignalSMA);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,MacdBuffer);
SetIndexBuffer(1,SignalBuffer);
SetIndexBuffer(2,EMABuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+","+SMA+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
for(i=0; i<limit; i++)
EMABuffer[i]=iMAOnArray(MacdBuffer,Bars,SMA,0,MODE_SMA,i);
//---- done
return(0);
}
//+------------------------------------------------------------------+
como eu faço um MA com um offset negativo, por exemplo -5 barras, quando eu o defino para -5 ele desenha alguma besteira?
как мне сделать МА с отрицательным смещением например на -5 баров, когда ставлю -5 рисует каюто фигню ??
Por que besteira? Há algo que você não quer ver? Ou estou perdendo algo !!!!
Acima está sua variante, abaixo está a variante com um deslocamento de -5 ! apenas por -5 barras deslocadas, o que está errado ou errado????????
Por que besteira? Há algo que você não quer ver? Ou estou perdendo algo !!!!
Acima está sua variante, abaixo está a variante com um deslocamento de -5 ! apenas por -5 barras deslocadas, o que está errado ou errado????????
Bem, isso é verdade, mas quando tento invocar a EA.
//+------------------------------------------------------------------+
//| fgfgfgfgfgf.mq4 |
//| Evgenio |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Evgenio"
#property link "http://www.metaquotes.net"
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern int SMA=12;
//---переменные----------
double k,k1,k2;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
k=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,0,0),5);
k1=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,1,0),5);
k2=NormalizeDouble(iCustom(Symbol(),0,"MACD+мувинг",FastEMA,SlowEMA,SignalSMA,SMA,2,0),5);
if (OrdersTotal()<=2)
{
if (k>0 && k2>k1+0.0005)
ObjectCreate("down"+Time[1], OBJ_ARROW, 0, Time[1], Open[1]+100*Point);
ObjectSet("down"+Time[1], OBJPROP_ARROWCODE, 242);
ObjectSet("down"+Time[1], OBJPROP_COLOR, Yellow);
}
return(0);
}
//+------------------------------------------------------------------+
não funciona.
Aqui está o que eu faço
1. fazer um teste em um determinado período
2. eu anexarei um indicador
3 Eu recebo algo estranho.
Como posso fazer
Quero que minha EA abra um pedido apenas uma vez por dia.
Se ele abriu uma ordem, então a fechou e a desligou até o dia seguinte.
entendo, preciso pegar o último negócio da história... compará-lo com a data e se o pedido já foi fechado naquele dia, então desativar a EA...
você está pensando na direção certa?
Não consigo entendê-lo totalmente. Sou novo no mql.
Boa tarde, colegas.
Favor aconselhar como explicar os pontos de inflexão de linha no software, ou seja, ao especialista, ou seja, o especialista tem que distinguir entre duas opções de posição МА: МА subir, МА descer.