Indicator for detecting support and resistance #743
Replies: 3 comments 1 reply
-
Hi, |
Beta Was this translation helpful? Give feedback.
-
Hi,
I tried the following code from within the next routine.
print("current iteration=",len(Strategy.data))
and got the following error message.
TypeError: object of type 'property' has no len()
(
What am I doing wrong?
From: kernc ***@***.***>
Sent: Tuesday, March 14, 2023 2:46 PM
To: kernc/backtesting.py ***@***.***>
Cc: pranavlal ***@***.***>; Comment ***@***.***>
Subject: Re: [kernc/backtesting.py] Indicator for detecting support and resistance (Discussion #743)
<https://kernc.github.io/backtesting.py/doc/backtesting/backtesting.html#backtesting.backtesting.Strategy.data&gsc.tab=0> len(Strategy.data) is incremented on every next() iteration and indicates the number of bars up to now. Hope this helps.
—
Reply to this email directly, view it on GitHub <#743 (reply in thread)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACCF2A7UCIGXJ6ZJMEDGIN3W4AZOLANCNFSM6AAAAAAQKZE2KA> .
You are receiving this because you commented. <https://github.com/notifications/beacon/ACCF2A7SNQ4MBBKA4TLBXHDW4AZOLA5CNFSM6AAAAAAQKZE2KCWGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAKDRLM.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
Hi all, Here is the code I have so far. I am not sure if my logic of calculating the support and or resistance price for the current closing price works. [code] dateparse = lambda x: datetime.strptime(x, '%Y-%m-%d %H:%M:%S') #To handle hourly data in pandas
def isSupport(df,i):
class candlestickAdx(TrailingStrategy):
df=pd.read_csv("./ohlc/hourly/SBIN.csv",parse_dates=['date'], index_col=['date'],date_parser=dateparse) #Run the candlestick recognition routines before back-testing bt = Backtest(df, candlestickAdx, commission=.002,exclusive_orders=True,cash=30000) opt=bt.optimize(take_profit_factor=range(2,3),stop_loss_factor=range(1,3),atr_period=range(14,22),rsi_lookback=range(10,40),stochastic_period=range(14,30),maximize='Equity Final [$]',random_state=0,max_tries=300) [/code] |
Beta Was this translation helpful? Give feedback.
-
has anybody been able to comeup with a code for detecting market key levels , then intergrate it within the backtesting.py framework for testing?
Beta Was this translation helpful? Give feedback.
All reactions