For illustration purposes it's fine to use the Close, but bear in mind in real life you must use Adj Close, as the price series for the Close are distorted caused by dividends and splits.
Could you expand on the main reason/difference between using Close and Adj Close? I'm curious as to how/why it changes how you calculate the Open? (in general I always used Adj Close but now I'm questioning in which situations I should use it and when I shouldn't)
@@andreasklippinge9665 thanks, I'm aware of what it "is", but my initial question remains. How does it change what you need to do for the Open? (as mentioned in the video only briefly)
I wrote my thesis in momentum trading strategies. I think this is an misrepresentation of the concept. Momentum in this form relies on a portfolio of stocks rather than a single asset, both long and short, making it self financing. This is open to broad market risk. Also, you conveniently pick a stock that we all know went up significantly over the backrest period. It would be nice to see this on a portfolio of say 20 equities, as by then you diversify much of the market risk away. Still, great video, but needs more depth. Edit: I was talking about cross sectional momentum. Apologies!
As you mentioned: Different story but I have great news for you - I covered cross-sectional momentum on my 9 hour Python for Finance course :-) If you need a free option its also covered in the Python for Finance playlist.
Not a python expert here, but I feel like there's a bug in the logic. If you're setting "in_position" to True, and then immediately calculate the profit and set in_position back to false, you will "buy" on consecutive days, which presumably is not realistic/desired. But again, not a Python expert here....
@@jalexisg Incorrect. The "if not in_position" sets "in_position" to True and then the next "if in_position" sets it right back to false. That's the bug.
Doesn't have an impact, anyhow here you go: profits = [] in_position = False sellidx = pd.to_datetime('1900-01-01') buyprice = None # Initialize buyprice outside the loop for index, row in df.iterrows(): if not in_position and row.signal and index > sellidx: buyprice = row.buyprice in_position = True elif in_position: sellprice = row.Close # Assume the current row's Close price is used for selling sellidx = index profit = (sellprice - buyprice) / buyprice profits.append(profit) in_position = False
This was long time coming and an extremely important topic. Looking forward to the follow-up video for providing more guidance on it. Thank you.
Thanks mate!
always learn something new from you .... your approach towards solution is very precise..
thanks mate, delighted to read that :-)
Hopefully we get a cross-sectional momentum strat tutorial!
There already is a couple of them :-) Be invited to explore the Python for Finance playlist!
Thanks so much for the video man Very helpful
happy to read! Thx :-)
The 🐐, ty a ton for the teachings💖
Thank you mate, nice comment 😆
For illustration purposes it's fine to use the Close, but bear in mind in real life you must use Adj Close, as the price series for the Close are distorted caused by dividends and splits.
yessir! Also mentioning that in the vid btw
love your work, thanks
Love having you on board! thanks mate
amazing video!!
@@saxegothaea_conspicua thank you mate
When is the factoring video coming out?
Have too see, video is on the edge of becoming worth it. Will see what I can do!
i'm a beginner with all of this but it is possible to implement this strategy with your binance bot ?
it is!
Could you expand on the main reason/difference between using Close and Adj Close? I'm curious as to how/why it changes how you calculate the Open? (in general I always used Adj Close but now I'm questioning in which situations I should use it and when I shouldn't)
Adj Close adjusts for dividends/splits etc.
@@andreasklippinge9665 thanks, I'm aware of what it "is", but my initial question remains. How does it change what you need to do for the Open? (as mentioned in the video only briefly)
@@froggoman4756 ah, my bad.
Hi :-) You just need to adjust the Open by the same factor you adjusted the Close for.
this technique can apply for crypto market?
sure, go ahead! Let me know your insights
@@Algovibes I’m struggling when should we use momentum or mean reversion on the market
I wrote my thesis in momentum trading strategies. I think this is an misrepresentation of the concept. Momentum in this form relies on a portfolio of stocks rather than a single asset, both long and short, making it self financing. This is open to broad market risk. Also, you conveniently pick a stock that we all know went up significantly over the backrest period. It would be nice to see this on a portfolio of say 20 equities, as by then you diversify much of the market risk away. Still, great video, but needs more depth.
Edit: I was talking about cross sectional momentum. Apologies!
As you mentioned: Different story but I have great news for you - I covered cross-sectional momentum on my 9 hour Python for Finance course :-)
If you need a free option its also covered in the Python for Finance playlist.
Great
Thank you mate!
Not a python expert here, but I feel like there's a bug in the logic. If you're setting "in_position" to True, and then immediately calculate the profit and set in_position back to false, you will "buy" on consecutive days, which presumably is not realistic/desired.
But again, not a Python expert here....
The bot should buy only when in_position = False, so after buy in_position will be True and will hold True for 5 days.
@@jalexisg Incorrect. The "if not in_position" sets "in_position" to True and then the next "if in_position" sets it right back to false. That's the bug.
@@int2str Yes, it's a bug. I meant it "should" buy only if in_position = False.
Doesn't have an impact, anyhow here you go:
profits = []
in_position = False
sellidx = pd.to_datetime('1900-01-01')
buyprice = None # Initialize buyprice outside the loop
for index, row in df.iterrows():
if not in_position and row.signal and index > sellidx:
buyprice = row.buyprice
in_position = True
elif in_position:
sellprice = row.Close # Assume the current row's Close price is used for selling
sellidx = index
profit = (sellprice - buyprice) / buyprice
profits.append(profit)
in_position = False
❤❤❤😊
Sir great knowledge gained from you i have learnt a lot from you
@algovibes
Can you please make a video on Renko Trading Strategy backtest?
Happy to read man! Thanks a lot for the suggestion, will see what I can do.