Close above SMA in a DataSet
Author: 07nioe
Creation Date: 11/8/2018 1:27 PM
profile picture

07nioe

#1
Hi Eugene, I would like to know, how many symbols in a certain dataset have a close-price above SMA(200) - plotted as DataSeries in percentage terms. With index-lab it's easy to create. But I would prefer to code and implement the code in my strategy. Using foreach could be the right way. But this is all I know. Do you have some code snippets for me?

Thank you very much.

Best
Niels



profile picture

Eugene

#2
Hi Niels,

You're right, it's easy in Index-Lab to create and to refer to that index in Wealth-Lab via GetExternalSymbol. Not sure why you'd avoid I-L.

Nonetheless, you will find such code snippet right in the QuickRef > DataSetSymbols Property. It's exactly what you're looking for.
profile picture

07nioe

#3
Hi Eugene,

Thank you. I didn't know that you can refer to Index-Lab via GetExternalSymbol. But the lookback-period would be fix then, wouldn't it?
profile picture

Eugene

#4
Please refer to the User Guide. Under Index-Lab® > Using Indexes there's a short code sample.
profile picture

07nioe

#5
Okay, but how to control the lookback period or other parameter?
profile picture

Eugene

#6
You're right, the lookback period (or any other params of an I-L index) is fixed in this case. So the QuickRef sample code is the way to go in case you want to modify them interactively or in Strategy code.
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).