MetaTrader 4 Build 695 problem - page 2 123 New comment Jaume Torne 2014.09.18 04:04 #11 //+------------------------------------------------------------------+ //| Moving Average.mq4 | //| Copyright 2005-2014, MetaQuotes Software Corp. | //| https://www.mql4.com | //+------------------------------------------------------------------+ #property copyright "2005-2014, MetaQuotes Software Corp." #property link "https://www.mql4.com" #property description "Moving Average sample expert advisor" #define MAGICMA 20131111 //--- Inputs input double Lots =0.1; input double MaximumRisk =0.02; input double DecreaseFactor=3; input int MovingPeriod =12; input int MovingShift =6; //+------------------------------------------------------------------+ //| Calculate open positions | //+------------------------------------------------------------------+ int CalculateCurrentOrders(string symbol) { int buys=0,sells=0; //--- for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA) { if(OrderType()==OP_BUY) buys++; if(OrderType()==OP_SELL) sells++; } } //--- return orders volume if(buys>0) return(buys); else return(-sells); } //+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { double lot=Lots; int orders=HistoryTotal(); // history orders total int losses=0; // number of losses orders without a break //--- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //--- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //--- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1); } //--- return lot size if(lot<0.1) lot=0.1; return(lot); } //+------------------------------------------------------------------+ //| Check for open order conditions | //+------------------------------------------------------------------+ void CheckForOpen() { double ma; int res; //--- go trading only for first tiks of new bar if(Volume[0]>1) return; //--- get Moving Average ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0); //--- sell conditions if(Open[1]>ma && Close[1]<ma) { res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red); return; } //--- buy conditions if(Open[1]<ma && Close[1]>ma) { res=OrderSend(Symbol(),OP_BUY,LotsOptimized(),Ask,3,0,0,"",MAGICMA,0,Blue); return; } //--- } //+------------------------------------------------------------------+ //| Check for close order conditions | //+------------------------------------------------------------------+ void CheckForClose() { double ma; //--- go trading only for first tiks of new bar if(Volume[0]>1) return; //--- get Moving Average ma=iMA(NULL,0,MovingPeriod,MovingShift,MODE_SMA,PRICE_CLOSE,0); //--- for(int i=0;i<OrdersTotal();i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderMagicNumber()!=MAGICMA || OrderSymbol()!=Symbol()) continue; //--- check order type if(OrderType()==OP_BUY) { if(Open[1]>ma && Close[1]<ma) { if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,White)) Print("OrderClose error ",GetLastError()); } break; } if(OrderType()==OP_SELL) { if(Open[1]<ma && Close[1]>ma) { if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,White)) Print("OrderClose error ",GetLastError()); } break; } } //--- } //+------------------------------------------------------------------+ //| OnTick function | //+------------------------------------------------------------------+ void OnTick() { Print("Execution OK"); //--- check for history and trading if(Bars<100 || IsTradeAllowed()==false) return; //--- calculate open orders by current symbol if(CalculateCurrentOrders(Symbol())==0) CheckForOpen(); else CheckForClose(); //--- } //+------------------------------------------------------------------+ Jaume Torne 2014.09.18 04:06 #12 This expert is supplied by Metaquotessame thing happens with other experts Jaume Torne 2014.09.18 04:09 #13 this is an info I am giving you for free.consider that many users are thinking that heir experts are working, but they are not.take or live it.have a nice day. EURUSD - Trends, Forecasts Need EA with these Forex Signals Daily for Jaume Torne 2014.09.18 08:05 #14 from MetaQuotes Support Team: We found the issue and fixed it. The fxed version will be available in the next build of the MT4 terminal. Thank you for report.My replay:congrats Thank you Alain Verleyen 2014.09.18 09:17 #15 jtcash: from MetaQuotes Support Team: We found the issue and fixed it. The fxed version will be available in the next build of the MT4terminal. Thank you for report.My replay:congrats ThankyouGood, but I don't have this issue (last code you posted). Build 696.2014.09.18 11:15:20.586 Expert Forum\64806 AUDUSD,H1: loaded successfully2014.09.18 11:15:23.026 64806 AUDUSD,H1 inputs: Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3.0; MovingPeriod=12; MovingShift=6; 2014.09.18 11:15:23.036 64806 AUDUSD,H1: initialized2014.09.18 11:15:28.396 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:30.876 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:33.458 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:33.718 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:33.888 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:34.268 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:34.328 64806 AUDUSD,H1: Execution OKclick on "face" then OK.2014.09.18 11:15:34.568 64806 AUDUSD,H1: uninit reason 52014.09.18 11:15:34.568 64806 AUDUSD,H1: initialized2014.09.18 11:15:34.568 64806 AUDUSD,H1 inputs: Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3.0; MovingPeriod=12; MovingShift=6; 2014.09.18 11:15:35.708 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:36.058 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:36.718 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:39.210 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:40.120 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:41.390 64806 AUDUSD,H1: Execution OK2014.09.18 11:15:41.640 64806 AUDUSD,H1: Execution OKMetaEditor build is 979. static array ? ASCTrend system MetaTrader 4 platform beta Jaume Torne 2014.09.18 09:57 #16 same editorclick on the faceclick on inputsclick OK Syed Naufal Gaddafi 2014.09.18 10:53 #17 Make a simple ea and try it. See if the same problem persists or not. Jaume Torne 2014.09.18 11:12 #18 "From: MetaQuotes Support TeamSent: Thursday, September 18, 2014 09:59To: meSubject: Re: RE: RE: MetaTrader 4 Build 695 problem We found the issue and fixed it. The fxed version will be available in the next build of the MT4 terminal. Thank you for report."I have done my bestthere is nothing else to do Some restriction for display Errors, bugs, questions MetaTrader 5 not starting Jaume Torne 2014.09.18 11:13 #19 Moving Average.mq4 is very simple Jaume Torne 2014.09.18 11:14 #20 my experts have thousands of lines 123 New comment
This expert is supplied by Metaquotes
same thing happens with other experts
consider that many users are thinking that heir experts are working, but they are not.
take or live it.
have a nice day.
from MetaQuotes Support Team:
We found the issue and fixed it.
The fxed version will be available in the next build of the MT4 terminal.
Thank you for report.
My replay:
congrats
Thank you
from MetaQuotes Support Team:
We found the issue and fixed it.
The fxed version will be available in the next build of the MT4terminal.
Thank you for report.
My replay:
congrats
Thankyou
Good, but I don't have this issue (last code you posted). Build 696.
2014.09.18 11:15:20.586 Expert Forum\64806 AUDUSD,H1: loaded successfully
2014.09.18 11:15:23.026 64806 AUDUSD,H1 inputs: Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3.0; MovingPeriod=12; MovingShift=6;
2014.09.18 11:15:23.036 64806 AUDUSD,H1: initialized
2014.09.18 11:15:28.396 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:30.876 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:33.458 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:33.718 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:33.888 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:34.268 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:34.328 64806 AUDUSD,H1: Execution OK
click on "face" then OK.
2014.09.18 11:15:34.568 64806 AUDUSD,H1: uninit reason 5
2014.09.18 11:15:34.568 64806 AUDUSD,H1: initialized
2014.09.18 11:15:34.568 64806 AUDUSD,H1 inputs: Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3.0; MovingPeriod=12; MovingShift=6;
2014.09.18 11:15:35.708 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:36.058 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:36.718 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:39.210 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:40.120 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:41.390 64806 AUDUSD,H1: Execution OK
2014.09.18 11:15:41.640 64806 AUDUSD,H1: Execution OK
same editor
click on the face
click on inputs
click OK
"From: MetaQuotes Support Team
Sent: Thursday, September 18, 2014 09:59
To: me
Subject: Re: RE: RE: MetaTrader 4 Build 695 problem
We found the issue and fixed it.
The fxed version will be available in the next build of the MT4 terminal.
Thank you for report."
I have done my best
there is nothing else to do
Moving Average.mq4 is very simple