Good article. Thank you.
Good article. Thank you.
Afternoon!
In the CSimpleRandom.mqh file, the author omitted the creation of an object of CPositionInfo class
82 строчка m_positionInfo=new CPositionInfo();
Without it, the Expert Advisor generated the error invalid pointer access in 'CSimpleRandom.mqh' .
Or did he omit it on purpose so that beginners could practice? If yes, he succeeded =)
Without it, the Expert Advisor generated the error invalid pointer access in 'CSimpleRandom.mqh'
Or did he omit it on purpose so that beginners could practice? If yes, he succeeded =)
In the CSimplrRandom class file you suggest to create an object of the same class? That's not correct.
See the file \MQL5\Experts\Expertsimplerandom.mq5. It contains the creation of an object of this class. Line 23:
//+------------------------------------------------------------------+ //|ExpertSimpleRandom.mq5 | //|Copyright © 2013, Jordi Bassagaças | //+------------------------------------------------------------------+ #property copyright "Copyright © 2013, laplacianlab" #property link "http://www.mql5.com/en/articles" #property version "1.00" #include <Trade\Trade.mqh> #include <Trade\SymbolInfo.mqh> #include <Trade\PositionInfo.mqh> #include <Indicators\Indicators.mqh> #include <Mine\Enums.mqh> #include <..\Experts\SimpleRandom\CSimpleRandom.mqh> input int StopLoss; input int TakeProfit; input double LotSize; input ENUM_LIFE_EA TimeLife; MqlTick tick; CSimpleRandom *SR=new CSimpleRandom(StopLoss,TakeProfit,LotSize,TimeLife); //+------------------------------------------------------------------+ //| Initialisation function| //+------------------------------------------------------------------+
Compile and run the Expert Advisor \MQL5\Experts\Expertsimplerandom.mq5.
Without it, the Expert Advisor generated the error invalid pointer access in 'CSimpleRandom.mqh'
Or did he omit it on purpose so that beginners could practice? If yes, he succeeded =)
The article files have been reuploaded. Thanks for the message.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Another MQL5 OOP class is published:
This article shows you how to build an Object-Oriented Expert Advisor from scratch, from conceiving a theoretical trading idea to programming a MQL5 EA that makes that idea real in the empirical world. Learning by doing is IMHO a solid approach to succeed, so I am showing a practical example in order for you to see how you can order your ideas to finally code your Forex robots. My goal is also to invite you to adhere the OO principles.
Building a complete object-oriented EA that actually works is in my humble opinion a challenging task which requires many skills all put together: logical reasoning, divergent thinking, capacity for analysis and synthesis, imagination, etc. Let's say that if the automated trading system that we have to solve was a game of chess, its trading idea would be the chess strategy. And the execution of the chess strategy through tactics would be the programming of the robot through the use of technical indicators, chart figures, fundamental economic ideas and conceptual axioms.
Author: Jordi Bassaganas