Well the algorithm of writing trading algorithm is the following (as I see it). - Pick a set of rules according to which a trade should be executed/closed. It can be some some mix of technical indicators, price patterns TESTED ON HISTORY (the more is the better). - Answer the question: Do I want to automate it? i.e. spent time on something else, while algorithms will place orders instead of me 24/5/365. - IF yes, code it! - Test on history - If your winning ratio is higher than 60% and drawdown is low then I think you can go live.