LNL Scalper Arrows For ThinkOrSwim

Shasha

New member
Hi all!
I came across this "HOAGIE" scalping strategy:

I see a version of this in Trading View called LNL SCALPER ARROWS https://in.tradingview.com/script/2uF32Xaq-LNL-Scalper-Arrows/
It has the Hoagie Indication as well as some other patterns like Umbrella and Pin Bar BTW Ratio. I am really only interested in the Hoagie Pattern Indicator.

If someone is willing to convert this code to TOS, it would be much appreciated!!

Thanks!
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Hi all!
I came across this "HOAGIE" scalping strategy:

I see a version of this in Trading View called LNL SCALPER ARROWS https://in.tradingview.com/script/2uF32Xaq-LNL-Scalper-Arrows/
It has the Hoagie Indication as well as some other patterns like Umbrella and Pin Bar BTW Ratio. I am really only interested in the Hoagie Pattern Indicator.

If someone is willing to convert this code to TOS, it would be much appreciated!!

Thanks!
check the below

CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0
#/ LNL Scalper Arrows
#// Created by L&L Capital
#indicator("LNL Scalper Arrows",shorttitle = "LNL Scalper Arrows", overlay = true)
# Converted by Sam4Cok@Samer800    - 11/2023 - request from UseThinkScript.com memebr

input showLabel = yes;
input TailSignalType = {"Signal", "SignalBrake", default "None"}; # "Tail Signal Type"
input ScalpSignalType = {default "Signal", "SignalBrake", "None"}; # "Scalp Signal Type"
input HoagieSignalType = {default "Signal", "SignalBrake", "None"}; # "Hoagie Signal Type"
input UmbrellaSignalType = {default "Signal", "SignalBrake", "None"}; # "Umbrella Signal Type"
input showInsideOutsideBars = no;
input TrendStrength = 20;      # "Trend Strength"
input PinbarBTWRatio = 2.5;    # "PinBar BTW Ratio" (ideal pin bar is 2.0 - 3.0)")
input ATRLength = 7;           # "ATR Length"
input RoundNumbersTo = 2;      # "Round Numbers To"
input TargetATR = 2.0;         # "Target = ATR /"
input StopATR = 1.0;           # "Stop = ATR *"

def na = Double.NaN;
#// Functions & Definitons

def iTelo = AbsValue(close - open);
def bPinUp   = (((high - low) / (iTelo)) > PinBarBTWRatio) and Max(open, close) < high - ((high - low) / 2);
def bPinDown = (((high - low) / (iTelo)) > PinBarBTWRatio) and Min(open, close) > low + ((high - low) / 2);
def bSignalUp = bPinUp;
def bSignalDown = bPinDown;
def up = if bSignalUp then high else na;
def down = if bSignalDown then high else na;
def greenbar = close > open;
def redbar = close < open;
def ema8 = ExpAverage(close, 8);
def trendd = ExpAverage(close, TrendStrength);

def Kup1 = KeltnerChannels(Length = 21, factor = 1.0).Upper_Band;
def Kdn1 = KeltnerChannels(Length = 21, factor = 1.0).Lower_Band;
def KUP2 = KeltnerChannels(Length = 21, factor = 1.5).Upper_Band;
def KDN2 = KeltnerChannels(Length = 21, factor = 1.5).Lower_Band;

#/ Tail Arrows [Eat The Tail]

def TailUp = if TailSignalType == TailSignalType."Signal" then
    bPinUp and hl2[1] > ema8 and high[2] < high[1] and hl2 > ema8 and hl2 > Kup1
else if TailSignalType == TailSignalType."SignalBrake" then
    high > up[1] and hl2 > hl2[1] and high[2] < high[1] and hl2[1] > ema8 and hl2 > ema8 and hl2 > Kup1 else na;

def TailDown = if TailSignalType == TailSignalType."Signal" then
    bPinDown and hl2[1] < ema8 and low[2] > low[1] and hl2 < ema8 and hl2 < KDN2
else if TailSignalType == TailSignalType."SignalBrake" then
    high < down[1] and hl2 < hl2[1] and low[2] > low[1] and hl2[1] < ema8 and hl2 < ema8 and hl2 < KDN2 else na;

plot Tail_Up = if TailUp then low else na;     # 'Tail Up'
plot Tail_Dn = if TailDown then high else na;  # 'Tail Down'

Tail_Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
Tail_Dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
Tail_Up.SetDefaultColor(Color.DARK_GREEN);
Tail_Dn.SetDefaultColor(Color.DARK_RED);
#// Scalp Arrows [Scallops]

def ScalpUp = if ScalpSignalType == ScalpSignalType."Signal" then
    close > open and low < low[1] and high < high[1] and hl2 > trendd
else if ScalpSignalType == ScalpSignalType."SignalBrake" then
    close[1] > open[1] and low[1] < low[2] and high[1] < high[2] and hl2[1] > trendd and high > high[1] else na;

def ScalpDown = if ScalpSignalType == ScalpSignalType."Signal" then
    close < open and low > low[1] and high > high[1] and hl2 < trendd
else if ScalpSignalType == ScalpSignalType."SignalBrake" then
    close[1] < open[1] and low[1] > low[2] and high[1] > high[2] and hl2[1] < trendd and low < low[1] else na;


plot scalp_Up = if ScalpUp then low else na;#,title='Scalp Up'
plot scalp_Dn = if ScalpDown then high else na;#,title='Scalp Down'

scalp_Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
scalp_Dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
scalp_Up.SetDefaultColor(Color.GREEN);
scalp_Dn.SetDefaultColor(Color.RED);

#// Hoagie Arrows [Hoagies]

def HoagieUp = if HoagieSignalType == HoagieSignalType."Signal" then
    high < high[1] and low > low[1] and high[1] < high[2] and low[1] > low[2] and hl2 > trendd
else if HoagieSignalType == HoagieSignalType."SignalBrake" then
    high[1] < high[2] and low[1] > low[2] and high[2] < high[3] and low[2] > low[3] and high > high[3] and hl2 > trendd else na;

def HoagieDown = if HoagieSignalType == HoagieSignalType."Signal" then
    low > low[1] and high < high[1] and low[1] > low[2] and high[1] < high[2] and hl2 < trendd
else if HoagieSignalType == HoagieSignalType."SignalBrake" then
    low[1] > low[2] and high[1] < high[2] and low[2] > low[3] and high[2] < high[3] and low < low[3] and hl2 < trendd else na;

plot Hoagie_Up = if HoagieUp then low else na;#,title='Hoagie Up'
plot Hoagie_Dn = if HoagieDown then high else na;#,title='Hoagie Down'

Hoagie_Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
Hoagie_Dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
Hoagie_Up.SetDefaultColor(Color.MAGENTA);
Hoagie_Dn.SetDefaultColor(Color.MAGENTA);

#// Umbrella Arrows [Umbrellas]

def UmbrellaUp = if UmbrellaSignalType == UmbrellaSignalType."Signal" then
    (open >= close[1]) and (close >= close[1]) and (high <= high[1]) and (low >= low[1]) and (close[1] > open[1]) and (close - open + close[1]) - (open[1] / high - low + high[1] - low[1]) > 0.5 and (low > trendd)
else if UmbrellaSignalType == UmbrellaSignalType."SignalBrake" then
    (open[1] >= close[2]) and (close[1] >= close[2]) and (high[1] <= high[2]) and (low[1] >= low[2]) and (close[2] > open[2]) and (close[1] - open[1] + close[2]) - (open[1] / high[1] - low[1] + high[2] - low[2]) > 0.5 and (low > trendd) else na;

def UmbrellaDown = if UmbrellaSignalType == UmbrellaSignalType."Signal" then
    (open <= close[1]) and (close <= close[1]) and (high >= high[1]) and (low <= low[1]) and (close[1] < open[1]) and (close - open + close[1]) - (open[1] / high - low + high[1] - low[1]) > 0.5 and (high < trendd)
else if UmbrellaSignalType == UmbrellaSignalType."SignalBrake" then
    (open[1] <= close[2]) and (close[1] <= close[2]) and (high[1] >= high[2]) and (low[1] <= low[2]) and (close[2] < open[2]) and (close[1] - open[1] + close[2]) - (open[1] / high[1] - low[1] + high[2] - low[2]) > 0.5 and (high < trendd) else na;

plot Umbrella_Up = if UmbrellaUp then low else na;#,title='Umbrella Up'
plot Umbrella_Dn = if UmbrellaDown then high else na;#,title='Umbrella Down'
Umbrella_Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
Umbrella_Dn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
Umbrella_Up.SetDefaultColor(Color.CYAN);
Umbrella_Dn.SetDefaultColor(Color.CYAN);

#// Inside Outside Bars

def OutUp = greenbar and (high > high[1]) and (low < low[1]) and (close > high[1]) and (open < open[1]) and KUP2;
def OutDn = redbar and (low < low[1]) and (high > high[1]) and (close < low[1]) and (open > open[1]) and KDN2;

AddChartBubble(showInsideOutsideBars and OutUp, low, "OutUp", Color.LiGHT_GREEN, no);
AddChartBubble(showInsideOutsideBars and OutDn,high, "OutDn", Color.LIGHT_RED);

#// Trend Gauge [Enhanced EMA]

def avg = ExpAverage(close,TrendStrength);
def rsi = rsi(Price = close, Length = 30);
def TrendColor = if avg < open and avg < close and rsi > 50 then 1 else
                 if avg > open and avg > close and rsi < 50 then -1 else 0;

plot avgLine = avg;    # "Trend"
avgLine.SetLineWeight(2);
avgLine.AssignValueColor(if TrendColor > 0 then Color.GREEN else
                         if TrendColor < 0 then Color.RED else Color.GRAY);
#// ATR & Target & Stop Label Calculations

def atr = atr(Length = ATRLength);
def target = atr / TargetATR;
def stop = atr * StopATR;

def rATR    = Round(atr, RoundNumbersTo);
def rTarget = Round(target, RoundNumbersTo);
def rStop   = Round(stop, RoundNumbersTo);

AddLabel(showLabel, "ATR(" + rATR + ")", Color.YELLOW);
AddLabel(showLabel, "Target(" + rTarget + ")", Color.GREEN);
AddLabel(showLabel, "Stop(" + rStop + ")", Color.RED);

#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
480 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top