Entry condition depending on external symbol's strengh
Author: 07nioe
Creation Date: 9/23/2014 12:24 PM
profile picture

07nioe

#1
Hi,

is it possible to add an entry condition depending on how the market moves? For example: if the S&P500 is aproaching its highest High of the last 40 day (5% below), use Close> EMA40 as a further filter for the stocks. If the market is still far away from its highest high (more than 5% below), trade without Close>EMA40. The intention is to pick up only the strong stocks in the highest High area.

Thank you again

Best
Niels
profile picture

Eugene

#2
Yes it's possible. If you still haven't reviewed QuickRef (GetExternalSymbol) / WealthScript Programming Guide (DataSeries > Accessing Secondary Symbols), it's about time.

Note: takes at least 120 bars of data to be loaded (for the whys and whereabouts please refer to the WS Guide > Indicators > Stability of Indicators).

CODE:
Please log in to see this code.
profile picture

07nioe

#3
Hi Eugene,

Thanks a lot for the code. But I think the bool condition should be as following:

CODE:
Please log in to see this code.


The EMA40 ought to be used additionally as an entry condition if extHigh[bar] is within the area of market reprieve. Am I wrong?

Best
Niels
profile picture

Eugene

#4
QUOTE:
But I think the bool condition should be as following:

That's right Niels. Typo has been corrected. Thanks.

QUOTE:
The EMA40 ought to be used additionally as an entry condition if extHigh[bar] is within the area of market reprieve. Am I wrong?

This is what the code is doing.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).