PureBytes Links
Trading Reference Links
|
First convert the XAverage into it's equation then you can solve for
the price that will cause the averages to crossover.
The following indicator should plot the price at which a crossover
will occur on the next bar. The derivation is also included after the
EasyLanguage code.
Bob Fulks
---
Input: Length1(4), Length2(9);
Vars: F1(2 / (Length1 + 1)), F2(2 / (Length2 + 1)),
Ave1(Close), Ave2(Close), Price(Close);
Ave1 = F1 * Close + (1 - F1) * Ave1[1];
Ave2 = F2 * Close + (1 - F2) * Ave2[1];
Price = ((1 - F2) * Ave2 - (1 - F1) * Ave1) / (F1 - F2);
Plot1(Price, "1");
------
Derivation:
Vars: F1(2 / (Length1 + 1)), F2(2 / (Length2 + 1)),
Ave1(Close), Ave2(Close);
Ave1 = F1 * Price + (1 - F1) * Ave1[1];
Ave2 = F2 * Price + (1 - F2) * Ave2[1];
so for the next bar:
Ave1[-1] = F1 * Price[-1] + (1 - F1) * Ave1;
Ave2[-1] = F2 * Price[-1] + (1 - F2) * Ave2;
At crossover, Ave1[-1] = Ave2[-1] so:
F1 * Price[-1] + (1 - F1) * Ave1 = F2 * Price[-1] + (1 - F2) * Ave2
Price[-1] * (F1 - F2) = (1 - F2) * Ave2 - (1 - F1) * Ave1
Solve for Price[-1]:
Price[-1] = ((1 - F2) * Ave2 - (1 - F1) * Ave1) / (F1 - F2)
At 10:44 PM -0800 3/7/02, Daniel A. Poiree wrote:
>Hello all;
>
>I'm using the following code on end of day data for the XAverage Crossover
>Signal which I'm pretty sure is standard in 2000i:
>
>Input: Length1(4),Length2(9);
>IF CurrentBar > 1 and XAverage(Close,Length1) crosses above
>XAverage(Close,Length2) Then Buy on Close;
>IF CurrentBar > 1 and XAverage(Close,Length1) crosses below
>XAverage(Close,Length2) Then Sell on Close;
>
>Knowing that there a few known bugs in Omega's code, does anyone know if the
>XAverage function has any flaws?
>
>Also, for you more mathematically inclined, what code might you suggest for
>predicting tomorrows price that would cause a "crosses above(below)?" I'm
>sure that many users who use moving averages would find such a code useful
>for setting reversals assuming they aren't using the close for calculations.
>
>Thanks for all the help!
>
>Daniel Poiree
>Bellingham WA
|