Back to builder reference
Condition
eod_flattenexit
End-of-day flatten exit: the position is flat from N minutes before the session close until the close. At close - N (resolved against the DATE's real close, so a half-day flattens early instead of being missed) it closes the position and cancels any resting entry; entries decided in the window are skipped as policy:eod_flat_window. A daily/hourly entry filling at the open is flattened the same session. A scheduled entry at or after close - N is refused at compile. Attach it as its own exit. Equity only: refused for crypto (24h sessions have no close).
Category
Time & events
Discriminator
kind = "eod_flatten"
Roles
exit
Required fields
None.
Optional fields
FieldTypeDescription
flatten_minutes_before_closeintegerMinutes before session close at which to flatten, and from which the position stays flat until the close. Compiles to a scheduled exit at AnchorTrigger(close, -N) holding the flat window. Use at least 1 minute; 0 would require an official closing-auction print for market-on-close.kindstring-