거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
당사 팬 페이지에 가입하십시오
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
- 조회수:
- 2465
- 평가:
- 게시됨:
- 2020.10.21 12:15
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
//+------------------------------------------------------------------+ //| 201021_113117.mq5 | //| 2019-2020, dimitri pecheritsa | //| 792112@gmail.com | //+------------------------------------------------------------------+ // from: design patterns: elements of reusable object-oriented software // by: gof: erich gamma, richard helm, ralph johnson, john vlissides // published in 1994 //+------------------------------------------------------------------+ //| iterator - behavioral design pattern | //+------------------------------------------------------------------+ // provide a way to access the elements of an aggregate object // sequentially without exposing its underlying representation //+------------------------------------------------------------------+ //| applicability | //+------------------------------------------------------------------+ // access an aggregate object's contents without exposing its // internal representation // support multiple traversals of aggregate objects // provide a uniform interface for traversing different aggregate // structures (that is, to support polymorphic iteration) //+------------------------------------------------------------------+ //| structure | //+------------------------------------------------------------------+ // // | Aggregate |<------|Client|------->| Iterator | // |----------------| |-------------| // |CreateIterator()| |First() | // ^ |Next() | // | |IsDone() | // | |CurrentItem()| // | ^ // | | //| Concrete |- - - - - - - ->|Concrete| //| Aggregate |<---------------|Iterator| //|----------------------------------| //|CreateIterator() | //| return new ConcreteIterator(this)| // //+------------------------------------------------------------------+ //| participants | //+------------------------------------------------------------------+ // iterator // defines an interface for accessing and traversing elements // aggregate // defines an interface for creating an iterator object // concrete iterator // implements the iterator interface // keeps track of the current position in the traversal of the // aggregate // concrete aggregate // implements the iterator creation interface to return an // instance of the proper concrete iterator //+------------------------------------------------------------------+ //| collaborations | //+------------------------------------------------------------------+ // a concrete iterator keeps track of the current object in the // aggregate and can compute the succeeding object in the traversal | //---iterator participants #include <Mqh\201021_104101.mqh> //iterator #include <Mqh\201021_104329.mqh> //aggregate #include <Mqh\201021_104505.mqh> //concrete iterator #include <Mqh\201021_104755.mqh> //concrete aggregate //--- void OnStart() { Aggregate<string>* aggregate=new ConcreteAggregate; aggregate+="element a"; aggregate+="element b"; aggregate+="element c"; aggregate+="element d"; //--- Iterator<string>* iterator=aggregate.CreateIterator(); for(iterator.First(); !iterator.IsDone(); iterator.Next()) { Print(iterator.CurrentItem()); } //--- delete aggregate; delete iterator; } //+------------------------------------------------------------------+ //| output | //+------------------------------------------------------------------+ // first iteration of aggregate // element a // next iteration of aggregate // element b // next iteration of aggregate // element c // next iteration of aggregate // element d //+------------------------------------------------------------------+ //| consequences | //+------------------------------------------------------------------+ // it supports variations in the traversal of an aggregate // to change the traversal algorithm just replace the iterator // instance with a different one // you can also define iterator subclasses to support new traversals // iterators simplify the aggregate interface // more than one traversal can be pending on an aggregate //+------------------------------------------------------------------+ //| implementation | //+------------------------------------------------------------------+ // who controls the iteration? // who defines the traversal algorithm? // how robust is the iterator? // additional iterator operations // using polymorphic iterators in c++ // iterators may have privileged access // iterators for composites // null iterators //+------------------------------------------------------------------+
![DayPivotPoint MT5](https://c.mql5.com/i/code/indicator.png)
Indicator DayPivotPoint System with Signal and Alert for MetaTrader 5
![Interpreter - behavioral design pattern](https://c.mql5.com/i/code/library.png)
Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language
![Identify the potential best TIME To Trade (Improve your Strategy) - MT5](https://c.mql5.com/i/code/script.png)
For day traders, this is one of the important thing to consider in order to improve our strategy by calculating on average how much an asset moves, in which it will allow us to identify the best TIME during the day to trade when the market moves the most as well
![Mediator - behavioral design pattern](https://c.mql5.com/i/code/library.png)
Define an object that encapsulates how a set of objects interact mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently