You are using a classical Technical Analysis indicator named "Momentum"; instead of accessing it by a function call, you have merely expanded its guts into inline code. Here is a description of the indicator "Momentum" from a standard reference textbook: It saves a lot of space, and makes the system easier to understand, if we rewrite your rules 1 and 2 using the Momentum indicator: PHP: { rule 1 } If Momentum(Close, 750) > 0 then Buy; { rule 2 } If Momentum(Close, 750) < 0 then Sell; These give the same precise behavior as your rules (because they ARE your rules), but these are simpler to read and easier to understand.