Adding parameters to candle formations

B

Bently

New member
Hello all,

I'am new to scripting and have been trying to figure a way to add a few rules to some candle formation that is available in tos. This script involves a 3 and 4 candle formation.

Rules I'm trying to apply are:


The last candle in the formation must close above the 50 RSI and close above the 200sma on the current time frame
The last candle in the formation must close between the -1 ATR and 1 ATR line.

Any help would be greatly appreciated!
I will donate to the right person that can get this working properly....via payapl ($$)


3 candle formation:

Code:
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
    IsDown[2] and
    IsDown[1] and
    IsUp[0] and
    close[2] <= close[0] and
    low[2] > low[1];

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
PatternPlot.SetDefaultColor(CreateColor(255, 255, 255));
4 candle formation:

Code:
def IsUp = close > open;
def IsDown = close < open;
def IsDoji = IsDoji();
def avgRange = 0.05 * Average(high - low, 20);
plot PatternPlot =
    IsDescending(close, 1)[3] and
    IsDown[2] and
    IsDown[1] and
    IsUp[0] and
    close[2] <= close[0] and
    low[2] > low[1];

PatternPlot.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
PatternPlot.SetDefaultColor(CreateColor(255, 255, 255));
 
Last edited:

Similar threads

Top