BlueBloodedTrader wrote:UPDATE REQUEST
Would it be possible to have this indicator working on a basis where it doesn't include the current candle (so a linear regression channel based on candles n-x to n-1) and then incorporate a breakout strategy on this indicator so that if the current candle (not included in the regression calculation) breaks out of either the upper or lower limit then a trade is entered?
This is exactly what I also wanted, I think I managed to make it work. Keep in mind the following:
For a 2 candle period, lets consider the last 4 candles:
n is the current (still running) one: the lines are drawn up to this candle so you see if there will be a break out or not; it is not taken into account for the calculations though
n-1 and n-2: these are the candles used for the calculations
n-3: the line is also drawn till that but it is not taken into account for the calculations; I could not remove it so I just kept it and just ignore it.
I have also added two output streams, one for tilt and one for break out:
tilt: -1 for downslope, 0 for horizontal, 1 for upslope
break out: 1 for breaking top line, -1 for breaking bottom line, 0 for not breaking either
When the current candle closes, keep in mind that:
- break out is calculated if the close value of the CURRENT candle is higher/lower than the top/bottom lines at the CURRENT candle period
- THEN the standard deviation is calculated and then tilt is calculated considering candles
n and
n-1 (which are to become
n-1 and
n-2)
- THEN the new top and bottom lines are calculated and they will be used for break out calculation of the NEW current candle.
Apprentice one question for you: I tried to use internal streams (addInternalStream) for passing values to a strategy but I failed; is it only possible with normal streams (addStream) ?