# OPTN Ordinal Pattern Transition Networks in MQL5. Reads the shape of price movement rather than its level. Companion code for the MQL5 article: https://www.mql5.com/en/articles/23451 ## What it does An ordinal pattern is the rank order of a short run of prices. Three bars rising is one pattern, up then down is another. The values do not matter, only their order, which makes the representation immune to scaling and to slow drift. Treat each pattern as a node and each observed pattern-to-pattern move as an edge, and the series becomes a transition network. Three signals come out of that network: - efficiency, which is how directly the network moves between states - irreversibility, which is how asymmetric forward and backward transitions are, and therefore how far the series is from a reversible random process - the transition structure itself The article includes the reality check, which is tuning the signal on FX and reporting what it does and does not deliver there. ## Layout ``` Include/OPTN/OrdinalNetwork.mqh pattern extraction and the network Indicators/OPTN/OPTN_Efficiency.mq5 efficiency signal Indicators/OPTN/OPTN_Irreversibility.mq5 irreversibility signal Scripts/OPTN/OrdinalNetworkTest.mq5 correctness checks Scripts/OPTN/OrdinalNetworkSweep.mq5 parameter sweep ``` Run `OrdinalNetworkTest.mq5` first, then the sweep to pick parameters on your own symbol. ## Disclaimer Educational code. Past behaviour of any model or dataset says nothing about future results. Test on your own data and broker conditions before drawing conclusions.