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

calculate Average entry price "Brakeven" #1245

esaesa started this conversation in Show and tell
Discussion options

As of today the library has no built in method to calculate average entry price. It is usually used in startegies like DCA and martiangle. use the followin code to calculate it

entry_price = self._broker.last_price / (1 + self.position.pl_pct)
# OR
entry_price = self._broker.last_price - (self.position.pl / self.position.size)

Then you can plot it with take profit to see a good overview how your startegy is going
image
Take care that that values are updated after next() cycle as simulating broker execusion. You can keep track manually but the above method is aligned with our library logic and accuracy
I am open for discussion

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

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