-
Play videoPlease edit your post.
For large amounts of code, attach it.
datetime New_Time[1]; bool IsNewBar=false; int copied=CopyTime(_Symbol,_Period,0,1,New_Time);
Why use complicated functions, when you could use the predefined variable Time[1]?int Mybars=Bars(_Symbol,_Period);
Why use complicated functions, when you could use the predefined variable Bars?cciHandle1=iCCI(_Symbol,_Period,CCI_Period,PRICE_CLOSE,0); cciHandle2=iCCI(_Symbol,_Period,CCI_Period,PRICE_CLOSE,1);
Don't use misleading variable names. iCCI returns a double value not a handle.ticket=OrderSend(Symbol(),OP_SELL,Lot,Bid,1,Bid+STP*_Point,Bid-TKP*_Point,NULL,EA_Magic,0,clrNONE);
You buy at the Ask, sell at the Bid. Your stops should be relative to appropriate line. NULL is not a valid string; use ""int total=OrdersTotal(); if(total!=0)
This makes your EA incompatible with every other including itself on other charts and manual trading. Use an OrderSelect loop filtered by magic number and pair to count orders.if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==true)
Same.result=OrderClose(OrderTicket(),Lot,Ask,0,Red); return;
- Check your return codes What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- Use OrderLots()
- You can use OrderClosePrice() instead of Ask and be direction independent.
- Add print statements before your tests and print out the variable values and find out why.
WHRoeder,
I think meysam's problem is a more general problem with the Strategy Tester in recent builds of MT4.
I say this because I posted a question on Nov 6th entitled "Problem using Strategy Tester in Build 902" to which I received no replies. Here it is again:
"
Hi,
I'm going to quote a message from luxorlo about Build 902 that was posted on October 22nd:
"
I wrote a message in the 890 version section but I this has been deleted so I write here again the issue I have detected in build 890 hoping that this will be fixed in this new version, if not be aware of that because it's an important issue:
After build 890 was developed, the start up process with a file ( terminal.exe fili.ini) does not work because the terminal can't detect the expert advisor you are trying to use. Detect symbol, spread, model and dates, but not the ea. If you put the ea manually in the platform and launch again the process (closing the platform before of course) the genetic process does not work showing all results with 0 balance although the variables are changed as marked in the setup file (this can be watch in the optimization results in column inputs).
Could you please check it and fix this problem?
We all be very grateful as it's an option that most of us use to increase the speed of our work."
Well, 15 days have passed since then, but I'm still finding the same problem with Build 902. When you try to test an EA in the Strategy Tester, all the results have 0 balance and no trades are opened! The EA I'm testing is a simple, straightforward one that compiled perfectly and ran correctly in the Strategy Tester in Builds prior to 890.
Are other people finding this problem too?
Can MetaQuotes please resolve it as soon as possible.
Thank you.
~DVdear WHRoeder
thanks for your answer.
my problem is solved.
good luck
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
To whom it may be concern
I have successfully compiled my program without any error and I had results when I have checked my Program with Strategy tester until last week. But todays I have NO results! (No buy or sell signals) and also No error while I testing the program with EURUSD 5MIN charts.
Could you help me please to understand what the problem is?