Hi,
My EA is trading without errors during tests.
When I enable automatic trading in production environment it does not do anything and it does not prompt any errors.
The only thing this EA is different from another ones is that it checks 64 other stock prices during every tick... is this a problem?
Here is a sample of my code:
Is this MQL4 or MQL5 ? Which kind of errors do you have ?
Is this MQL4 or MQL5 ? Which kind of errors do you have ?
Hi,
My EA is trading without errors during tests.
When I enable automatic trading in production environment it does not do anything and it does not prompt any errors.
The only thing this EA is different from another ones is that it checks 64 other stock prices during every tick... is this a problem?
Here is a sample of my code:
Hi, @Alain Verleyen
I didnt post the trading part of my code because it is sending orders during tests, but here is my complete code :
Thanks
int StartHour = 10; int MidHour = 12; int EndHour = 15; int cont=0,hOzy, hMACD, hSO, hVol, hBand, contOrdem=0; //hMA será utilizado para guardar handle do indicador MA, o HCI vai guardar o handle do indicador criado anteriormente. double atr_check[4], atr_fast[], atr_slow[], atr_bandH[], atr_bandL[], lower[], higher[], atr_bandM[], atr_SoMain[], atr_SoSignal[], atr_vol[], atr_SoInd[2], open[], close[]; double ITUB4_ini=0,VALE3_ini=0,BBDC4_ini=0,ABEV3_ini=0,PETR4_ini=0,PETR3_ini=0,BVMF3_ini=0,ITSA4_ini=0,BBAS3_ini=0,UGPA3_ini=0, BRFS3_ini=0,CIEL3_ini=0,KROT3_ini=0,LREN3_ini=0,VIVT4_ini=0,BBSE3_ini=0,BBDC3_ini=0,RADL3_ini=0,CCRO3_ini=0,JBSS3_ini=0,EMBR3_ini=0,GGBR4_ini=0, WEGE3_ini=0,HYPE3_ini=0,RAIL3_ini=0,EQTL3_ini=0, BRKM5_ini=0,SANB11_ini=0,PCAR4_ini=0,RENT3_ini=0,FIBR3_ini=0,SBSP3_ini=0,LAME4_ini=0,ESTC3_ini=0, BRML3_ini=0,TIMP3_ini=0,SUZB3_ini=0,KLBN11_ini=0,FLRY3_ini=0,QUAL3_ini=0,BRAP4_ini=0,EGIE3_ini=0,CMIG4_ini=0,CSNA3_ini=0,MULT3_ini=0,CSAN3_ini=0, NATU3_ini=0,USIM5_ini=0,MGLU3_ini=0,ELET3_ini=0,SMLS3_ini=0,ELET6_ini=0,MRVE3_ini=0,ENBR3_ini=0,GOAU4_ini=0,SAPR11_ini=0,TAEE11_ini=0,IGTA3_ini=0, CYRE3_ini=0,VVAR11_ini=0,MRFG3_ini=0,CPLE6_ini=0,ECOR3_ini=0,CPFE3_ini=0, ITUB4_last,VALE3_last,BBDC4_last,ABEV3_last,PETR4_last,PETR3_last,BVMF3_last,ITSA4_last,BBAS3_last,UGPA3_last, BRFS3_last,CIEL3_last,KROT3_last,LREN3_last,VIVT4_last,BBSE3_last,BBDC3_last,RADL3_last,CCRO3_last,JBSS3_last,EMBR3_last,GGBR4_last, WEGE3_last,HYPE3_last,RAIL3_last,EQTL3_last, BRKM5_last,SANB11_last,PCAR4_last,RENT3_last,FIBR3_last,SBSP3_last,LAME4_last,ESTC3_last, BRML3_last,TIMP3_last,SUZB3_last,KLBN11_last,FLRY3_last,QUAL3_last,BRAP4_last,EGIE3_last,CMIG4_last,CSNA3_last,MULT3_last,CSAN3_last, NATU3_last,USIM5_last,MGLU3_last,ELET3_last,SMLS3_last,ELET6_last,MRVE3_last,ENBR3_last,GOAU4_last,SAPR11_last,TAEE11_last,IGTA3_last, CYRE3_last,VVAR11_last,MRFG3_last,CPLE6_last,ECOR3_last,CPFE3_last, ITUB4_percent, VALE3_percent,BBDC4_percent,ABEV3_percent,PETR4_percent,PETR3_percent,BVMF3_percent,ITSA4_percent,BBAS3_percent,UGPA3_percent, BRFS3_percent,CIEL3_percent,KROT3_percent,LREN3_percent,VIVT4_percent,BBSE3_percent,BBDC3_percent,RADL3_percent,CCRO3_percent,JBSS3_percent,EMBR3_percent,GGBR4_percent, WEGE3_percent,HYPE3_percent,RAIL3_percent,EQTL3_percent,BRKM5_percent,SANB11_percent,PCAR4_percent,RENT3_percent,FIBR3_percent,SBSP3_percent, LAME4_percent,ESTC3_percent,BRML3_percent,TIMP3_percent,SUZB3_percent,KLBN11_percent,FLRY3_percent,QUAL3_percent,BRAP4_percent,EGIE3_percent, CMIG4_percent,CSNA3_percent,MULT3_percent,CSAN3_percent,NATU3_percent,USIM5_percent,MGLU3_percent,ELET3_percent,SMLS3_percent,ELET6_percent, MRVE3_percent,ENBR3_percent,GOAU4_percent,SAPR11_percent,TAEE11_percent,IGTA3_percent,CYRE3_percent,VVAR11_percent,MRFG3_percent,CPLE6_percent, ECOR3_percent,CPFE3_percent, total_percent; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnInit() { hVol=iCustom(NULL,0,"volumes"); hMACD=iCustom(NULL,0,"macd_divergence"); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ //Executa sempre que uma nova cotação chegar. void OnTick() { MqlTradeRequest request,request2,request3,request4; MqlTradeResult result; MqlDateTime dt; MqlTick tick; ZeroMemory(request); bool bord, sord, checkComprado, bord2, sord2;//se tiver como verdadeiro é pq existem pending orders int i; datetime t[];//utilizado junto com o o h[] e o l[] para guardar o horário, min e max para cada barra do graf request.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request.symbol =Symbol(); request.volume =1; request.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request.deviation =0;//variância do preço durante a negociação. request.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. request2.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request2.symbol =Symbol(); request2.volume =1; request2.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request2.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request2.deviation =0;//variância do preço durante a negociação. request2.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. request3.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request3.symbol =Symbol(); request3.volume =1; request3.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request3.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request3.deviation =0;//variância do preço durante a negociação. request3.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. request4.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request4.symbol =Symbol(); request4.volume =1; request4.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request4.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request4.deviation =0;//variância do preço durante a negociação. request4.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. int exp_mode = (int)SymbolInfoInteger(_Symbol, SYMBOL_EXPIRATION_MODE); double StopLoss, TakeProfitG, TakeProfitL, ask, bid, tendence, diffBand, diffBand2, totalBand, atr_bbInd, diffOzy, diffMacd, diffMacd3, diffMacdT, diffFast, diffSlow, diffMacd2, diffFast2, diffSlow2, tendenciaCandle, tendenciaCandle2, tendenciaCandle3, diffCandlesBuy, diffCandlesSell, diffCandles0, totalCandle, hDay[], lDay[],lev_h, lev_l, diffCompra, diffVenda; string stock; TimeCurrent(dt); //Maxima e minima do dia i=(dt.hour+1)*60; if(CopyTime(Symbol(),0,0,i,t)<i || CopyHigh(Symbol(),0,0,i,hDay)<i || CopyLow(Symbol(),0,0,i,lDay)<i)//copia os valores de data, minimo e maximo p/ as variaveis //1st nome do simbolo, 2nd timeframe do graf, 3rd o elemento que começará, 4th a quantidade de elem pra copiar, 5th o array em que será copiado. { Print("Can't copy timeseries!"); return; } //aqui quando é setado true o elemento 0 é o mais novo ArraySetAsSeries(t,true); ArraySetAsSeries(hDay,true); ArraySetAsSeries(lDay,true); lev_h=hDay[0];//pega a máxima do dia lev_l=lDay[0]; for(i=1;i<ArraySize(t) && MathFloor(t[i]/86400)==MathFloor(t[0]/86400);i++)//esse if que tem dentro do for é pra garantir que as barras sejam do mesmo dia { if(hDay[i]>lev_h) lev_h=hDay[i]; if(lDay[i]<lev_l) lev_l=lDay[i]; } SymbolInfoTick("ITUB4",tick); if (ITUB4_ini == 0 && tick.last != 0) ITUB4_ini = tick.last; SymbolInfoTick("VALE3",tick); if (VALE3_ini == 0 && tick.last != 0) VALE3_ini = tick.last; SymbolInfoTick("BBDC4",tick); if (BBDC4_ini == 0 && tick.last != 0) BBDC4_ini = tick.last; SymbolInfoTick("ABEV3",tick); if (ABEV3_ini == 0 && tick.last != 0) ABEV3_ini = tick.last; SymbolInfoTick("PETR4",tick); if (PETR4_ini == 0 && tick.last != 0) PETR4_ini = tick.last; SymbolInfoTick("PETR3",tick); if (PETR3_ini == 0 && tick.last != 0) PETR3_ini = tick.last; SymbolInfoTick("BVMF3",tick); if (BVMF3_ini == 0 && tick.last != 0) BVMF3_ini = tick.last; SymbolInfoTick("ITSA4",tick); if (ITSA4_ini == 0 && tick.last != 0) ITSA4_ini = tick.last; SymbolInfoTick("BBAS3",tick); if (BBAS3_ini == 0 && tick.last != 0) BBAS3_ini = tick.last; SymbolInfoTick("UGPA3",tick); if (UGPA3_ini == 0 && tick.last != 0) UGPA3_ini = tick.last; SymbolInfoTick("BRFS3",tick); if (BRFS3_ini == 0 && tick.last != 0) BRFS3_ini = tick.last; SymbolInfoTick("CIEL3",tick); if (CIEL3_ini == 0 && tick.last != 0) CIEL3_ini = tick.last; SymbolInfoTick("KROT3",tick); if (KROT3_ini == 0 && tick.last != 0) KROT3_ini = tick.last; SymbolInfoTick("LREN3",tick); if (LREN3_ini == 0 && tick.last != 0) LREN3_ini = tick.last; SymbolInfoTick("VIVT4",tick); if (VIVT4_ini == 0 && tick.last != 0) VIVT4_ini = tick.last; SymbolInfoTick("BBSE3",tick); if (BBSE3_ini == 0 && tick.last != 0) BBSE3_ini = tick.last; SymbolInfoTick("BBDC3",tick); if (BBDC3_ini == 0 && tick.last != 0) BBDC3_ini = tick.last; SymbolInfoTick("RADL3",tick); if (RADL3_ini == 0 && tick.last != 0) RADL3_ini = tick.last; SymbolInfoTick("CCRO3",tick); if (CCRO3_ini == 0 && tick.last != 0) CCRO3_ini = tick.last; SymbolInfoTick("JBSS3",tick); if (JBSS3_ini == 0 && tick.last != 0) JBSS3_ini = tick.last; SymbolInfoTick("EMBR3",tick); if (EMBR3_ini == 0 && tick.last != 0) EMBR3_ini = tick.last; SymbolInfoTick("GGBR4",tick); if (GGBR4_ini == 0 && tick.last != 0) GGBR4_ini = tick.last; SymbolInfoTick("WEGE3",tick); if (WEGE3_ini == 0 && tick.last != 0) WEGE3_ini = tick.last; SymbolInfoTick("HYPE3",tick); if (HYPE3_ini == 0 && tick.last != 0) HYPE3_ini = tick.last; SymbolInfoTick("RAIL3",tick); if (RAIL3_ini == 0 && tick.last != 0) RAIL3_ini = tick.last; SymbolInfoTick("EQTL3",tick); if (EQTL3_ini == 0 && tick.last != 0) EQTL3_ini = tick.last; SymbolInfoTick("BRKM5",tick); if (BRKM5_ini == 0 && tick.last != 0) BRKM5_ini = tick.last; SymbolInfoTick("SANB11",tick); if (SANB11_ini == 0 && tick.last != 0) SANB11_ini = tick.last; SymbolInfoTick("PCAR4",tick); if (PCAR4_ini == 0 && tick.last != 0) PCAR4_ini = tick.last; SymbolInfoTick("RENT3",tick); if (RENT3_ini == 0 && tick.last != 0) RENT3_ini = tick.last; SymbolInfoTick("FIBR3",tick); if (FIBR3_ini == 0 && tick.last != 0) FIBR3_ini = tick.last; SymbolInfoTick("SBSP3",tick); if (SBSP3_ini == 0 && tick.last != 0) SBSP3_ini = tick.last; SymbolInfoTick("LAME4",tick); if (LAME4_ini == 0 && tick.last != 0) LAME4_ini = tick.last; SymbolInfoTick("ESTC3",tick); if (ESTC3_ini == 0 && tick.last != 0) ESTC3_ini = tick.last; SymbolInfoTick("BRML3",tick); if (BRML3_ini == 0 && tick.last != 0) BRML3_ini = tick.last; SymbolInfoTick("TIMP3",tick); if (TIMP3_ini == 0 && tick.last != 0) TIMP3_ini = tick.last; SymbolInfoTick("SUZB3",tick); if (SUZB3_ini == 0 && tick.last != 0) SUZB3_ini = tick.last; SymbolInfoTick("KLBN11",tick); if (KLBN11_ini == 0 && tick.last != 0) KLBN11_ini = tick.last; SymbolInfoTick("FLRY3",tick); if (FLRY3_ini == 0 && tick.last != 0) FLRY3_ini = tick.last; SymbolInfoTick("QUAL3",tick); if (QUAL3_ini == 0 && tick.last != 0) QUAL3_ini = tick.last; SymbolInfoTick("BRAP4",tick); if (BRAP4_ini == 0 && tick.last != 0) BRAP4_ini = tick.last; SymbolInfoTick("EGIE3",tick); if (EGIE3_ini == 0 && tick.last != 0) EGIE3_ini = tick.last; SymbolInfoTick("CMIG4",tick); if (CMIG4_ini == 0 && tick.last != 0) CMIG4_ini = tick.last; SymbolInfoTick("CSNA3",tick); if (CSNA3_ini == 0 && tick.last != 0) CSNA3_ini = tick.last; SymbolInfoTick("MULT3",tick); if (MULT3_ini == 0 && tick.last != 0) MULT3_ini = tick.last; SymbolInfoTick("CSAN3",tick); if (CSAN3_ini == 0 && tick.last != 0) CSAN3_ini = tick.last; SymbolInfoTick("NATU3",tick); if (NATU3_ini == 0 && tick.last != 0) NATU3_ini = tick.last; SymbolInfoTick("USIM5",tick); if (USIM5_ini == 0 && tick.last != 0) USIM5_ini = tick.last; SymbolInfoTick("MGLU3",tick); if (MGLU3_ini == 0 && tick.last != 0) MGLU3_ini = tick.last; SymbolInfoTick("ELET3",tick); if (ELET3_ini == 0 && tick.last != 0) ELET3_ini = tick.last; SymbolInfoTick("SMLS3",tick); if (SMLS3_ini == 0 && tick.last != 0) SMLS3_ini = tick.last; SymbolInfoTick("ELET6",tick); if (ELET6_ini == 0 && tick.last != 0) ELET6_ini = tick.last; SymbolInfoTick("MRVE3",tick); if (MRVE3_ini == 0 && tick.last != 0) MRVE3_ini = tick.last; SymbolInfoTick("ENBR3",tick); if (ENBR3_ini == 0 && tick.last != 0) ENBR3_ini = tick.last; SymbolInfoTick("GOAU4",tick); if (GOAU4_ini == 0 && tick.last != 0) GOAU4_ini = tick.last; SymbolInfoTick("SAPR11",tick); if (SAPR11_ini == 0 && tick.last != 0) SAPR11_ini = tick.last; SymbolInfoTick("TAEE11",tick); if (TAEE11_ini == 0 && tick.last != 0) TAEE11_ini = tick.last; SymbolInfoTick("IGTA3",tick); if (IGTA3_ini == 0 && tick.last != 0) IGTA3_ini = tick.last; SymbolInfoTick("CYRE3",tick); if (CYRE3_ini == 0 && tick.last != 0) CYRE3_ini = tick.last; SymbolInfoTick("VVAR11",tick); if (VVAR11_ini == 0 && tick.last != 0) VVAR11_ini = tick.last; SymbolInfoTick("MRFG3",tick); if (MRFG3_ini == 0 && tick.last != 0) MRFG3_ini = tick.last; SymbolInfoTick("CPLE6",tick); if (CPLE6_ini == 0 && tick.last != 0) CPLE6_ini = tick.last; SymbolInfoTick("ECOR3",tick); if (ECOR3_ini == 0 && tick.last != 0) ECOR3_ini = tick.last; SymbolInfoTick("CPFE3",tick); if (CPFE3_ini == 0 && tick.last != 0) CPFE3_ini = tick.last; //------MEUS INDICADORES------------- if(CopyBuffer(hMACD,2,0,3,atr_fast)<3 || CopyBuffer(hMACD,3,0,3,atr_slow)<3 || CopyHigh(Symbol(),0,0,2,higher)<2 || CopyLow(Symbol(),0,0,2,lower)<2 || CopyOpen(Symbol(),0,0,3,open)<3 || CopyClose(Symbol(),0,0,3,close)<3) //1st nome do simbolo, 2nd timeframe do graf, 3rd o elemento que começará, 4th a quantidade de elem pra copiar, 5th o array em que será copiado. //tem valor do indicador da ultima barra fechada, pega max e min //hCI é da última barra que ainda nao fechou, 1 pega o max e o outro o min { Print("Can't copy indicator buffer!"); return; } ArraySetAsSeries(atr_slow,true); ArraySetAsSeries(atr_fast,true); ArraySetAsSeries(higher,true); ArraySetAsSeries(lower,true); ArraySetAsSeries(open,true); ArraySetAsSeries(close,true); //------------TESTES PARA ENTRADA TRADE------------------------- //orders registradas //peding orders if (PositionsTotal()==0 && OrdersTotal() == 0){ bord=false; sord=false; contOrdem=0; } else{ bord=true; sord=true; } if (atr_check[3]+5 >= 60)atr_check[3]=54; if (dt.min >= atr_check[3]+5){ atr_check[3]=0; } //MACD //linha rosa anterior <= linha azul anterior, linha rosa atual >= linha azul atual, linha rosa anterior <= linha rosa atual = compra if ( atr_fast[0] > 0 && atr_fast[1] > 0 && atr_fast[2] > 0 && atr_fast[0] > atr_slow[0] && atr_fast[1] < atr_fast[0] && atr_fast[2] < atr_fast[1] ){ tendence=1; } else if ( atr_fast[0] < 0 && atr_fast[1] < 0 && atr_fast[2] < 0 && atr_fast[0] > atr_slow[0] && atr_fast[1] < atr_fast[0] && atr_fast[2] < atr_fast[1] ){ tendence=1; } else if ( atr_fast[0] > 0 && atr_fast[1] > 0 && atr_fast[2] < 0 && atr_fast[0] > atr_slow[0] && atr_fast[1] < atr_fast[0] && atr_fast[2] < atr_fast[1] ){ tendence=1; } else if ( atr_fast[0] > 0 && atr_fast[1] < 0 && atr_fast[2] < 0 && atr_fast[0] > atr_slow[0] && atr_fast[1] < atr_fast[0] && atr_fast[2] < atr_fast[1] ){ tendence=1; } else if ( atr_fast[0] > 0 && atr_fast[1] > 0 && atr_fast[2] > 0 && atr_slow[0] > atr_fast[0] && atr_fast[1] > atr_fast[0] && atr_fast[2] > atr_fast[1] ){ tendence=0; } else if ( atr_fast[0] < 0 && atr_fast[1] < 0 && atr_fast[2] < 0 && atr_slow[0] > atr_fast[0] && atr_fast[1] > atr_fast[0] && atr_fast[2] > atr_fast[1] ){ tendence=0; } else if ( atr_fast[0] < 0 && atr_fast[1] < 0 && atr_fast[2] > 0 && atr_slow[0] > atr_fast[0] && atr_fast[1] > atr_fast[0] && atr_fast[2] > atr_fast[1] ){ tendence=0; } else if ( atr_fast[0] < 0 && atr_fast[1] > 0 && atr_fast[2] > 0 && atr_slow[0] > atr_fast[0] && atr_fast[1] > atr_fast[0] && atr_fast[2] > atr_fast[1] ){ tendence=0; } else tendence=2; //fast linha rosa ; slow linha azul //tem que esperar um tempo pra entrar novamente e nao entrar no mesmo candle if (atr_check[1] != tendence && tendence != 2) { checkComprado=false; atr_check[1]=9; } else checkComprado=true; //Diferença MACD diffMacd = atr_fast[0] - atr_slow[0]; diffMacd2 = atr_fast[1] - atr_slow[1]; diffMacd3 = atr_fast[2] - atr_slow[2]; if (diffMacd<0)diffMacd=diffMacd*-1; if (diffMacd2<0)diffMacd2=diffMacd2*-1; if (diffMacd3<0)diffMacd3=diffMacd3*-1; diffMacdT = diffMacd - diffMacd2; //ACOES SymbolInfoTick("ITUB4",tick); ITUB4_last = tick.last; SymbolInfoTick("VALE3",tick); VALE3_last = tick.last; SymbolInfoTick("BBDC4",tick); BBDC4_last = tick.last; SymbolInfoTick("ABEV3",tick); ABEV3_last = tick.last; SymbolInfoTick("PETR4",tick); PETR4_last = tick.last; SymbolInfoTick("PETR3",tick); PETR3_last = tick.last; SymbolInfoTick("BVMF3",tick); BVMF3_last = tick.last; SymbolInfoTick("ITSA4",tick); ITSA4_last = tick.last; SymbolInfoTick("BBAS3",tick); BBAS3_last = tick.last; SymbolInfoTick("UGPA3",tick); UGPA3_last = tick.last; SymbolInfoTick("BRFS3",tick); BRFS3_last = tick.last; SymbolInfoTick("CIEL3",tick); CIEL3_last = tick.last; SymbolInfoTick("KROT3",tick); KROT3_last = tick.last; SymbolInfoTick("LREN3",tick); LREN3_last = tick.last; SymbolInfoTick("VIVT4",tick); VIVT4_last = tick.last; SymbolInfoTick("BBSE3",tick); BBSE3_last = tick.last; SymbolInfoTick("BBDC3",tick); BBDC3_last = tick.last; SymbolInfoTick("RADL3",tick); RADL3_last = tick.last; SymbolInfoTick("CCRO3",tick); CCRO3_last = tick.last; SymbolInfoTick("JBSS3",tick); JBSS3_last = tick.last; SymbolInfoTick("EMBR3",tick); EMBR3_last = tick.last; SymbolInfoTick("GGBR4",tick); GGBR4_last = tick.last; SymbolInfoTick("WEGE3",tick); WEGE3_last = tick.last; SymbolInfoTick("HYPE3",tick); HYPE3_last = tick.last; SymbolInfoTick("RAIL3",tick); RAIL3_last = tick.last; SymbolInfoTick("EQTL3",tick); EQTL3_last = tick.last; SymbolInfoTick("BRKM5",tick);BRKM5_last = tick.last; SymbolInfoTick("SANB11",tick);SANB11_last = tick.last; SymbolInfoTick("PCAR4",tick);PCAR4_last = tick.last; SymbolInfoTick("RENT3",tick);RENT3_last = tick.last; SymbolInfoTick("FIBR3",tick);FIBR3_last = tick.last; SymbolInfoTick("SBSP3",tick);SBSP3_last = tick.last; SymbolInfoTick("LAME4",tick);LAME4_last = tick.last; SymbolInfoTick("ESTC3",tick);ESTC3_last = tick.last; SymbolInfoTick("BRML3",tick);BRML3_last = tick.last; SymbolInfoTick("TIMP3",tick);TIMP3_last = tick.last; SymbolInfoTick("SUZB3",tick);SUZB3_last = tick.last; SymbolInfoTick("KLBN11",tick);KLBN11_last = tick.last; SymbolInfoTick("FLRY3",tick);FLRY3_last = tick.last; SymbolInfoTick("QUAL3",tick);QUAL3_last = tick.last; SymbolInfoTick("BRAP4",tick);BRAP4_last = tick.last; SymbolInfoTick("EGIE3",tick);EGIE3_last = tick.last; SymbolInfoTick("CMIG4",tick);CMIG4_last = tick.last; SymbolInfoTick("CSNA3",tick);CSNA3_last = tick.last; SymbolInfoTick("MULT3",tick);MULT3_last = tick.last; SymbolInfoTick("CSAN3",tick);CSAN3_last = tick.last; SymbolInfoTick("NATU3",tick);NATU3_last = tick.last; SymbolInfoTick("USIM5",tick);USIM5_last = tick.last; SymbolInfoTick("MGLU3",tick);MGLU3_last = tick.last; SymbolInfoTick("ELET3",tick);ELET3_last = tick.last; SymbolInfoTick("SMLS3",tick);SMLS3_last = tick.last; SymbolInfoTick("ELET6",tick);ELET6_last = tick.last; SymbolInfoTick("MRVE3",tick);MRVE3_last = tick.last; SymbolInfoTick("ENBR3",tick);ENBR3_last = tick.last; SymbolInfoTick("GOAU4",tick);GOAU4_last = tick.last; SymbolInfoTick("SAPR11",tick);SAPR11_last = tick.last; SymbolInfoTick("TAEE11",tick);TAEE11_last = tick.last; SymbolInfoTick("IGTA3",tick);IGTA3_last = tick.last; SymbolInfoTick("CYRE3",tick);CYRE3_last = tick.last; SymbolInfoTick("VVAR11",tick);VVAR11_last = tick.last; SymbolInfoTick("MRFG3",tick);MRFG3_last = tick.last; SymbolInfoTick("CPLE6",tick);CPLE6_last = tick.last; SymbolInfoTick("ECOR3",tick);ECOR3_last = tick.last; SymbolInfoTick("CPFE3",tick);CPFE3_last = tick.last; if (ITUB4_ini !=0) ITUB4_percent = (ITUB4_last -ITUB4_ini) *10.79; if (VALE3_ini !=0) VALE3_percent = (VALE3_last -VALE3_ini) *10.351; if (BBDC4_ini !=0) BBDC4_percent = (BBDC4_last -BBDC4_ini) *7.908; if (ABEV3_ini !=0) ABEV3_percent = (ABEV3_last -ABEV3_ini) *6.799; if (PETR4_ini !=0) PETR4_percent = (PETR4_last -PETR4_ini) *5.407; if (PETR3_ini !=0) PETR3_percent = (PETR3_last -PETR3_ini) *3.747; if (BVMF3_ini !=0) BVMF3_percent = (BVMF3_last -BVMF3_ini) *3.667; if (ITSA4_ini !=0) ITSA4_percent = (ITSA4_last -ITSA4_ini) *3.337; if (BBAS3_ini !=0) BBAS3_percent = (BBAS3_last -BBAS3_ini) *3.17; if (UGPA3_ini !=0) UGPA3_percent = (UGPA3_last -UGPA3_ini) *2.393; if (BRFS3_ini !=0) BRFS3_percent = (BRFS3_last -BRFS3_ini) *2.3; if (CIEL3_ini !=0) CIEL3_percent = (CIEL3_last -CIEL3_ini) *2.053; if (KROT3_ini !=0) KROT3_percent = (KROT3_last -KROT3_ini) *1.994; if (LREN3_ini !=0) LREN3_percent = (LREN3_last -LREN3_ini) *1.869; if (VIVT4_ini !=0) VIVT4_percent = (VIVT4_last -VIVT4_ini) *1.56; if (BBSE3_ini !=0) BBSE3_percent = (BBSE3_last -BBSE3_ini) *1.483; if (BBDC3_ini !=0) BBDC3_percent = (BBDC3_last -BBDC3_ini) *1.415; if (RADL3_ini !=0) RADL3_percent = (RADL3_last -RADL3_ini) *1.392; if (CCRO3_ini !=0) CCRO3_percent = (CCRO3_last -CCRO3_ini) *1.351; if (JBSS3_ini !=0) JBSS3_percent = (JBSS3_last -JBSS3_ini) *1.158; if (EMBR3_ini !=0) EMBR3_percent = (EMBR3_last -EMBR3_ini) *1.141; if (GGBR4_ini !=0) GGBR4_percent = (GGBR4_last -GGBR4_ini) *1.123; if (WEGE3_ini !=0) WEGE3_percent = (WEGE3_last -WEGE3_ini) *1.098; if (HYPE3_ini !=0) HYPE3_percent = (HYPE3_last -HYPE3_ini) *1.079; if (RAIL3_ini !=0) RAIL3_percent = (RAIL3_last -RAIL3_ini) *1.065; if (EQTL3_ini !=0) EQTL3_percent = (EQTL3_last -EQTL3_ini) *0.998; if (BRKM5_ini !=0) BRKM5_percent = (BRKM5_last -BRKM5_ini) *0.928; if (SANB11_ini !=0) SANB11_percent = (SANB11_last -SANB11_ini) *0.926; if (PCAR4_ini !=0) PCAR4_percent = (PCAR4_last -PCAR4_ini) *0.88; if (RENT3_ini !=0) RENT3_percent = (RENT3_last -RENT3_ini) *0.875; if (FIBR3_ini !=0) FIBR3_percent = (FIBR3_last -FIBR3_ini) *0.87; if (SBSP3_ini !=0) SBSP3_percent = (SBSP3_last -SBSP3_ini) *0.869; if (LAME4_ini !=0) LAME4_percent = (LAME4_last -LAME4_ini) *0.814; if (ESTC3_ini !=0) ESTC3_percent = (ESTC3_last -ESTC3_ini) *0.793; if (BRML3_ini !=0) BRML3_percent = (BRML3_last -BRML3_ini) *0.789; if (TIMP3_ini !=0) TIMP3_percent = (TIMP3_last -TIMP3_ini) *0.788; if (SUZB3_ini !=0) SUZB3_percent = (SUZB3_last -SUZB3_ini) *0.686; if (KLBN11_ini !=0) KLBN11_percent = (KLBN11_last -KLBN11_ini) *0.651; if (FLRY3_ini !=0) FLRY3_percent = (FLRY3_last -FLRY3_ini) *0.643; if (QUAL3_ini !=0) QUAL3_percent = (QUAL3_last -QUAL3_ini) *0.565; if (BRAP4_ini !=0) BRAP4_percent = (BRAP4_last -BRAP4_ini) *0.543; if (EGIE3_ini !=0) EGIE3_percent = (EGIE3_last -EGIE3_ini) *0.54; if (CMIG4_ini !=0) CMIG4_percent = (CMIG4_last -CMIG4_ini) *0.509; if (CSNA3_ini !=0) CSNA3_percent = (CSNA3_last -CSNA3_ini) *0.495; if (MULT3_ini !=0) MULT3_percent = (MULT3_last -MULT3_ini) *0.494; if (CSAN3_ini !=0) CSAN3_percent = (CSAN3_last -CSAN3_ini) *0.478; if (NATU3_ini !=0) NATU3_percent = (NATU3_last -NATU3_ini) *0.424; if (USIM5_ini !=0) USIM5_percent = (USIM5_last -USIM5_ini) *0.419; if (MGLU3_ini !=0) MGLU3_percent = (MGLU3_last -MGLU3_ini) *0.399; if (ELET3_ini !=0) ELET3_percent = (ELET3_last -ELET3_ini) *0.352; if (SMLS3_ini !=0) SMLS3_percent = (SMLS3_last -SMLS3_ini) *0.349; if (ELET6_ini !=0) ELET6_percent = (ELET6_last -ELET6_ini) *0.344; if (MRVE3_ini !=0) MRVE3_percent = (MRVE3_last -MRVE3_ini) *0.339; if (ENBR3_ini !=0) ENBR3_percent = (ENBR3_last -ENBR3_ini) *0.306; if (GOAU4_ini !=0) GOAU4_percent = (GOAU4_last -GOAU4_ini) *0.293; if (SAPR11_ini !=0) SAPR11_percent = (SAPR11_last -SAPR11_ini) *0.285; if (TAEE11_ini !=0) TAEE11_percent = (TAEE11_last -TAEE11_ini) *0.285; if (IGTA3_ini !=0) IGTA3_percent = (IGTA3_last -IGTA3_ini) *0.265; if (CYRE3_ini !=0) CYRE3_percent = (CYRE3_last -CYRE3_ini) *0.259; if (VVAR11_ini !=0) VVAR11_percent = (VVAR11_last -VVAR11_ini) *0.241; if (MRFG3_ini !=0) MRFG3_percent = (MRFG3_last -MRFG3_ini) *0.217; if (CPLE6_ini !=0) CPLE6_percent = (CPLE6_last -CPLE6_ini) *0.184; if (ECOR3_ini !=0) ECOR3_percent = (ECOR3_last -ECOR3_ini) *0.171; if (CPFE3_ini !=0) CPFE3_percent = (CPFE3_last -CPFE3_ini) *0.084; total_percent=(ITUB4_percent+ VALE3_percent+BBDC4_percent+ABEV3_percent+PETR4_percent+PETR3_percent+BVMF3_percent+ITSA4_percent+BBAS3_percent+UGPA3_percent+ BRFS3_percent+CIEL3_percent+KROT3_percent+LREN3_percent+VIVT4_percent+BBSE3_percent+BBDC3_percent+RADL3_percent+CCRO3_percent+JBSS3_percent+EMBR3_percent+GGBR4_percent+ WEGE3_percent+HYPE3_percent+RAIL3_percent+EQTL3_percent+BRKM5_percent+SANB11_percent+PCAR4_percent+RENT3_percent+FIBR3_percent+SBSP3_percent+ LAME4_percent+ESTC3_percent+BRML3_percent+TIMP3_percent+SUZB3_percent+KLBN11_percent+FLRY3_percent+QUAL3_percent+BRAP4_percent+EGIE3_percent+ CMIG4_percent+CSNA3_percent+MULT3_percent+CSAN3_percent+NATU3_percent+USIM5_percent+MGLU3_percent+ELET3_percent+SMLS3_percent+ELET6_percent+ MRVE3_percent+ENBR3_percent+GOAU4_percent+SAPR11_percent+TAEE11_percent+IGTA3_percent+CYRE3_percent+VVAR11_percent+MRFG3_percent+CPLE6_percent+ ECOR3_percent+CPFE3_percent)/100; //Candles - High e Low totalCandle = open[0] - lower[1]; if (totalCandle<0) totalCandle=totalCandle*-1; //Maxima e Minima do Dia ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits);//preço de compra bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits);//preço de venda diffCompra = lev_h - bid; diffVenda = ask - lev_l; tendenciaCandle = open[0] - lower[0]; tendenciaCandle2 = open[1] - close[1]; tendenciaCandle3 = open[2] - close[2]; diffCandlesSell = open[1] - lower[0]; diffCandlesBuy = higher[0] - open[1]; diffCandles0 = higher[0] - lower[0]; //if ( atr_check[2] == atr_fast[2] || atr_check[2] == atr_slow[2] ) atr_check[2]=123; //----------------------------------------------------------------- // in this loop we're checking all opened positions for(i=0;i<PositionsTotal();i++) { //total = PositionsTotal(); ZeroMemory(result); // processing orders with "our" symbols only if(Symbol()==PositionGetSymbol(i)) { // we will change the values of StopLoss and TakeProfit ulong position_ticket=PositionGetTicket(i); double volume=PositionGetDouble(POSITION_VOLUME); string position_symbol=PositionGetString(POSITION_SYMBOL); double pr=PositionGetDouble(POSITION_PRICE_CURRENT); ENUM_POSITION_TYPE type=(ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE); double req_sl=PositionGetDouble(POSITION_SL); double req_tp=PositionGetDouble(POSITION_TP); double bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); double ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request.position=position_ticket; request.symbol=position_symbol; request.volume=volume; ZeroMemory(request2); request2.position=position_ticket; request2.symbol=position_symbol; request2.volume=volume; request2.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request2.symbol =Symbol(); request2.volume =1; request2.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request2.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request2.deviation =0;//variância do preço durante a negociação. request2.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. ZeroMemory(request3); request3.position=position_ticket; request3.symbol=position_symbol; request3.volume=volume; request3.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request3.symbol =Symbol(); request3.volume =1; request3.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request3.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request3.deviation =0;//variância do preço durante a negociação. request3.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. ZeroMemory(request4); request4.position=position_ticket; request4.symbol=position_symbol; request4.volume=volume; request4.action=TRADE_ACTION_PENDING;//essa parte eh muito importante senao a ordem nao funciona request4.symbol =Symbol(); request4.volume =1; request4.type_time=ORDER_TIME_DAY;//precisa colocar isso para o WIN, para PETR nao precisou request4.tp =0;//takeProfit, não vamos utilizar em algumas vezes por isso 0. request4.deviation =0;//variância do preço durante a negociação. request4.type_filling=ORDER_FILLING_FOK;//existem 3 tipos, esse é o caso que a ordem não será executada se o cara nao tiver o volument exato ou superior. //double ask=PositionGetDouble(POSITION_PROFIT); // processing long positions if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY) { // let's determine StopLoss //StopLoss = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits) - req_sl-100; StopLoss = atr_check[0] - NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); TakeProfitL = req_tp - NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits) -100; TakeProfitG = req_tp - NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); if(StopLoss >= 50 && contOrdem==1) { // putting new value of StopLoss to the structure request.tp=NormalizeDouble(atr_check[0]+30,_Digits); request.volume=1; //request.sl=req_sl; request.action=TRADE_ACTION_SLTP; request2.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request2.tp=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK)+80,_Digits); request2.sl=0; request2.type=ORDER_TYPE_BUY_LIMIT;//aqui precisa colocar LIMIT senao dá problema no expiration //atr_check[3]=tendence;//comprado contOrdem=contOrdem+1; bord2=true; if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); // sending request to trade server if (!OrderSend(request2,result)) PrintFormat("OrderSend Error %d",GetLastError()); } //Check Ordens Pendentes - VENDE OU COMPRA DE ACORDO COM O VALOR QUE ESTÁ NA HORA, NAO PODE FICAR REQUEST PENDENTE if ((dt.hour==17 && dt.min==50))//atr_fast[0] < atr_fast[1]) { if (contOrdem==1) { request3.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); request3.type=ORDER_TYPE_SELL_LIMIT;//aqui precisa colocar LIMIT senao dá problema no expiration request3.volume=1; contOrdem=0; if (!OrderSend(request3,result)) PrintFormat("OrderSend Error %d",GetLastError()); } if (contOrdem==2) { request3.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); request4.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); request3.volume=1; request4.volume=1; request3.type=ORDER_TYPE_SELL_LIMIT; request4.type=ORDER_TYPE_SELL_LIMIT; contOrdem=0; if (!OrderSend(request3,result)) PrintFormat("OrderSend Error %d",GetLastError()); if (!OrderSend(request4,result)) PrintFormat("OrderSend Error %d",GetLastError()); } } /*if(TakeProfitL == 70) { //request.sl=NormalizeDouble(req_sl,_Digits); // putting new value of TakeProfit to the structure request.tp=NormalizeDouble(req_tp-TakeProfitL,_Digits); // sending request to trade server if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); }*/ /*if(TakeProfitG <= 80 && req_sl != (atr_check[0]-50)) { request.sl=NormalizeDouble(atr_check[0]-50,_Digits); // putting new value of TakeProfit to the structure request.tp=NormalizeDouble(req_tp,_Digits); // sending request to trade server if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); }*/ } // processing short positions if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL) { StopLoss = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits) - atr_check[0]; TakeProfitL = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits) - req_tp - 100; TakeProfitG = NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits) - req_tp; if(StopLoss >= 50 && contOrdem==1) //StopLoss=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits)-100;else StopLoss = request.sl; { // putting new value of TakeProfit to the structure request.tp=NormalizeDouble(atr_check[0]-30,SYMBOL_DIGITS); request.volume=1; //request.sl=req_sl; request.action=TRADE_ACTION_SLTP; request2.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); request2.tp=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID)-80,_Digits); request2.volume=1; request2.sl=0; request2.type=ORDER_TYPE_SELL_LIMIT;//aqui precisa colocar LIMIT senao dá problema no expiration //atr_check[3]=tendence;//vendido contOrdem=contOrdem+1; sord2=true; // sending request to trade server //OrderSend(request,result); if (!OrderSend(request2,result)) PrintFormat("OrderSend Error %d",GetLastError()); if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); } //Check Ordens Pendentes - VENDE OU COMPRA DE ACORDO COM O VALOR QUE ESTÁ NA HORA, NAO PODE FICAR REQUEST PENDENTE if ((dt.hour==17 && dt.min==50))//atr_slow[0] > atr_slow[1]) { if (contOrdem==1) { request3.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request3.type=ORDER_TYPE_BUY_LIMIT; request3.volume=1; contOrdem=0; if (!OrderSend(request3,result)) PrintFormat("OrderSend Error %d",GetLastError()); } if (contOrdem==2) { request3.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request4.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request3.type=ORDER_TYPE_BUY_LIMIT; request4.type=ORDER_TYPE_BUY_LIMIT; request3.volume=1; request4.volume=1; contOrdem=0; if (!OrderSend(request3,result)) PrintFormat("OrderSend Error %d",GetLastError()); if (!OrderSend(request4,result)) PrintFormat("OrderSend Error %d",GetLastError()); } } /*if(TakeProfitL == 70) { request.sl=NormalizeDouble(req_sl,_Digits); // putting new value of TakeProfit to the structure request.tp=NormalizeDouble(req_tp+TakeProfitL,_Digits); // sending request to trade server if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); } if(TakeProfitG <= 80 && req_sl != (atr_check[0]+50)) { request.sl=NormalizeDouble(atr_check[0]+50,_Digits); // putting new value of TakeProfit to the structure request.tp=NormalizeDouble(req_tp,_Digits); // sending request to trade server if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); }*/ } // if there is an opened position, return from here... return; } } //--------------TESTES---------------------------------------------- if (dt.day == 02 && dt.hour == 12 && dt.min==25 && dt.sec==58){ bord=bord; } //--------------------------------------------------------------------- if(dt.hour>=StartHour && dt.hour!=MidHour && dt.hour<EndHour) { ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); if(bord==false && tendence==0 && diffCandles0 <= 100 && diffCompra>75 && diffMacd >=15 && diffMacd2 < diffMacd && tendenciaCandle2<=0 && total_percent <= -0.3 && atr_check[3] ==0 && (checkComprado==false || cont==0)) //&& check_vol==1 && atr_vol[0] >= 500)//&& diffVol>=500 { request.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); request.tp=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK)+50,_Digits); //request.sl=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK)-100,_Digits); request.type=ORDER_TYPE_BUY_LIMIT;//aqui precisa colocar LIMIT senao dá problema no expiration atr_check[0]=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); atr_check[3]=dt.min;//comprado //atr_check[2]=atr_fast[1]; atr_check[1]= tendence; cont=cont+1; contOrdem=contOrdem+1; bord=true; if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError()); } //NormalizeDouble(atr_fast[0],1)==NormalizeDouble(atr_slow[0],1) if(sord==false && tendence==1 && diffCandles0 <= 100 && diffVenda>75 && diffMacd >=15 && diffMacd2 < diffMacd && tendenciaCandle2>=0 && total_percent >= 0.3 && atr_check[3] ==0 && (checkComprado==false || cont==0))// && check_vol==0 && atr_vol[0] >= 500)//&& diffVol>=500 { request.price=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); request.tp=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID)-50,_Digits); //request.sl=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID)+100,_Digits); //request.expiration=TimeCurrent()+PERIOD_M30*60; request.type=ORDER_TYPE_SELL_LIMIT;//aqui precisa colocar LIMIT senao dá problema no expiration atr_check[0]=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); atr_check[3]=dt.min;//vendido //atr_check[2]=atr_slow[1]; atr_check[1]= tendence; cont=cont+1; contOrdem=contOrdem+1; sord=true; if (!OrderSend(request,result)) PrintFormat("OrderSend Error %d",GetLastError());sord=true; }} } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //IndicatorRelease(hSO); IndicatorRelease(hMACD); //IndicatorRelease(hBand); IndicatorRelease(hVol); } //+------------------------------------------------------------------+
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
My EA is trading without errors during tests.
When I enable automatic trading in production environment it does not do anything and it does not prompt any errors.
The only thing this EA is different from another ones is that it checks 64 other stock prices during every tick... is this a problem?
Here is a sample of my code: