Self-test of mp80_spec.md, 2026-11-13T08:27:58.187Z ok TPO profile by hand: POC 100.75 (tie to the middle of the range), value area 100.25..101.25 - {"poc":100.75,"vah":101.25,"val":100.25,"share":0.8333333333333334,"width":1} ok volume profile by hand: POC 100.75 (tie to the VWAP), value area 100.25..101.25 - {"poc":100.75,"vah":101.25,"val":100.25,"share":0.8043478260869565,"width":1} ok value area: a tie between the pairs adds both (100.25..101.75; one side first would give 100.75..101.75) - {"poc":100.75,"vah":101.75,"val":100.25,"share":0.9333333333333333,"width":1.5} ok the same profile one row at a time differs (the test can see the rule) - {"poc":100.75,"vah":101.5,"val":100.25,"share":0.8,"width":1.25} ok short, close reading: two closes inside, entry at the next minute open, stop 1 tick above the session high, target the VAL - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":-1,"entryT":28414711,"exitT":28414780,"entry":106,"exit":100,"stop":112.75,"target":100,"R":6.75,"T":6,"gross":300,"pnl":269.24,"reason":"target","tod":631,"openFill":true,"accK":1,"open":112,"vah":110,"val":100,"poc":105,"width":10,"inT":631,"outT":700} ok short, print reading: period 0 printed inside, entry at the open of the first minute of period 1 - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":-1,"entryT":28414681,"exitT":28414780,"entry":107,"exit":100,"stop":112.75,"target":100,"R":5.75,"T":7,"gross":350,"pnl":319.24,"reason":"target","tod":601,"openFill":true,"accK":1,"open":112,"vah":110,"val":100,"poc":105,"width":10,"inT":601,"outT":700} ok stop by range fills at the stop ok a minute opening beyond the stop fills at its open ok stop and target in the same minute: the stop ok no stop or target: out at the close of the 16:00 minute ok 13:15 session: out at the close of the 13:15 minute ok an open exactly at the VAH is no setup ok a broken pair (inside, outside, inside, inside): entry after the second pair - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":-1,"entryT":28414771,"exitT":28415040,"entry":107,"exit":107,"stop":112.75,"target":100,"R":5.75,"T":7,"gross":0,"pnl":-30.76,"reason":"close","tod":691,"openFill":true,"accK":3,"open":112,"vah":110,"val":100,"poc":105,"width":10,"inT":691,"outT":960} ok the value area already crossed before the entry: no trade ok entry at/beyond the stop: no trade, and no later acceptance is taken ok a pair whose second period ends the session: no trade ok print reading: a minute opening above the VAH fills at the VAH - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":-1,"entryT":28414681,"exitT":28415040,"entry":110,"exit":109,"stop":112.75,"target":100,"R":2.75,"T":10,"gross":50,"pnl":19.24,"reason":"close","tod":601,"openFill":false,"accK":1,"open":112,"vah":110,"val":100,"poc":105,"width":10,"inT":601,"outT":960} ok print reading: in a minute filled at the edge only the stop is checked (its low below the VAL is not a target fill) - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":-1,"entryT":28414681,"exitT":28415040,"entry":110,"exit":105,"stop":112.75,"target":100,"R":2.75,"T":10,"gross":250,"pnl":219.24,"reason":"close","tod":601,"openFill":false,"accK":1,"open":112,"vah":110,"val":100,"poc":105,"width":10,"inT":601,"outT":960} ok the same day, close reading: period 0 closed outside, so the pair is periods 1 and 2 ok long: the mirror image (open below the VAL, target the VAH) - {"date":"2024-01-10","day":19732,"prevDate":"prev","dir":1,"entryT":28414711,"exitT":28414780,"entry":103,"exit":110,"stop":97.25,"target":110,"R":5.75,"T":7,"gross":350,"pnl":319.24,"reason":"target","tod":631,"openFill":true,"accK":1,"open":98,"vah":110,"val":100,"poc":105,"width":10,"inT":631,"outT":700} ok one period of acceptance (a mutation) enters after period 0 ok calendar: MLK day skipped, the next session uses the Friday before; the day after Thanksgiving ends at 13:15 - 2024-01-12 960, 2024-01-16 960, 2024-11-29 795 data: 2378027 minutes, 1691 regular sessions (reference: 1691) ok sessions: the engine (rb_lib calendar) and the reference (its own NYSE lists) find the same regular sessions ok value areas (TPO and volume) equal to the reference on every session - 3382 compared, 0 differences ok MP80-TC: engine = reference, trade by trade - engine 270, reference 270, differences 0 ok MP80-TC: every trade's direction, target, stop and entry follow the rules - 0 problems ok MP80-TC: the control at offset 0 = the real trades (open fills only; edge fills enter at that minute's open) ok MP80-TP: engine = reference, trade by trade - engine 519, reference 519, differences 0 ok MP80-TP: every trade's direction, target, stop and entry follow the rules - 0 problems ok MP80-TP: the control at offset 0 = the real trades (open fills only; edge fills enter at that minute's open) ok MP80-VC: engine = reference, trade by trade - engine 278, reference 278, differences 0 ok MP80-VC: every trade's direction, target, stop and entry follow the rules - 0 problems ok MP80-VC: the control at offset 0 = the real trades (open fills only; edge fills enter at that minute's open) ok mutation detected: one period of acceptance instead of two - MP80-TC 436 differences, MP80-TP 568 differences, MP80-VC 438 differences ok mutation detected: the target at the POC instead of the opposite edge - MP80-TC 270 differences, MP80-TP 518 differences, MP80-VC 277 differences ok mutation detected: rows added one at a time - MP80-TC 231 differences, MP80-TP 517 differences, MP80-VC 171 differences ok mutation detected: the stop without its extra tick - MP80-TC 43 differences, MP80-TP 138 differences, MP80-VC 53 differences PASSED