Thanks very much for the code Nicolas. I am going to test this code out further and see if it resembles the actual chart itself, at the moment I’m getting errors so am obviously doing something wrong but I will keep at it.
So like I thought, I’d have to include this chart type directly into the code. What I am looking to do initially is to code up the following :
- Create the (a) line break chart – variable (a) is the number of lines to draw (in the default case on prt charts it’s 3 but can be anything depending on timeframes of the chart.)
- Look for eg. 2/3/4/5 etc (b) consecutive up (green) or down (red) bars to fully form – variable (b) is number of bars to form and observe before trading
- Then at the open of the next bar go long or short in the direction of that trend with an attached x take profit (preferably trailing) and x stop loss. A total stop loss also needs to be applied when 2/3/4/5 bars (variable (c)) in the opposite direction have formed ie an established reversal of the current trend.
Am not sure what the results will be so this is just an initial idea and the code will need to be tweaked in order to accommodate different markets. But once I get a simple working version I can refine it more.
Also, I would like to create a simple screener that I can apply to equities, indices etc which tells me in real time when my target 3/4/5 bullish/bearish (a) line break bars have formed in any particular market. Not sure if this is also possible separately.
Many thanks for your help, it is much appreciated.