Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Customized indicator #1029

Unanswered
jeff1228 asked this question in Q&A
Jul 23, 2023 · 1 comments · 1 reply
Discussion options

Hi group,

I am new to coding, I am trading SPX, and want to create an indicator using VIX and VIX3M, which means the trading signal is not deprived from SPX itself, it's from VIX index. I came up with the code below, but seems not woking, can someone please take a look and shed some lights here?

def indicator():

vratio = ta.hma(dfVIX.Close/dfVIX3M.Close, 3)
return 

class SignalStrategy(Strategy):

def init(self):
 self.mysignal = self.I(indicator)
def next(self):
 if not self.position and crossover(self.mysignal,1):
 
 self.buy()
 
 elif crossover(1,self.mysignal):
 self.position.close()

Don't have a clue what's wrong!

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Is "ta" pandas-ta?
vratio = ta.hma(dfVIX.Close/dfVIX3M.Close, 3)

You must be logged in to vote
1 reply
Comment options

Would like a follow-up to this for TA-Lib and Pandas-TA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /