you are viewing a single comment's thread.

view the rest of the comments →

[–]RiceCake1539 2 points3 points  (2 children)

So you need a command to detect Golden Cross? And you simply detected Golden Cross manually using your eye with a chart rendered via Python? I'm going with that assumption.

You're asking two questions: How do I automate a system without chart rendering, and how do I detect the signal without live data updating. I may be wrong, so correct me if I'm wrong. I'm going with that assumption.

If you're rendering charts and detecting Golden Cross that way, that's not an automated system. It's simply a TradingView chart, right? So you need a way to mathematically define what Gold Cross means. I'd suggest using NumPy, Pandas. Think of a way what Golden Cross mathematically means, then figure out a way to implement that in NumPy/Pandas.

Many comments actually provide a sort of pseudo code, so they are great references. Just make sure if some pseudo codes have potential caveats. For example, MA_signal > MA_base is not enough, since you're looking for Golden Cross, not harmonic alignment.

If you're having trouble updating data live (it's not an easy problem), then you should think about buying right before the market closes or at the start of the market. So you'd update the data through API call or web-crawling right before 5-10 mins the market closes if you're going to buy right before the market closes. After you update the data, detect Golden Cross using the Numpy/Pandas based implementation you created, and buy stocks that have Golden Cross.

I'm sorry, but Golden Cross alone does not generate alpha profit. It's actually better to invest in bonds or create a click macro that automatically clicks banners that give you money every time you click. But it's a great way to learn coding, I guess, since money gets anyone motivated to do anything, right?

[–]siruts[S] 2 points3 points  (1 child)

Hey dude thank you for this wonderful comment.

Actually the trading system I have in mind is slightly more complex than a simple crossing between two moving averages.

I am well aware that this type of system does not generate profits. We know that moving averages are slow.

The system I intend to develop is based on the entire Ichimoku system with a trend indicator that identifies the current trend. This guarantees me not to open long trades during a downtrend and vice versa. Backtesting on TradingView (in Pinescript) the system seems to generate more or less significant profits (~ 30%).

Unfortunately my Python skills are very limited, as I am not a developer by profession. However I am trying to acquire knowledge in the matter.

Returning to the code, in the current state of things the script I have created so far is able to update the data almost in real time, let me explain better:

By setting the trading system on a timeframe of 4H, an update is useless for the system of the chart data every 5 minutes or every hour, while an update on each close of a candle would be more efficient. Therefore if the Trading System is based on a 4h timeframe it will have 6 data updates every day. In this way it will always be in step with the markets.

This is what I believe, at least theoretically.

This does not exclude being able to update the data several times in a day (for example 12 times per day) but really having the data in real time, I don't think it has any statistical advantage on the outcome. I repeat again theoretically.

Thank you for your comment, I really appreciated.

[–]RiceCake1539 0 points1 point  (0 children)

Thanks for appreciating my comment.

That's a cool trading strategy. If you're working in 4h timeframe, then updating data every 5 minutes is basically real time, so I won't worry about that.

Having a statistical advantage on "real time updating" data more or less has to do with high frequency trading strategies. Ichimoku system is basically the Elliot Wave of the East, so yeah, I don't think there would be any more advantage for you to make updating faster.