The 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] * 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] * 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 -------\n'
label1 := ACC_result ? label1+'ACC\n' : label1
label1 := ADANIPORTS_result ? label1+'ADANIPORTS\n' : label1
label1 := AMBUJACEM_result ? label1+'AMBUJACEM\n' : label1
label1 := ASIANPAINT_result ? label1+'ASIANPAINT\n' : label1
label1 := AXISBANK_result ? label1+'AXISBANK\n' : label1
label1 := BAJAJ_AUTO_result ? label1+'BAJAJ_AUTO\n' : label1
label1 := BANKBARODA_result ? label1+'BANKBARODA\n' : label1
label1 := BHEL_result ? label1+'BHEL\n' : label1
label1 := BPCL_result ? label1+'BPCL\n' : label1
label1 := BHARTIARTL_result ? label1+'BHARTIARTL\n' : label1
label1 := BOSCHLTD_result ? label1+'BOSCHLTD\n' : label1
label1 := CIPLA_result ? label1+'CIPLA\n' : label1
label1 := COALINDIA_result ? label1+'COALINDIA\n' : label1
label1 := DRREDDY_result ? label1+'DRREDDY\n' : label1
label1 := GAIL_result ? label1+'GAIL\n' : label1
label1 := GRASIM_result ? label1+'GRASIM\n' : label1
label1 := HCLTECH_result ? label1+'HCLTECH\n' : label1
label1 := HDFCBANK_result ? label1+'HDFCBANK\n' : label1
label1 := HEROMOTOCO_result ? label1+'HEROMOTOCO\n' : label1
label1 := HINDALCO_result ? label1+'HINDALCO\n' : label1
label1 := HINDUNILVR_result ? label1+'HINDUNILVR\n' : label1
label1 := HDFC_result ? label1+'HDFC\n' : label1
label1 := ITC_result ? label1+'ITC\n' : label1
label1 := ICICIBANK_result ? label1+'ICICIBANK\n' : label1
label1 := IDEA_result ? label1+'IDEA\n' : label1
label1 := INDUSINDBK_result ? label1+'INDUSINDBK\n' : label1
label1 := INFY_result ? label1+'INFY\n' : label1
label1 := KOTAKBANK_result ? label1+'KOTAKBANK\n' : label1
label1 := LT_result ? label1+'LT\n' : label1
label1 := LUPIN_result ? label1+'LUPIN\n' : label1
label1 := M_M_result ? label1+'M-n-M\n' : label1
label1 := MARUTI_result ? label1+'MARUTI\n' : label1
label1 := NTPC_result ? label1+'NTPC\n' : label1
label1 := ONGC_result ? label1+'ONGC\n' : label1
label1 := POWERGRID_result ? label1+'POWERGRID\n' : label1
label1 := PNB_result ? label1+'PNB\n' : label1
label1 := RELIANCE_result ? label1+'RELIANCE\n' : label1
label1 := SBIN_result ? label1+'SBIN\n' : label1
label1 := SUNPHARMA_result ? label1+'SUNPHARMA\n' : label1
caption = label.new(bar_index, close, label1,color=color.blue,textcolor=color.black,style=label.style_labeldown,yloc = yloc.price)
label.delete(caption[1])
This code can be modified to search for other scripts by changing the condition function
condition() => open > (close[1] * 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] * 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 -------\n'
label1 := ACC_result ? label1+'ACC\n' : label1
label1 := ADANIPORTS_result ? label1+'ADANIPORTS\n' : label1
label1 := AMBUJACEM_result ? label1+'AMBUJACEM\n' : label1
label1 := ASIANPAINT_result ? label1+'ASIANPAINT\n' : label1
label1 := AXISBANK_result ? label1+'AXISBANK\n' : label1
label1 := BAJAJ_AUTO_result ? label1+'BAJAJ_AUTO\n' : label1
label1 := BANKBARODA_result ? label1+'BANKBARODA\n' : label1
label1 := BHEL_result ? label1+'BHEL\n' : label1
label1 := BPCL_result ? label1+'BPCL\n' : label1
label1 := BHARTIARTL_result ? label1+'BHARTIARTL\n' : label1
label1 := BOSCHLTD_result ? label1+'BOSCHLTD\n' : label1
label1 := CIPLA_result ? label1+'CIPLA\n' : label1
label1 := COALINDIA_result ? label1+'COALINDIA\n' : label1
label1 := DRREDDY_result ? label1+'DRREDDY\n' : label1
label1 := GAIL_result ? label1+'GAIL\n' : label1
label1 := GRASIM_result ? label1+'GRASIM\n' : label1
label1 := HCLTECH_result ? label1+'HCLTECH\n' : label1
label1 := HDFCBANK_result ? label1+'HDFCBANK\n' : label1
label1 := HEROMOTOCO_result ? label1+'HEROMOTOCO\n' : label1
label1 := HINDALCO_result ? label1+'HINDALCO\n' : label1
label1 := HINDUNILVR_result ? label1+'HINDUNILVR\n' : label1
label1 := HDFC_result ? label1+'HDFC\n' : label1
label1 := ITC_result ? label1+'ITC\n' : label1
label1 := ICICIBANK_result ? label1+'ICICIBANK\n' : label1
label1 := IDEA_result ? label1+'IDEA\n' : label1
label1 := INDUSINDBK_result ? label1+'INDUSINDBK\n' : label1
label1 := INFY_result ? label1+'INFY\n' : label1
label1 := KOTAKBANK_result ? label1+'KOTAKBANK\n' : label1
label1 := LT_result ? label1+'LT\n' : label1
label1 := LUPIN_result ? label1+'LUPIN\n' : label1
label1 := M_M_result ? label1+'M-n-M\n' : label1
label1 := MARUTI_result ? label1+'MARUTI\n' : label1
label1 := NTPC_result ? label1+'NTPC\n' : label1
label1 := ONGC_result ? label1+'ONGC\n' : label1
label1 := POWERGRID_result ? label1+'POWERGRID\n' : label1
label1 := PNB_result ? label1+'PNB\n' : label1
label1 := RELIANCE_result ? label1+'RELIANCE\n' : label1
label1 := SBIN_result ? label1+'SBIN\n' : label1
label1 := SUNPHARMA_result ? label1+'SUNPHARMA\n' : label1
caption = label.new(bar_index, close, label1,color=color.blue,textcolor=color.black,style=label.style_labeldown,yloc = yloc.price)
label.delete(caption[1])
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.