2021年4月30日星期五

Find entry exit signal from time series data

I have a small time-series data :

ser = pd.Series([2,3,4,5,6,0,8,7,1,3,4,0,6,4,0,2,4,0,4,5,0,1,7,0,1,8,5,3,6])  

let's say if we choose a threshold of 5 to enter the market and zero to exit

I am trying to write a program which will generate an output like this :

enter image description here

so far I have used numba but still working on logic can you please help.

@numba.vectorize   def check_signal(x,t):      if x >= t :          y = 2      if x < t :          y =1       if x == 0:          y = -1      else :          y = y      return y   
https://stackoverflow.com/questions/67342820/find-entry-exit-signal-from-time-series-data May 01, 2021 at 12:14PM

没有评论:

发表评论