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:Quote from Hook N. Sinker:
Here is an example of a system that trades using price information. These are the rules:
1) Buy when yesterday's closing price price becomes greater than the price 750 sessions earlier.
2) Sell when yesterday's closing price price becomes less than the price 750 sessions earlier.
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:Quote from Omega Research "Easy Language User's Manual Version 4, p.224"
Function: Momentum(PRICE, LENGTH)
The Momentum study is an overbought/oversold oscillator. It is calculated by subtracting PRICE of the bar that occurred LENGTH bars ago, from the PRICE of the current bar.
PHP:
{ rule 1 } If Momentum(Close, 750) > 0 then Buy;
{ rule 2 } If Momentum(Close, 750) < 0 then Sell;
