Buying price in next()
-
Re: How can I get the price at which buy executed?
Hi guys,
could you please give an example how 'to keep a reference to the order notified in notify_order, to later use it in next' (@backtrader)?
I would like to do calculations with the buying price in the next() method.Thank you in advance!
-
My very sincere advice: if you don't know how to keep a reference in a class to a value, you need to really work on the very basics of programming. And work a lot.
It may seem very tempting to get a straight answer and go and develop a winning strategy: you won't develop any winning strategy, because so far you cannot program (which doesn't mean you cannot learn and be very good at it) and your code will be like a minefield.
But if you wish you can google it ... or even go to Stackoverflow where someone had the same problem (which isn't really a problem)
Choose your own path.
-
@backtrader
Thank you for your answer.
I should have asked my question in a different way. I do know how to keep a reference in a class to a value but somehow it was not working in my code. Your answer opened my eyes: since I know how to program, the cause of error must have been somewhere else, not in the referencing method, so I could correct the code.