0% found this document useful (0 votes)
94 views1 page

Pine

This a breakout pinescript signal , always profitable

Uploaded by

M Browne
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)
94 views1 page

Pine

This a breakout pinescript signal , always profitable

Uploaded by

M Browne
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/ 1

// @version=4

strategy("Daily Breakout Strategy", overlay=true, default_qty_value=1000000)

// Get user input


entryPips = input(title="Entry Pips", defval=3.0, type=input.float, tooltip="How
many pips above high to place entry order")
stopPips = input(title="Stop Pips", defval=5.0, type=input.float, tooltip="Fixed
pip stop loss distance")
targetPips = input(title="Target Pips", defval=10.0, type=input.float,
tooltip="Fixed pip profit target distance")

// Get highs and lows


dailyHigh = security(syminfo.tickerid, "D", high)
dailyLow = security(syminfo.tickerid, "D", low)

// Determine buy & sell point (default 3 pips/30 points above/below high/low)
buyPoint = dailyHigh + (entryPips * 10 * syminfo.mintick)
sellPoint = dailyLow - (entryPips * 10 * syminfo.mintick)

// Determine stop loss (default 5 pips/50 points above/below buy/sell point)


stopLossLong = buyPoint - (stopPips * 10 * syminfo.mintick)
stopLossShort = sellPoint + (stopPips * 10 * syminfo.mintick)

// Determine take profit (default 10 pips/100 points above/below buy/sell point)


takeProfitLong = buyPoint + (targetPips * 10 * syminfo.mintick)
takeProfitShort = sellPoint - (targetPips * 10 * syminfo.mintick)

// If a new day has started and we're flat, place a buy stop & sell stop
var stopLossLongSaved = 0.0
var takeProfitLongSaved = 0.0
var stopLossShortSaved = 0.0
var takeProfitShortSaved = 0.0
newDay = change(time("D"))
if newDay
if strategy.position_size == 0
stopLossLongSaved := stopLossLong
takeProfitLongSaved := takeProfitLong
strategy.entry(id="Long", long=strategy.long, stop=buyPoint, oca_name="x",
oca_type=strategy.oca.cancel)
stopLossShortSaved := stopLossShort
takeProfitShortSaved := takeProfitShort
strategy.entry(id="Short", long=strategy.short, stop=sellPoint,
oca_name="x", oca_type=strategy.oca.cancel)

// Exit our trade if our stop loss or take profit is hit


strategy.exit(id="Long Exit", from_entry="Long", limit=takeProfitLongSaved,
stop=stopLossLongSaved)
strategy.exit(id="Short Exit", from_entry="Short", limit=takeProfitShortSaved,
stop=stopLossShortSaved)

// Draw data to the chart


plot(dailyHigh, color=color.blue, linewidth=2, title="Daily High")
plot(dailyLow, color=color.blue, linewidth=2, title="Daily Low")
plot(buyPoint, color=color.purple, title="Buy Stop")
plot(stopLossLong, color=color.red, title="Long Stop Loss")
plot(takeProfitLong, color=color.green, title="Long Profit Target")
plot(sellPoint, color=color.purple, title="Sell Stop")
plot(stopLossShort, color=color.red, title="Short Stop Loss")
plot(takeProfitShort, color=color.green, title="Short Profit Target")

You might also like