Initialize parameters and constants
Initialize data buffers for multiple timeframes
Initialize historical performance record
For each new bar:
For each timeframe in {Fast, Medium, Slow}:
Update price buffer
Compute AbstractMetric_A[timeframe] // e.g., some transformation of price history
Compute AbstractFeatureSet1 from AbstractMetric_A and other transformations
RawSignal ? AbstractDecisionFunction1(AbstractFeatureSet1)
ModelInput1 ? AbstractFeatureSet1
[ProbLong, ProbShort] ? Model1(ModelInput1)
AdjustedSignal ? AbstractSignalFilter(RawSignal, ProbLong, ProbShort)
Update performance history from closed trades
Compute AbstractFeatureSet2 from AbstractMetric_A and performance statistics
ModelInput2 ? AbstractFeatureSet2
[StopMultiplier, TakeProfitMultiplier] ? Model2(ModelInput2)
Constrain StopMultiplier, TakeProfitMultiplier to allowable ranges
StopDistance ? AbstractVolatilityMeasure * StopMultiplier
TakeProfitDistance ? AbstractVolatilityMeasure * TakeProfitMultiplier
If in training mode:
Execute trades based on RawSignal
Else:
Execute trades based on AdjustedSignal
Plot monitoring metrics (non-trading)