Hello, I would like to add a primary function to a simple system I am trialing.
The rules shall determine if any stock can be traded. This is not a cross-over
intialisation but IIF the Index conditions are met, then any stock within the
universe will be traded with the main formula.
I don't know how to code this. It should start with a foreign function that
addresses the Index like this.
xao = Foreign("XAO", "Close");
The trick is that either the EMA or the DEMA allow the stock trades and this is
determined by one being above or below the other. This is the best I can
explain it. The rules are as follows:
When 250 DEMA is below 250 EMA :
#1) Enter any positions when an XAO Index day bar closes above 250 DEMA
#2) Exit all positions when an XAO Index day bar closes below 250 EMA
When 250 DEMA is above 250 EMA :
#1) Enter any positions when an XAO Index day bar closes above 250 EMA
#2) Exit all positions when an XAO Index day bar closes below 250 DEMA