Scanner
Custom GAP UP scanner for NIFTY StocksThe security function can be called 40 times in a code. We can therefore scan about 40 stocks out of NIFTY 50 stocks with a single script.
This code can be modified to search for other scripts by changing the condition function
condition() => open > (close * 1.0025)
Only stocks which have gap up of 0.25% or more will be reported.
// This source code is subject to the terms of the Mozilla Public License 2.0
// © achalmeena
// Reference E-Book - Teach Yourself Coding Indicators PineScript
// Udemy course on Creating trade strategies backtesting using pinescript
//@version=4
study("Nifty - Gap up Screener", overlay = true)
condition() => open > (close * 1.0025)
ACC_result = security('ACC', 'D', condition())
ADANIPORTS_result = security('ADANIPORTS', 'D', condition())
AMBUJACEM_result = security('AMBUJACEM', 'D', condition())
ASIANPAINT_result = security('ASIANPAINT', 'D', condition())
AXISBANK_result = security('AXISBANK', 'D', condition())
BAJAJ_AUTO_result = security('BAJAJ_AUTO', 'D', condition())
BANKBARODA_result = security('BANKBARODA', 'D', condition())
BHEL_result = security('BHEL', 'D', condition())
BPCL_result = security('BPCL', 'D', condition())
BHARTIARTL_result = security('BHARTIARTL', 'D', condition())
BOSCHLTD_result = security('BOSCHLTD', 'D', condition())
CIPLA_result = security('CIPLA', 'D', condition())
COALINDIA_result = security('COALINDIA', 'D', condition())
DRREDDY_result = security('DRREDDY', 'D', condition())
GAIL_result = security('GAIL', 'D', condition())
GRASIM_result = security('GRASIM', 'D', condition())
HCLTECH_result = security('HCLTECH', 'D', condition())
HDFCBANK_result = security('HDFCBANK', 'D', condition())
HEROMOTOCO_result = security('HEROMOTOCO', 'D', condition())
HINDALCO_result = security('HINDALCO', 'D', condition())
HINDUNILVR_result = security('HINDUNILVR', 'D', condition())
HDFC_result = security('HDFC', 'D', condition())
ITC_result = security('ITC', 'D', condition())
ICICIBANK_result = security('ICICIBANK', 'D', condition())
IDEA_result = security('IDEA', 'D', condition())
INDUSINDBK_result = security('INDUSINDBK', 'D', condition())
INFY_result = security('INFY', 'D', condition())
KOTAKBANK_result = security('KOTAKBANK', 'D', condition())
LT_result = security('LT', 'D', condition())
LUPIN_result = security('LUPIN', 'D', condition())
M_M_result = security('M_M', 'D', condition())
MARUTI_result = security('MARUTI', 'D', condition())
NTPC_result = security('NTPC', 'D', condition())
ONGC_result = security('ONGC', 'D', condition())
POWERGRID_result = security('POWERGRID', 'D', condition())
PNB_result = security('PNB', 'D', condition())
RELIANCE_result = security('RELIANCE', 'D', condition())
SBIN_result = security('SBIN', 'D', condition())
SUNPHARMA_result = security('SUNPHARMA', 'D', condition())
label1 = '------Nifty40 GapUps ------- '
label1 := ACC_result ? label1+'ACC ' : label1
label1 := ADANIPORTS_result ? label1+'ADANIPORTS ' : label1
label1 := AMBUJACEM_result ? label1+'AMBUJACEM ' : label1
label1 := ASIANPAINT_result ? label1+'ASIANPAINT ' : label1
label1 := AXISBANK_result ? label1+'AXISBANK ' : label1
label1 := BAJAJ_AUTO_result ? label1+'BAJAJ_AUTO ' : label1
label1 := BANKBARODA_result ? label1+'BANKBARODA ' : label1
label1 := BHEL_result ? label1+'BHEL ' : label1
label1 := BPCL_result ? label1+'BPCL ' : label1
label1 := BHARTIARTL_result ? label1+'BHARTIARTL ' : label1
label1 := BOSCHLTD_result ? label1+'BOSCHLTD ' : label1
label1 := CIPLA_result ? label1+'CIPLA ' : label1
label1 := COALINDIA_result ? label1+'COALINDIA ' : label1
label1 := DRREDDY_result ? label1+'DRREDDY ' : label1
label1 := GAIL_result ? label1+'GAIL ' : label1
label1 := GRASIM_result ? label1+'GRASIM ' : label1
label1 := HCLTECH_result ? label1+'HCLTECH ' : label1
label1 := HDFCBANK_result ? label1+'HDFCBANK ' : label1
label1 := HEROMOTOCO_result ? label1+'HEROMOTOCO ' : label1
label1 := HINDALCO_result ? label1+'HINDALCO ' : label1
label1 := HINDUNILVR_result ? label1+'HINDUNILVR ' : label1
label1 := HDFC_result ? label1+'HDFC ' : label1
label1 := ITC_result ? label1+'ITC ' : label1
label1 := ICICIBANK_result ? label1+'ICICIBANK ' : label1
label1 := IDEA_result ? label1+'IDEA ' : label1
label1 := INDUSINDBK_result ? label1+'INDUSINDBK ' : label1
label1 := INFY_result ? label1+'INFY ' : label1
label1 := KOTAKBANK_result ? label1+'KOTAKBANK ' : label1
label1 := LT_result ? label1+'LT ' : label1
label1 := LUPIN_result ? label1+'LUPIN ' : label1
label1 := M_M_result ? label1+'M-n-M ' : label1
label1 := MARUTI_result ? label1+'MARUTI ' : label1
label1 := NTPC_result ? label1+'NTPC ' : label1
label1 := ONGC_result ? label1+'ONGC ' : label1
label1 := POWERGRID_result ? label1+'POWERGRID ' : label1
label1 := PNB_result ? label1+'PNB ' : label1
label1 := RELIANCE_result ? label1+'RELIANCE ' : label1
label1 := SBIN_result ? label1+'SBIN ' : label1
label1 := SUNPHARMA_result ? label1+'SUNPHARMA ' : label1
caption = label.new(bar_index, close, label1,color=color.blue,textcolor=color.black,style=label.style_labeldown,yloc = yloc.price)
label.delete(caption )