I decided to simplify the rule for testing to

1) Open positions when Foreign function is above a moving average
2) Close all positions when Foreign function crosses a moving average

Thus

// Open stock positions //

X = Foreign("^AORD", "Close", 1) ; // AORD close is greater than DEMA
X1 = DEMA(X, 250);
X2 = X > X1;

// Close stock positions //

Y = Foreign("^AORD", "Close", 1); // AORD crosses below DEMA
Y1 = DEMA(Y, 250);
Y2 = Cross(Y1, Y);

Hope this helps anyone .  [=D>]

Reply via email to