Anti-Patterns
Wrong vs right examples for strategy authoring — build_trade_frame misuse, MTF placement errors, and best starter paths.
Wrong vs Right for Strategy Authoring#
build_trade_frame misuse#
# Wrong: build_trade_frame becomes a second compute stage.
def build_trade_frame(signal_df, params=None, styles=None):
frame = signal_df.copy()
frame["sl"] = frame["close"] - ta.atr(frame["high"], frame["low"], frame["close"], 14)
return build_mapped_trade_frame(frame)
# Right: compute all strategy intent first, then map only.
def build_signal_frame(df, params=None):
frame = df.copy().reset_index(drop=True)
atr = ta.atr(frame["high"], frame["low"], frame["close"], 14)
frame["sl"] = frame["close"] - atr
return frame
def build_trade_frame(signal_df, params=None, styles=None):
return build_mapped_trade_frame(signal_df)MTF filter placement#
# Wrong: HTF confirmation is delayed into mapping.
# Right: request.security is part of signal logic and belongs with entries.Practical test: if you can explain your strategy only by reading build_signal_frame, the design is
healthy. If the behavior is split across both builders, the contract is already drifting.
Best Starter Paths#
Follow this progression to build confidence with the canonical patterns: