0% found this document useful (0 votes)
208 views2 pages

Binary Option Auto Bot v2

The document outlines a trading strategy for a binary options auto bot using Pine Script. It includes user inputs for trading hours and volume thresholds, as well as indicators like moving averages and RSI for generating buy and sell signals. The strategy also tracks wins and losses, displays results in a table, and sets up alerts for trading signals.

Uploaded by

swapon
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)
208 views2 pages

Binary Option Auto Bot v2

The document outlines a trading strategy for a binary options auto bot using Pine Script. It includes user inputs for trading hours and volume thresholds, as well as indicators like moving averages and RSI for generating buy and sell signals. The strategy also tracks wins and losses, displays results in a table, and sets up alerts for trading signals.

Uploaded by

swapon
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/ 2

//@version=5

strategy("Binary Option Auto Bot v2", overlay=true,


default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// === User Inputs ===


enableTrading = input.bool(true, "Enable Trading")
startHour = input.int(9, "Start Hour (24h)", minval=0, maxval=23)
endHour = input.int(17, "End Hour (24h)", minval=0, maxval=23)
volumeThreshold = input.float(na, "Min Volume (Optional)", tooltip="Minimum volume
to validate signal")

// === Indicators ===


fastMA = ta.sma(close, 9)
slowMA = ta.sma(close, 21)
rsi = ta.rsi(close, 14)
overbought = 70
oversold = 30

// === Time Filter ===


inSession = (hour >= startHour and hour <= endHour)

// === Volume Filter ===


volValid = na(volumeThreshold) or volume > volumeThreshold

// === Moving Average Crossover ===


bullCross = ta.crossover(fastMA, slowMA)
bearCross = ta.crossunder(fastMA, slowMA)

// === Support & Resistance ===


pHigh = ta.pivothigh(high, 5, 5)
pLow = ta.pivotlow(low, 5, 5)
plotshape(pHigh, style=shape.triangledown, location=location.abovebar,
color=color.red, title="Resistance")
plotshape(pLow, style=shape.triangleup, location=location.belowbar,
color=color.green, title="Support")

// === Candlestick Patterns ===


// Engulfing
bullEngulf = close > open and open[1] > close[1] and close > open[1] and open <
close[1]
bearEngulf = close < open and open[1] < close[1] and close < open[1] and open >
close[1]

// Doji
doji = math.abs(close - open) <= (high - low) * 0.1

// Hammer / Shooting Star


hammer = close > open and (high - low) > 3 * (open - close) and (close - low) /
(.001 + high - low) > 0.6
shootingStar = open > close and (high - low) > 3 * (open - close) and (high - open)
/ (.001 + high - low) > 0.6

// Morning Star / Evening Star


morningStar = close[2] < open[2] and doji[1] and close > open
eveningStar = close[2] > open[2] and doji[1] and close < open

// === Entry Conditions ===


buySignal = enableTrading and inSession and volValid and bullCross and rsi <
oversold and (bullEngulf or hammer or morningStar)
sellSignal = enableTrading and inSession and volValid and bearCross and rsi >
overbought and (bearEngulf or shootingStar or eveningStar)

// === Plotting Signals ===


plotshape(buySignal, title="Call Signal", location=location.belowbar,
color=color.green, style=shape.labelup, text="CALL")
plotshape(sellSignal, title="Put Signal", location=location.abovebar,
color=color.red, style=shape.labeldown, text="PUT")

// === Trade Entries ===


if buySignal
strategy.entry("CALL", strategy.long)
if sellSignal
strategy.entry("PUT", strategy.short)

// === Win/Loss Counter ===


var int wins = 0
var int losses = 0

if strategy.opentrades == 0 and strategy.closedtrades > 0


result = strategy.closedtrades.profit(strategy.closedtrades - 1)
if result > 0
wins += 1
else
losses += 1

// === Display Table ===


var table winlossTable = table.new(position.top_right, 2, 2,
frame_color=color.gray)
if bar_index % 10 == 0
table.cell(winlossTable, 0, 0, "Wins", text_color=color.green)
table.cell(winlossTable, 1, 0, "Losses", text_color=color.red)
table.cell(winlossTable, 0, 1, str.tostring(wins))
table.cell(winlossTable, 1, 1, str.tostring(losses))

// === Alerts ===


alertcondition(buySignal, title="Call Signal Alert", message="Call Signal
Triggered!")
alertcondition(sellSignal, title="Put Signal Alert", message="Put
Signal Triggered!")

You might also like