PROTECTED SOURCE SCRIPT

NSE: N50, BN, MIDCAP, FINNIFTY Gainers/Losers Jitendra

389
Summary of This Indicator


I Have Created This Gainers/Losers dashboard for selected NSE Indices
It is Divided in to symbol groups
1. Nifty Top 39 -High Weight Stocks
2. Nifty Rest 11-Remaining 11 Nifty stocks Low Weightage
3. Bank Nifty,
4. Financial Services,
5. Midcap Select

All Stock Used in Script is As per Latest Data Published by NSE, you can also check buy clicking below link

https://www.niftyindices.com/reports/monthly-reports

Main Features of Indicator

It Has Two Display Modes


Full Table → Shows each stock’s name and its daily % change, sorted from top gainer to top loser.

Compact Count Table → Shows just total number of gainers vs losers.

Customizable Inputs

  1. Choose symbol list (High-weight Nifty, Bank Nifty, etc.).
  2. Select table size (tiny → large).
  3. Control table position (Top/Bottom/Middle, Left/Right/Center).
  4. Customize gainer/loser colors.
  5. Option to toggle full table or compact table on/off.


Data Handling

  • Fetches each stock’s close price vs previous day using request.security().
  • Calculates % change for all symbols.
  • Uses a bubble sort function to arrange stocks in descending order of % change.


Outputs
  • Full Gainers/Losers Table (sorted, detailed).
  • Compact Summary Table (just counts).



After Selecting Nifty Indices

스냅샷


Data Fetch Command Summary


Symbol Loop & Data Fetch
Pine Script®
for i = 0 to array.size(symbolList)-1 sym = array.get(symbolList, i) [c, y] = request.security(sym, 'D', [close, close[1]]) chg = na(y) ? na : (c - y) / y * 100 if not na(chg) array.push(chgList, chg) // store % change array.push(nameList, sym) // store symbol name gainers += chg > 0 ? 1 : 0 losers += chg < 0 ? 1 : 0



Sorting Function (Bubble Sort, Descending by % Change)
Pine Script®
f_sortDesc(_a, _b) => len = array.size(_a) if len > 1 for i = 0 to len - 2 for j = i + 1 to len - 1 if array.get(_a, j) > array.get(_a, i) tempVal = array.get(_a, i) tempSym = array.get(_b, i) array.set(_a, i, array.get(_a, j)) array.set(_b, i, array.get(_b, j)) array.set(_a, j, tempVal) array.set(_b, j, tempSym)



Thanks

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.