- You have not provide any source code. Attach the the file!
- Are you trying to test it on a live trading (hopefully on demo account) or are your referring to Strategy Tester.
- What symbol? What timeframe? What inputs are you using? etc.
- Show us the log output! Have you checked your Experts Log (if live trading) or the Journal log (live or Strategy Tester)?
- Provide more details if you want a serious answer!
- You have not provide any source code. Attach the the file!
- Are you trying to test it on a live trading (hopefully on demo account) or are your referring to Strategy Tester.
- What symbol? What timeframe? What inputs are you using? etc.
- Show us the log output! Have you checked your Experts Log (if live trading) or the Journal log (live or Strategy Tester)?
- Provide more details if you want a serious answer!
I sent with a file, but it failed the first time, it looks like EA'n trade the wrong way, I'm new to mql5 oop, but I'm trying to learn.
//+------------------------------------------------------------------+ //| Indicators.mqh | //| Christer Lundqvist| //| http://www.expertAdvisor.com | //+------------------------------------------------------------------+ #property copyright "Crister Lundqvist" #property link "http://www.expertAdvisor.com" #define MAX_COUNT 100 //+------------------------------------------------------------------+ //| Base Class | //+------------------------------------------------------------------+ class CIndicator { protected: int handle; double main[]; public: CIndicator(void); double Main(int pShift=0); void Release(); virtual int Init() { return(handle); } }; CIndicator::CIndicator(void) { ArraySetAsSeries(main,true); } double CIndicator::Main(int pShift=0) { CopyBuffer(handle,0,0,MAX_COUNT,main); double value = NormalizeDouble(main[pShift],_Digits); return(value); } void CIndicator::Release(void) { IndicatorRelease(handle); } //+------------------------------------------------------------------+ //| Moving Average | //+------------------------------------------------------------------+ /* CiMA MA; sinput string MA; // Moving Average input int MAPeriod = 10; input ENUM_MA_METHOD MAMethod = 0; input int MAShift = 0; input ENUM_APPLIED_PRICE MAPrice = PRICE_CLOSE; MA.Init(_Symbol,_Period,MAPeriod,MAShift,MAMethod,MAPrice); MA.Main() */ class CiMA : public CIndicator { public: int Init(string pSymbol,ENUM_TIMEFRAMES pTimeframe,int pMAPeriod,int pMAShift,ENUM_MA_METHOD pMAMethod,ENUM_APPLIED_PRICE pMAPrice); }; int CiMA::Init(string pSymbol,ENUM_TIMEFRAMES pTimeframe,int pMAPeriod,int pMAShift,ENUM_MA_METHOD pMAMethod,ENUM_APPLIED_PRICE pMAPrice) { handle = iMA(pSymbol,pTimeframe,pMAPeriod,pMAShift,pMAMethod,pMAPrice);
You have provided very little information in order to answer "what's missing in this EA, it does not trade", but you say the project consists of 5-6 files, and claim "I'm new to mql5 oop".
That is way too much code for us to analyse for such a vague question. We are not going to debug so much of your code for you.
Do some debugging of your own. Print out values to your log files and narrow down the problem.
I've tried, but the EA's trading in the wrong direction, I can not see what's wrong, I do not get anything that says it's wrong, I who thought I was so good that I bought book, which I have translated into Swedish from English.
- You are using a Template File form the Source Code for Andrew Young's book, yet you failed to say anything about that in your original post. Luckily, I have the book too and the library source, otherwise I would not have been able to compile or test it since you were missing files.
- You are using the older code for the source. You should update it to the revised version of the author's code, available from his website.
- Your original post stated that it did not trade, yet now you say it is trading in the wrong direction. I tested it in the Strategy Tester and it does trade.
- There is nothing wrong with the EA, but obviously that it is "trading in the wrong direction"! It is a TEMPLATE EA file for you to fill in with your own strategy. All it does is just open a trade continuously because it is just an empty example TEMPLATE.
In other words, you have coded nothing! All the code supplied is just the standard code for the book. Nothing else.
The EA is just a template! You have not changed anything in it. As it stands, it just continually places orders. That is all, and it is working just fine in the tester.
So, read the book properly from begin to end and follow the examples and learn from it. Complaining that the sample TEMPLATE EA does not do what you want is foolish if you don't make any changes to it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use