sonnyjitsu
New member
discussion began:
https://usethinkscript.com/threads/help-with-price-action-indicator.12348/#post-106258
Here is the final script after doing a little more work...
https://usethinkscript.com/threads/help-with-price-action-indicator.12348/#post-106258
Here is the final script after doing a little more work...
Ruby:
# This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
# sonnyjitsu
input largeSpread = 0.60;
input irregularBody = 0.10;
input volumeMA = 12;
def lowerTail;
def upperTail;
if close > open {
upperTail = (high - close);
lowerTail = (open - low);
} else {
upperTail = (high - open);
lowerTail = (close - low);
}
def candleBody = AbsValue(close - open);
def thePlot = close;
def goodVolume = volume >= ExpAverage(volume, volumeMA);
def cond2 = ((lowerTail > upperTail) and goodVolume and lowerTail > candleBody / 2);
def cond3 = ((upperTail > lowerTail) and goodVolume and upperTail > candleBody / 2);
def largeBodyGoodVolumeUp = close > open and candleBody > largeSpread and goodVolume;
def largeBodyGoodVolumeDown = close < open and candleBody > largeSpread and goodVolume;
plot priceActionIrregularUp = if candleBody < irregularBody and goodVolume and lowerTail > upperTail and lowerTail > candleBody / 2 then close else Double.NaN;
priceActionIrregularUp.SetDefaultColor(Color.MAGENTA);
priceActionIrregularUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot priceActionIrregularDown = if candleBody < irregularBody and goodVolume and upperTail > lowerTail and upperTail > candleBody / 2 then close else Double.NaN;
priceActionIrregularDown.SetDefaultColor(Color.MAGENTA);
priceActionIrregularDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
plot priceActionArrowUp = if largeBodyGoodVolumeUp or cond2 and !largeBodyGoodVolumeDown then close else Double.NaN;
priceActionArrowUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
priceActionArrowUp.SetDefaultColor(Color.GREEN);
plot priceActionArrowDown = if largeBodyGoodVolumeDown or cond3 and !largeBodyGoodVolumeUp then close else Double.NaN;
priceActionArrowDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
priceActionArrowDown.SetDefaultColor(Color.RED);
plot IrregularUp = if !goodVolume and lowerTail > upperTail and lowerTail > (candleBody / 2) and close > open then close else Double.NaN;
IrregularUp.SetDefaultColor(Color.MAGENTA);
IrregularUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot IrregularDown = if !goodVolume and upperTail > lowerTail and upperTail > (candleBody / 2) and open > close then close else Double.NaN;
IrregularDown.SetDefaultColor(Color.MAGENTA);
IrregularDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Last edited by a moderator: