@ab_trader Not sure if this is an issue since I did this a long time ago.... But when i was putting in stocks for an asx200 analysis going back a long time, some of the stocks didn't have data either at the beginning or the end. I had to at the time use pandas to fill in the beginning and ends with zeros before passing this into backtrader. Again, I was pretty green with backtrader then so not sure if this practice is necessary or not.
@Martin-Bouhier said in ZigZag based on Close Prices:
Hi Martin, I would suspect that you're either not using the same input data (ie. a moving average or smoother that is smaller and finer in the Metastock formula) or that the "percentage" input involves specifying a retracement perhaps before it counts as a peak or valley in that zig zag routine. Also I'm curious to know what the 5 in the "reversal" params specifies.
I don't like that python version. If there are repeated values at a peak, for example such as 200, 201, 201, 199, then it's possible for the code to entirely miss a peak.
@Pedro-Ivo-Paulo-da-Conceição said in Issues in run a strategy:
i'm new here and learning how to use this lib.
I would recommend you to start with the Quickstart Guide and samples in the Docs in this case, not with the fancy complex solutions of advanced coders.
In real life orders are executed by certain rules, bt simulates real life at its best. I've already gave you a link to types of orders, here is another link to Docs - Orders - Creation/Execution. You can choose type of order which will give you desirable results.
Just to provide an example,
strategy1 = cerebro.run()
st = strategy1
# To return something back from the strategy -
df = st.params.results # Will return your df back.
st.params.midmaperiod # will return back 20 and so on.
@Eduardo-De-La-Garza said in Get Highest and Lowest value of first 15 Minutes data:
Can you explain that line of code? When would they not be different?Thanks!
One minute date, checking for new date at the beginning of the day. :)
@soulmachine said in How to use two CommissionInfo inside a strategy?:
Since data has only one name, so it's not possible to apply multiple commission fees?
You're probably right. AFAIK a single commission could be specified per data name or default. As @run-out correctly mentioned - you may develop your custom commission scheme.
@Stefan-Krecher said in When and how to execute the first an only trade in a buy-and-hold strategy:
So what am I missing here?
bt executes the orders on the next bar open price since this is the next available price after the order is issued in the next() or nextstart().
Moving average values at the very beginning are not defined by the moving average definition. Therefore nothing can be shown. If you want to show moving average value on particular bar, than you need to have 21 bar before this.