for example, I want to buy break out (EMINI: ES), suppose it is 1 minute chart the logic is : buy break out when there is a 1 tick higer than the past 12 bars, stop at the previous low which is higher low. How to program these two actions? 1: open buy when there is new break out; 2: stop at the previous swing low which is a higher low. Thanks for any suggestions. Any specific codes will be really helpful. I plan to use IB as my broker.
IMO, you are taking the long way here - meaning, you are starting from a trading idea coming out of thin-air, going to spend long hours of programming, only to find-out it is unprofitable, and start all over again (& again & again). I would suggest instead to collect statistics, analyze them, and find repeating patterns with a "predictable" outcome. Of course, in order to collect statistic you will have to define what I call a "market-model", which is really up to you - from your chart example, you most likely want to define those high & low of interest, a notion of trend (up/down + possibly sideways). WRT data-points to collect, it is again up to you to define what you want to analyze, beyond the elements of your market-model. I have a webinar recording on my website, plus a couple more on the NinjaTrader Partners channel, in which I describe the basics of CL151 market-model. See if you can get any ideas between this post & the recordings.