Tweet
#This study will produce a buy signal when price closes above the Komu (cloud) and a sell signal when crosses below
####################
Declare upper;
input Arrows = yes; #Hint Arrows: Up/Down visual arrow signals.
input Tags = yes; #Hint Tags: BUY/SELL visual tags.
input Alerts = yes; #Hint Alerts: BUY/SELL audio alerts.
input DaylightSavingsTime = yes; #Note if trading in Daylight Savings Time or not.
input tenkan_period = 9;
input kijun_period = 26;
input ATRLength = 14;
def Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
def Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
def "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
def "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
def dst = if DayLightSavingsTime == yes then 60 else 0;
def rth_start = (Round((24 * (((RegularTradingStart(GetYYYYMMDD())) / (1000 * 60 * 60 * 24)) - DaysFromDate(19700101)) - 4) * 60, 0) - dst) * 60;
def rth_end = (Round((24 * (((RegularTradingEnd(GetYYYYMMDD())) / (1000 * 60 * 60 * 24)) - DaysFromDate(19700101)) - 4) * 60, 0) - dst) * 60;
def rth = if SecondsFromTime(0000) >= rth_start and SecondsFromTime(0000) <= rth_end then yes else no;
def first30 = if SecondsFromTime(0000) >= rth_start and SecondsFromTime(0000) <= rth_start+1800 then yes else no;
rec highhold = if rth[-1] then if high > highhold[1] then high else highhold[1] else 0;
AddLabel(no, highhold);
rec lowhold = if rth[-1] then if low < lowhold[1] then low else lowhold[1] else high(period=AggregationPeriod.DAY);
def ATR = WildersAverage(TrueRange(high, close, low), ATRLength);
def highest = if "Span A" > "Span B" then "Span A" else "Span B";
def lowest = if "Span A" < "Span B" then "Span A" else "Span B";
def upATR = if rth and first30 then close - lowhold > ATR * .2 else close - lowhold > ATR * .35;
def downATR = if rth and first30 then highhold - close > -ATR * .2 else highhold - close > -ATR * .35;
def upArrow = if rth and upATR and close crosses above highest then 1 else 0;
def downArrow = if rth and downATR and close crosses below lowest then 1 else 0;
plot ArrowDown = if downArrow and Arrows then high else Double.NaN;
ArrowDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrowDown.SetDefaultColor(Color.RED);
ArrowDown.SetLineWeight(5);
plot ArrowUp = if upArrow and Arrows then low else Double.NaN;
ArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ArrowUp.SetDefaultColor(Color.GREEN);
ArrowUp.SetLineWeight(5);
AddChartBubble(upArrow and Tags,close, "BUY", Color.GREEN, no);
AddChartBubble(downArrow and Tags, close, "SELL", Color.RED, yes);
Alert(upArrow and Alerts, "BUY SIGNAL: " + GetSymbol() + " Breaking Cloud to the Upside.", Alert.BAR);
Alert(downArrow and Alerts, "SELL SIGNAL: " + GetSymbol() + " Breaking Cloud to the Downside.", Alert.BAR);
####################
Declare upper;
input Arrows = yes; #Hint Arrows: Up/Down visual arrow signals.
input Tags = yes; #Hint Tags: BUY/SELL visual tags.
input Alerts = yes; #Hint Alerts: BUY/SELL audio alerts.
input DaylightSavingsTime = yes; #Note if trading in Daylight Savings Time or not.
input tenkan_period = 9;
input kijun_period = 26;
input ATRLength = 14;
def Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
def Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
def "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
def "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
def dst = if DayLightSavingsTime == yes then 60 else 0;
def rth_start = (Round((24 * (((RegularTradingStart(GetYYYYMMDD())) / (1000 * 60 * 60 * 24)) - DaysFromDate(19700101)) - 4) * 60, 0) - dst) * 60;
def rth_end = (Round((24 * (((RegularTradingEnd(GetYYYYMMDD())) / (1000 * 60 * 60 * 24)) - DaysFromDate(19700101)) - 4) * 60, 0) - dst) * 60;
def rth = if SecondsFromTime(0000) >= rth_start and SecondsFromTime(0000) <= rth_end then yes else no;
def first30 = if SecondsFromTime(0000) >= rth_start and SecondsFromTime(0000) <= rth_start+1800 then yes else no;
rec highhold = if rth[-1] then if high > highhold[1] then high else highhold[1] else 0;
AddLabel(no, highhold);
rec lowhold = if rth[-1] then if low < lowhold[1] then low else lowhold[1] else high(period=AggregationPeriod.DAY);
def ATR = WildersAverage(TrueRange(high, close, low), ATRLength);
def highest = if "Span A" > "Span B" then "Span A" else "Span B";
def lowest = if "Span A" < "Span B" then "Span A" else "Span B";
def upATR = if rth and first30 then close - lowhold > ATR * .2 else close - lowhold > ATR * .35;
def downATR = if rth and first30 then highhold - close > -ATR * .2 else highhold - close > -ATR * .35;
def upArrow = if rth and upATR and close crosses above highest then 1 else 0;
def downArrow = if rth and downATR and close crosses below lowest then 1 else 0;
plot ArrowDown = if downArrow and Arrows then high else Double.NaN;
ArrowDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrowDown.SetDefaultColor(Color.RED);
ArrowDown.SetLineWeight(5);
plot ArrowUp = if upArrow and Arrows then low else Double.NaN;
ArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ArrowUp.SetDefaultColor(Color.GREEN);
ArrowUp.SetLineWeight(5);
AddChartBubble(upArrow and Tags,close, "BUY", Color.GREEN, no);
AddChartBubble(downArrow and Tags, close, "SELL", Color.RED, yes);
Alert(upArrow and Alerts, "BUY SIGNAL: " + GetSymbol() + " Breaking Cloud to the Upside.", Alert.BAR);
Alert(downArrow and Alerts, "SELL SIGNAL: " + GetSymbol() + " Breaking Cloud to the Downside.", Alert.BAR);
No comments :
Post a Comment