# IntrinsicTime The directional-change operator, the intrinsic-time scaling laws, and the Alpha Engine coastline trader, implemented in MQL5. Companion code for the MQL5 article: https://www.mql5.com/en/articles/23814 ## What it does Physical time is an arbitrary clock for a market. Intrinsic time replaces it: the clock only ticks when price reverses by a fixed threshold, so quiet periods compress and active ones stretch. That reframing comes with published scaling laws, which are empirical regularities relating threshold size to event counts and move lengths. The article verifies them on live ticks rather than taking them on trust, which is what `DcOS_ScalingLaws.mq5` is for. If your broker's feed does not reproduce them, nothing built on top will behave as advertised. The Alpha Engine is the trading side: coastline trading works the reversals, scaling into positions as the coastline extends, with liquidity and inventory management around it. `AlphaEngine.mq5` is the Expert Advisor. ## Layout ``` Include/IntrinsicTime/DcTypes.mqh directional-change types Include/IntrinsicTime/DcOperator.mqh the DC operator Include/IntrinsicTime/ScalingLaws.mqh scaling-law measurement Include/IntrinsicTime/AeTypes.mqh Alpha Engine types Include/IntrinsicTime/AeAlphaEngine.mqh the engine Include/IntrinsicTime/AeCoastlineTrader.mqh coastline position logic Include/IntrinsicTime/AeLimitOrder.mqh order handling Include/IntrinsicTime/AeLiquidity.mqh liquidity model Include/IntrinsicTime/AeLiveTrader.mqh live execution layer Include/IntrinsicTime/AeRunner.mqh run harness Experts/IntrinsicTime/AlphaEngine.mq5 the Expert Advisor Scripts/IntrinsicTime/DcOS_SelfTest.mq5 DC operator checks Scripts/IntrinsicTime/DcOS_ScalingLaws.mq5 scaling laws on live ticks Scripts/IntrinsicTime/Ae_SelfTest.mq5 engine checks Scripts/IntrinsicTime/Ae_RandomWalk.mq5 behaviour on a random walk ``` Run the two self-tests first, then the scaling-law script on your own feed. ## 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.