0% found this document useful (0 votes)
112 views3 pages

Killzone Strategy - PINE

This document describes a trading strategy that analyzes liquidity surges in the New York session to generate dual entry signals for both long and short trades. It defines inputs for colors, stop loss references, risk-reward ratios, and ATR settings. Variables are used to track the NY open high and low, entry triggers, trade entries, prices and stop/take profit levels. Labels and lines are drawn to mark signals and levels on the chart. Alerts are also configured for entry and exit triggers.

Uploaded by

Rogerthat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views3 pages

Killzone Strategy - PINE

This document describes a trading strategy that analyzes liquidity surges in the New York session to generate dual entry signals for both long and short trades. It defines inputs for colors, stop loss references, risk-reward ratios, and ATR settings. Variables are used to track the NY open high and low, entry triggers, trade entries, prices and stop/take profit levels. Labels and lines are drawn to mark signals and levels on the chart. Alerts are also configured for entry and exit triggers.

Uploaded by

Rogerthat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//@version=5

indicator('Killzone Strategy - Dual Entries', shorttitle='NY Liquidity Surge',


overlay=true)

// Color Inputs
group_title_color_inputs = "Color Settings"
longEntryColor = input.color(color.green, title='Long Entry Signal',
group=group_title_color_inputs)
shortEntryColor = input.color(color.red, title='Short Entry Signal',
group=group_title_color_inputs)
slLabelColor = input.color(color.red, title='Stop Loss Label',
group=group_title_color_inputs)
tpLabelColor = input.color(color.green, title='Take Profit Label',
group=group_title_color_inputs)
buyEntryLineColor = input.color(color.blue, title='Buy Entry Line',
group=group_title_color_inputs)
sellEntryLineColor = input.color(color.red, title='Sell Entry Line',
group=group_title_color_inputs)

// Stop Loss Reference Input


group_title_sl_inputs = "Stop Loss Settings"
stopLossReferenceInput = input.string(title='Stop Loss Reference', defval='Last
Swing', options=['Last Closing Candle', 'Last Swing', 'ATR-Based'])
riskRewardRatio = input.int(title='Risk to Reward Ratio', defval=3, minval=1,
maxval=15, step=1)

// ATR Input
lengthATR = input.int(14, title="ATR Period", group="ATR Settings")
atrSLFactor = input.float(1.5, title="ATR SL Factor", group="ATR Settings",
step=0.1)

// Calculate ATR
atrValue = ta.atr(lengthATR)

// Calculate ATR-based Stop Loss


atrStopLoss = atrValue * atrSLFactor

// Adjusted Session times for background


bgStartTime = timestamp('UTC-5', year, month, dayofmonth, 2, 0) // Changed to 2 AM
bgEndTime = timestamp('UTC-5', year, month, dayofmonth, 17, 30) // Changed to 5:30
PM

// Original Entry Session Time


startTime = timestamp('UTC-5', year, month, dayofmonth, 8, 0) // Kept at 8 AM for
entry logic
endTime = timestamp('UTC-5', year, month, dayofmonth, 17, 0) // Kept at 5 PM for
entry logic

// Session visualization for background


bgSessionInProgress = (time >= bgStartTime and time < bgEndTime)
bgcolor(bgSessionInProgress ? color.new(color.blue, 65) : na) // Light blue
background with 35% opacity

// Variables for NY open high and low


var float nyOpenHigh = na
var float nyOpenLow = na

// Separate flags for long and short trade entry


var bool longEntryTriggered = false
var bool shortEntryTriggered = false
var bool longTradeEntered = false
var bool shortTradeEntered = false
var float entryPriceLong = na
var float entryPriceShort = na
var float stopLossPriceLong = na
var float stopLossPriceShort = na

// Reset at the start of each NY session


if time >= startTime and time[1] < startTime
nyOpenHigh := high
nyOpenLow := low
longEntryTriggered := false
shortEntryTriggered := false
longTradeEntered := false
shortTradeEntered := false
entryPriceLong := na
entryPriceShort := na
stopLossPriceLong := na
stopLossPriceShort := na

// Detecting breakout for both long and short entries


if not longTradeEntered and time >= startTime and time < endTime
if high > nyOpenHigh
nyOpenHigh := high
longEntryTriggered := true
stopLossPriceLong := stopLossReferenceInput == 'Last Swing' ? low :
close[1]
entryPriceLong := nyOpenHigh + atrStopLoss // Adjusted for ATR-based SL

if not shortTradeEntered and time >= startTime and time < endTime
if low < nyOpenLow
nyOpenLow := low
shortEntryTriggered := true
stopLossPriceShort := stopLossReferenceInput == 'Last Swing' ? high :
close[1]
entryPriceShort := nyOpenLow - atrStopLoss // Adjusted for ATR-based SL

// Entry conditions
longCondition = longEntryTriggered and not longTradeEntered
shortCondition = shortEntryTriggered and not shortTradeEntered

// Update entry flags and prices


if longCondition
longTradeEntered := true
entryPriceLong := nyOpenHigh
label.new(x=bar_index + 10, y=entryPriceLong, text='Buy', color=longEntryColor,
style=label.style_label_right, size=size.tiny, textcolor=color.white)
// Draw the entry line
line.new(x1=bar_index, y1=entryPriceLong, x2=bar_index + 10, y2=entryPriceLong,
color=buyEntryLineColor, width=2)

if shortCondition
shortTradeEntered := true
entryPriceShort := nyOpenLow
label.new(x=bar_index + 10, y=entryPriceShort, text='Sell',
color=shortEntryColor, style=label.style_label_right, size=size.tiny,
textcolor=color.white)
// Draw the entry line
line.new(x1=bar_index, y1=entryPriceShort, x2=bar_index + 10,
y2=entryPriceShort, color=sellEntryLineColor, width=2)

// Stop Loss and Take Profit Levels


float stopLossLevelLong = na
float stopLossLevelShort = na
float takeProfitLevelLong = na
float takeProfitLevelShort = na

// Calculate ATR-based Stop Loss Levels


if stopLossReferenceInput == 'ATR-Based'
stopLossLevelLong := entryPriceLong - atrStopLoss
stopLossLevelShort := entryPriceShort + atrStopLoss

// Adjusting SL and TP labels


if longCondition
stopLossLevelLong := stopLossPriceLong
takeProfitLevelLong := entryPriceLong + (entryPriceLong - stopLossPriceLong) *
riskRewardRatio
label.new(x=bar_index, y=stopLossLevelLong, text='SL', color=slLabelColor,
style=label.style_label_down, size=size.tiny, textcolor=color.white)
label.new(x=bar_index, y=takeProfitLevelLong, text='TP', color=tpLabelColor,
style=label.style_label_up, size=size.tiny, textcolor=color.white)

if shortCondition
stopLossLevelShort := stopLossPriceShort
takeProfitLevelShort := entryPriceShort - (stopLossPriceShort -
entryPriceShort) * riskRewardRatio
label.new(x=bar_index, y=stopLossLevelShort, text='SL', color=slLabelColor,
style=label.style_label_down, size=size.tiny, textcolor=color.white)
label.new(x=bar_index, y=takeProfitLevelShort, text='TP', color=tpLabelColor,
style=label.style_label_up, size=size.tiny, textcolor=color.white)

// Alerts
alertcondition(longCondition, title='Long Entry Alert', message='Long Entry Signal
Triggered')
alertcondition(shortCondition, title='Short Entry Alert', message='Short Entry
Signal Triggered')
alertcondition(close >= takeProfitLevelLong and not na(takeProfitLevelLong),
title='Long Take Profit Hit', message='Long Take Profit Level Hit')
alertcondition(close <= takeProfitLevelShort and not na(takeProfitLevelShort),
title='Short Take Profit Hit', message='Short Take Profit Level Hit')
alertcondition(close <= stopLossLevelLong and not na(stopLossLevelLong),
title='Long Stop Loss Hit', message='Long Stop Loss Level Hit')
alertcondition(close >= stopLossLevelShort and not na(stopLossLevelShort),
title='Short Stop Loss Hit', message='Short Stop Loss Level Hit')

You might also like