NextLevelBot - Automation Trading in Stock Market
hello everyone many of person want to strategy auto-strike price below a pine demo code with syntax //@version=4 strategy(title="Demo with auto strike price", shorttitle="Demo with auto strike price" , overlay=true) tradeType = input("BOTH", title="Choose…
and alert msg
{{strategy.order.alert_message}}//@version=4
strategy("zeeshan", shorttitle="zee", default_qty_type=strategy.percent_of_equity, default_qty_value=100, overlay=true)
//.....................................................................//
_1 = input(true,"══════════ Syntax ══════════")
tt = input("BUY", "CALL Side", options=["BUY", "SELL"])
tt_1 = input("BUY", "Put Side", options=["BUY", "SELL"])
ts = input("NIFTY", "CALL Symbol", input.string)
ts_1 = input("NIFTY", "PUT Symbol", input.string)
qty = input("75", "Quantity Value", input.string)
near = input("100", "CALL Side Near By", input.string)
near_1 = input("100", "PUT Side Near By", input.string)
cal = input("+0", "CALL Side Calculation", input.string)
cal_1 = input("+0", "PUT Side Calculation", input.string)
product = input("INTRADAY", "Product", options=["INTRADAY", "CNC", "NRML"])
_2 = input(true,"══════════ Syntax End ══════════")
//.....................................................................//
comm = input(0.07)
f_highest(_src, _length) =>
_adjusted_length = _length < 1 ? 1 : _length
_value = _src
for _i = 0 to _adjusted_length - 1 by 1
_value := _src[_i] >= _value ? _src[_i] : _value
_value
_return = _value
_return
f_lowest(_src, _length) =>
_adjusted_length = _length < 1 ? 1 : _length
_value = _src
for _i = 0 to _adjusted_length - 1 by 1
_value := _src[_i] <= _value ? _src[_i] : _value
_value
_return = _value
_return
dirmov(len) =>
up = change(high)
down = -change(low)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
truerange = rma(tr, len)
plus = fixnan(100 * rma(plusDM, len) / truerange)
minus = fixnan(100 * rma(minusDM, len) / truerange)
[plus, minus]
adx(dilen, adxlen) =>
[plus, minus] = dirmov(dilen)
sum = plus + minus
adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
adx
adxlen = input(18, title="ADX period")
adxMin = input(28)
useAdx = input(true)
dilen = adxlen
maLength = input(11)
s = input(title="Trend source", defval="wma", options=["ema", "sma", "rma", "wma"])
ema_1 = ema(close, maLength)
sma_1 = sma(close, maLength)
rma_1 = rma(close, maLength)
wma_1 = wma(close, maLength)
curEma = s == "ema" ? ema_1 : s == "sma" ? sma_1 : s == "rma" ? rma_1 : wma_1
highPeriod = input(34)
d = 0.1
d := na
d := nz(d[1])
takeProfitLong = highest(high, highPeriod)
stopLossLong = f_lowest(low, barssince(low >= curEma))
dir = 0
dir := nz(dir[1])
stopLoss = 0.2
stopLoss := 0
stopLoss := nz(stopLoss[1])
takeProfit = 0.2
takeProfit := 0
takeProfit := nz(takeProfit[1])
totalProfit = 0.2
totalProfit := 0
totalProfit := nz(totalProfit[1])
p = 0.1
p := 0
p := nz(p[1])
if dir != 0 and d >= low and d <= high
p := d
d := na
d
if dir != 0 and p != 0
if stopLoss <= high and stopLoss >= low
totalProfit := totalProfit +
(1 / p / (1 + dir * comm / 100) - 1 / stopLoss / (1 - dir * comm / 100)) * dir *
2000
dir := 0
p := 0
takeProfit := 0
stopLoss := 0
d := 0
d
else
if takeProfit <= high and takeProfit >= low
totalProfit := totalProfit + (1 / p / (1 + dir * comm / 100) - 1 / takeProfit) * dir * 2000
dir := 0
p := 0
takeProfit := 0
stopLoss := 0
d := 0
d
//Message alert inputs
Buy_Call = '[{"V":"NORMAL","TT":"'+ tt +'","E":"NFO","TS":"'+ ts +'{' +tostring(close) +'}CE","Q":"'+ qty +'","OT":"MARKET","P":"'+ product +'","VL":"DAY","NEAR":"'+ near +'","CAL":"'+ cal +'","AT":"ANGEL"}]'
Buy_Put = '[{"V":"NORMAL","TT":"'+ tt_1 +'","E":"NFO","TS":'+ ts_1 +'{' +tostring(close) +'}PE","Q":"'+ qty +'","OT":"MARKET","P":"'+ product +'","VL":"DAY","NEAR":"'+ near_1 +'","CAL":"'+ cal_1 +'","AT":"ANGEL"}]'
Exit_Call = '[{"AS":"'+ ts +'","E":"NFO","P":"'+ product +'","AT":"ANGEL"}]'
Exit_Put = '[{"AS":"'+ ts_1 +'","E":"NFO","P":"'+ product +'","AT":"ANGEL"}]'
if strategy.position_size == 0
if not useAdx or adx(dilen, adxlen) <= adxMin or high < curEma
strategy.cancel("Long")
if dir == 1
dir := 0
takeProfit := 0
stopLoss := 0
d := 0
d
if (not useAdx or adx(dilen, adxlen) > adxMin) and low < curEma and high > curEma and curEma > curEma[highPeriod / 2] and curEma > curEma[highPeriod] and takeProfitLong > high
strategy.cancel("Short")
strategy.order("Long", strategy.long, stop=high, alert_message=Buy_Call)
strategy.exit("Exit", "Long", limit=takeProfitLong, stop=stopLossLong, alert_message=Exit_Call)
d := high
dir := 1
stopLoss := stopLossLong
takeProfit := takeProfitLong
takeProfit
takeProfitShort = lowest(low, highPeriod)
stopLossShort = f_highest(high, barssince(high <= curEma))
if strategy.position_size == 0
if not useAdx or adx(dilen, adxlen) <= adxMin or low > curEma
strategy.cancel("Short")
if dir == -1
dir := 0
takeProfit := 0
stopLoss := 0
d := 0
d
if (not useAdx or adx(dilen, adxlen) > adxMin) and high > curEma and low < curEma and curEma < curEma[highPeriod / 2] and curEma < curEma[highPeriod] and takeProfitShort < low
strategy.cancel("Long")
strategy.order("Short", strategy.short, stop=low, alert_message=Buy_Put)
strategy.exit("Exit", "Short", limit=takeProfitShort, stop=stopLossShort, alert_message=Exit_Put)
d := low
dir := -1
stopLoss := stopLossShort
takeProfit := takeProfitShort
takeProfit
strategy.close("Exit")
plot(d, style=plot.style_circles, linewidth=4, color=color.black)
plot(p, style=plot.style_circles, linewidth=4, color=color.blue)
plot(stopLoss, style=plot.style_circles, linewidth=4, color=color.red)
plot(takeProfit, style=plot.style_circles, linewidth=4, color=color.green)
plot(totalProfit, color=color.purple, transp=100)
plot(curEma, color=color.black, linewidth=2)
plot(dir, color=color.purple, transp=100)
// === Backtesting Dates ===
testPeriodSwitch = input(false, "Custom Backtesting Dates")
testStartYear = input(2018, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testStartHour = input(0, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, testStartHour, 0)
testStopYear = input(2018, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(14, "Backtest Stop Day")
testStopHour = input(14, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, testStopHour, 0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
testPeriod_1 = testPeriod()
isPeriod = testPeriodSwitch == true ? testPeriod_1 : true
// === /END
if not isPeriod
strategy.cancel_all()
strategy.close_all()
NextLevelBot - Automation Trading in Stock Market
if strategy.position_size == 0 if not useAdx or adx(dilen, adxlen) <= adxMin or high < curEma strategy.cancel("Long") if dir == 1 dir := 0 takeProfit := 0 stopLoss := 0 d := 0 …
its auto strike price with strategy you can learn everything is dynamic no need to syntax. you can change according to you
Website and Web socket will be down Untill Next Update- We are upgrading Our Servers
Website and webhook is online please check every one and let us know if you face any issues.
Use /report to highlight to admin.
Use /report to highlight to admin.
Webhook url has been updated
@everyone one update it again who have change recently.
@everyone one update it again who have change recently.
i added auto login for these broker please check ur side ALICEBLUE, FYERSV2 ,ZERODHA, upstox