Adding external series filter
Author: Carloseta
Creation Date: 8/5/2010 11:14 PM
profile picture

Carloseta

#1
Can someone add a filter to my script so that will only buy if QQQQ is above the 50 day moving average.
I just can't get it right.

Thanks

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

Eugene

#2
CODE:
Please log in to see this code.

You might want to move the AtClose exit above the AtStop one.
profile picture

Carloseta

#3
Thanks,
But I get this error:

error CS0029 @(13, 22} : Cannot implicitly convert type 'WealthLab.Bars' to 'WealthLab DataSeries'

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

Eugene

#4
Oops, my bad (was coding on-the-fly). Check out GetExternalSymbol in the QuickRef to find what was missing.
profile picture

Carloseta

#5
Do you sleep:)
profile picture

Eugene

#6
We (MS123 LLC) are Europe-based ;)
profile picture

Carloseta

#7
Optional parameter dataSetName ?

where does it go?
profile picture

Eugene

#8
Nope. GetExternalSymbol returns a Bars object while to build the QQQQ SMA series you need a DataSeries. Was:
CODE:
Please log in to see this code.

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

Cone

#9
Sorry about that edit. I just wanted to point out to casual readers like myself that the first statement is incorrect, as Eugene was explaining. GetExternalSymbol returns a Bars object, so it should be written as follows if that's what you intended:

CODE:
Please log in to see this 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).