@Daniel-Martens-0 seems you are looking for the max adverse excursion. Check out this if the analyzer from the https://community.backtrader.com/topic/1274/closed-trade-list-including-mfe-mae-analyzer thread helps you.
Posts made by ab_trader
RE: Unrealized Trades Drawdown
RE: RSI Indicator and Real Time Data
it returns a tuple....
it returns the
line, array - Docs - Platform Concepts - Lines
the documentation isn't very complete, which value is the current value of the RSI? is it say, rsi, rsi etc....
documentation is very good, just try to read it. and it clearly gives an answer on your question. latest value is
self.rsi- Docs - Platform Concepts - Indexing: 0 and -1
my second question is if I wanted to get the real time daily data of the RSI what would I need to do ? is RSI still computed over a 14 day average if I'm looking at the daily data?
you need to pass real time price data to
rsi. If it will be daily bars and
periodwill be 14, than it will be 14 days RSI value.
and if so , which feeds do I need to implement to get the current rsi data?
depends on the broker you are going to use for live trading.
bthas implementation for
visual chart- Docs - Live Trading - Intro
RE: Interactive brokers - can't retrieve historical data
I don't think that you can easily get data for 2018 - 2019 with
ib. If I remember correctly, you should have several millions on the account and spend several thousands in commissions to get that deep. Google
ib historical data limitationsor something like this.
RE: Select highest value in a range only if the bar with the highest value passes a condition?
my 5 cents:
Script from @dasch will generate signals when
lowprices will break the boundaries of
channel built on
I'm making an indicator which requires me to select the highest value in a certain range only if that value is greater than the price channel high at that bar.
highest value of what? of the price? of the another indicator?
talking about prices - if you built the price channel on lows and highs, you can only check if current high/low is higher/lower than previous value because current value will be within the channel by definition:
self.highest = bt.ind.Highest(self.data.high, period=self.p.highperiod) self.up = self.data.high > self.highest(-1)
- This is a different story
I meant to say that if I have a range, and the highest high value in that range -->
Then only take it if the highest high value > Another Indicator I've defined at that bar.
So basically, in the below picture the line is the indicator. If there's no value above it, I don't want anything.
But if there are high values above it, then I want the highest high.
self.indicator = bt.ind.whatever_indicator_is_wanted() self.up = self.data.high > self.indicator
RE: Multiple stop loss issued
However, the trailpercent arg doesn't do a thing. It can be 0.1, it can be 1, or even 100
Just to clarify (Docs - Orders - StopTrail)
Percentage based distance: trailpercent=0.02 (i.e.: 2%)
You start with 0.1 which is 10% and your price range is much less than this value. You need to use much less % of stop in order to hit it before your
self.close()closes position in regular way.
You may want to add more logging into your script, this will help you to understand what is going on.
RE: Multiple stop loss issued
Looks like your first script with
StopTrailorders worked as expected. You used 25% stop from the price of order execution. Your first orders were executed at prices around 14.5 - 15.5 and you stops were set to approx 11.5 - 12.0. You can see them executed at that spike of the cash, 6 red triangles in a row.
RE: Leverage analysis with Pyfolio
Numbers you posted for sure make sense for you, but you may want to elaborate more if you really want some help. Leverage is a word used in different context differently by different traders. What is ADSK? What is gross_lev? You made some calcs, but didn't reveal them.
Just make simple thing: open one position, post prices and size, cash before and aft in
ib, post what you expect.
RE: Indicator that calculates the n-candle max of another indicator
MaxNindicator which returns what you want.