ExtremelyRough
New member
Hi,
I have a simple concept here, continuation/reversal indicator. Simply put, this will look for large candles where the body is the majority of the candle and it will determine if the candle is a continuation or reversal. Entry will be at the open of the next candle.
I recommend using it on the 15min or higher. I have good results with the 15 and 30 minute for scalps and the daily for swings. I aim for 3 points per scalp.
Optionally you can print entry lines as well as tp and sl lines calculated from average up and down moves from candle open.
Share link: Continuation/Reversal
I have a simple concept here, continuation/reversal indicator. Simply put, this will look for large candles where the body is the majority of the candle and it will determine if the candle is a continuation or reversal. Entry will be at the open of the next candle.
I recommend using it on the 15min or higher. I have good results with the 15 and 30 minute for scalps and the daily for swings. I aim for 3 points per scalp.
Optionally you can print entry lines as well as tp and sl lines calculated from average up and down moves from candle open.
Code:
# Kishan - Candle Data Analysis for Strength and Follow-Through
# -----------------------
# Inputs
# -----------------------
input startTime = 1000; # Skip first 30min
input endTime = 1530; # Skip last 30min
input showAvgCandle = yes;
input showPercentOfCandle = yes;
input percentageThreshold = 100;
input length = 163; # Period to average over (adjustable)
# -----------------------
# Session Filter
# -----------------------
def inSession = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
# -----------------------
# Candle Calculations
# -----------------------
def candleSize = high - low;
def bodySize = AbsValue(close - open);
def greenCandle = close > open;
# -----------------------
# Directional Moves
# -----------------------
def upCandle = high > high[1];
def downCandle = low < low[1];
# -----------------------
# Calculate average move up and down from open
# -----------------------
def upMove = high - open;
def downMove = open - low;
def averageUpMove = Average(upMove, 50);
def averageDownMove = Average(downMove, 50);
# -----------------------
# Volume Analysis
# -----------------------
def volumeAvgBuffer = Average(volume, 50) * 1.3;
def volumeGrowth = volume >= (volume[1] * 1.5);
def lowVolume = volume < volumeAvgBuffer;
def highVolume = volumeGrowth and volume > volumeAvgBuffer;
# -----------------------
# Candle Averages & Percentages
# -----------------------
def averageCandleSize = Average(candleSize, length);
def percentageOfAvg = if averageCandleSize != 0 then (candleSize / averageCandleSize) * 100 else 0;
def percentageOfBody = if candleSize != 0 then (bodySize / candleSize) * 100 else 0;
# -----------------------
# Entry / Reversal Signals
# -----------------------
plot entryLong = inSession and !volumeGrowth and greenCandle and percentageOfAvg > percentageThreshold and percentageOfBody >= 60;
plot entryShort = inSession and !volumeGrowth and !greenCandle and percentageOfAvg > percentageThreshold and percentageOfBody >= 60;
plot reversalLong = inSession and highVolume and !greenCandle and percentageOfAvg > percentageThreshold;
plot reversalShort = inSession and highVolume and greenCandle and percentageOfAvg > percentageThreshold;
# Painting strategies
entryLong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
entryLong.SetDefaultColor(Color.LIGHT_GREEN);
entryShort.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
entryShort.SetDefaultColor(Color.PINK);
reversalLong.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
reversalLong.SetDefaultColor(Color.GREEN);
reversalShort.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
reversalShort.SetDefaultColor(Color.RED);
# -----------------------
# Labels
# -----------------------
AddLabel(showAvgCandle, "Average Candle Size: " + Round(averageCandleSize, 2), Color.GRAY);
AddLabel(showPercentOfCandle, "Body to Candle %: " + Round(percentageOfBody, 1) + "%",
if percentageOfBody > 60 then Color.GREEN else Color.RED);
# -----------------------
# Trade Lines & Winning Trades
# -----------------------
# Signals for next-bar entry
def nextBarEntryLong = entryLong[1] or reversalLong[1];
def nextBarEntryShort = entryShort[1] or reversalShort[1];
# Entry price = next candle open
def entryPriceLong = if nextBarEntryLong then open else Double.NaN;
def entryPriceShort = if nextBarEntryShort then open else Double.NaN;
# Targets based on average moves
def takeProfitLong = if !IsNaN(entryPriceLong) then entryPriceLong + averageUpMove else Double.NaN;
def stopLossLong = if !IsNaN(entryPriceLong) then entryPriceLong - (averageDownMove * 1.2) else Double.NaN;
def takeProfitShort = if !IsNaN(entryPriceShort) then entryPriceShort - averageDownMove else Double.NaN;
def stopLossShort = if !IsNaN(entryPriceShort) then entryPriceShort + (averageUpMove * 1.2) else Double.NaN;
# Plot Entry Line
plot entryLongLine = entryPriceLong;
entryLongLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
entryLongLine.SetDefaultColor(Color.BLUE);
entryLongLine.SetLineWeight(2);
plot entryShortLine = entryPriceShort;
entryShortLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
entryShortLine.SetDefaultColor(Color.ORANGE);
entryShortLine.SetLineWeight(2);
# Plot TP & SL as dotted lines
plot tpLongLine = takeProfitLong;
tpLongLine.SetPaintingStrategy(PaintingStrategy.DASHES);
tpLongLine.SetDefaultColor(Color.LIGHT_GREEN);
plot slLongLine = stopLossLong;
slLongLine.SetPaintingStrategy(PaintingStrategy.DASHES);
slLongLine.SetDefaultColor(Color.PINK);
plot tpShortLine = takeProfitShort;
tpShortLine.SetPaintingStrategy(PaintingStrategy.DASHES);
tpShortLine.SetDefaultColor(Color.LIGHT_GREEN);
plot slShortLine = stopLossShort;
slShortLine.SetPaintingStrategy(PaintingStrategy.DASHES);
slShortLine.SetDefaultColor(Color.PINK);
Share link: Continuation/Reversal