# This strategy counts a number of lower highs then after the last candle that price crosses back above lowest high triggers the buy signal and sell signal if the price crosses below the 9 ema or closes below the close of the last candle.
This is to keep a clean chart for intraday trading on one minute chart so I can have multiple charts open on 1 screen and just see the labels if they red or green and select the one thats green to open on main screen.
Thanks to @Svanoy for the coding help Also Thanks to @koenigbro
Latest Version April3, 2022
http://tos.mx/8sSc848
This is to keep a clean chart for intraday trading on one minute chart so I can have multiple charts open on 1 screen and just see the labels if they red or green and select the one thats green to open on main screen.
Thanks to @Svanoy for the coding help Also Thanks to @koenigbro
Latest Version April3, 2022
http://tos.mx/8sSc848
Code:
input price = close;
input Length = 9;
input averageType = AverageType.WILDERS;
plot MA = MovingAverage(averageType, price, Length);
input ConsecutiveBarsDown = 2;
input Trigger_Line = high;
input ConsecutiveBarsUp = 2;
input Trigger_Line2 = Low;
def Condition = high < high[1];
def Condition2 = low > low[1];
def CBD = Sum(Condition, ConsecutiveBarsDown);
plot CBDP = if CBD == ConsecutiveBarsDown then CBD else Double.NaN;
CBDP.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
def CBU = Sum(Condition, ConsecutiveBarsUp);
plot CBUP = if CBU == ConsecutiveBarsUp then CBU else Double.NaN;
CBUP.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
def BuyLine;
if close[1] > BuyLine[1] {
BuyLine = Double.NaN;
} else if CBD == ConsecutiveBarsDown {
BuyLine = Trigger_Line;
} else {
BuyLine = BuyLine[1];
}
plot BuyLinePlot = BuyLine;
BuyLinePlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BuyLinePlot.AssignValueColor(Color.WHITE);
def Buy = close > BuyLine;
plot BP = Buy;
BP.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BP.AssignValueColor(Color.UPTICK);
BP.SetLineWeight(5);
def sell = close < close[2] or close crosses below MA;
def SellLine;
if close[1] < SellLine[1] {
SellLine = Double.NaN;
} else if CBU == ConsecutiveBarsUp {
SellLine = Trigger_Line2;
} else {
SellLine = SellLine[1];
}
plot SellLinePlot = SellLine;
SellLinePlot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
SellLinePlot.AssignValueColor(Color.YELLOW);
def Sell2 = close < SellLine;
plot SL = Sell2;
SL.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
SL.AssignValueColor(Color.DOWNTICK);
SL.SetLineWeight(5);
def Buy2 = close > close[2] or close crosses above MA;
AddOrder(OrderType.BUY_TO_OPEN, condition = Buy, tradeSize = 1, tickcolor = Color.CYAN, arrowcolor = Color.BLUE, "Buy");
AddOrder(OrderType.SELL_TO_CLOSE, condition = sell, tradeSize = 1, tickcolor = Color.DARK_ORANGE, arrowcolor = Color.RED, "Sell");
AddLabel(yes, if Buy then "BUY" else if sell then "SELL" else "Nothing",
if sell then Color.RED else if Buy then Color.GREEN else Color.BLACK);
AddOrder(OrderType.SELL_TO_OPEN, condition = Sell2, tradeSize = 1, tickcolor = Color.RED, arrowcolor = Color.PINK, “Sell”);
AddOrder(OrderType.BUY_TO_CLOSE, condition = buy2, tradeSize = 1, tickcolor = Color.VIOLET, arrowcolor = Color.LIME, “Buy”);
AddLabel(yes, if Sell2 then “SELL” else if buy2 then “BUY” else "Nothing",
if buy2 then Color.LIME else if sell2 then Color.RED else Color.BLACK);
# Alerts
Alert(Buy, "buy to open", Alert.Bar, Sound.Chimes);
Alert(Sell, "sell to close", Alert.Bar, Sound.Bell);
Alert(Buy2, "buy to close", Alert.Bar, Sound.Chimes);
Alert(Sell2, "sell to open", Alert.Bar, Sound.Bell);
Last edited by a moderator: