Dear AB Gurus,
I have NSE (National Stock Exchange, India) Index NIFTY50 with a set of 50 stocks, NSE doesnt provide volume information as other exchanges of DJIA, NASDAQ, or other European Exchanges.
I need the volume information of Index across all time frames.
So i was looking below solutions
Solution 1:
Using Foreign Symbol 1 to n
Foreign("Symbol1", "V", Fixup = 1);
.
.
Foreign("Symboln", "V", Fixup = 1);
plot the volume
_SECTION_BEGIN("VolMubV1");
V_ADANIPORTS = Foreign("N.ADANIPORTS", "V", Fixup = 1);
V_AMBUJACEM = Foreign("N.AMBUJACEM", "V", Fixup = 1);
V_ASIANPAINT = Foreign("N.ASIANPAINT", "V", Fixup = 1);
V_AUROPHARMA = Foreign("N.AUROPHARMA", "V", Fixup = 1);
V_AXISBANK = Foreign("N.AXISBANK", "V", Fixup = 1);
V_BAJAJAUTO = Foreign("N.BAJAJ-AUTO", "V", Fixup = 1);
V_BAJFINANCE = Foreign("N.BAJFINANCE", "V", Fixup = 1);
V_BPCL = Foreign("N.BPCL", "V", Fixup = 1);
V_BHARTIARTL = Foreign("N.BHARTIARTL", "V", Fixup = 1);
V_INFRATEL = Foreign("N.INFRATEL", "V", Fixup = 1);
V_BOSCHLTD = Foreign("N.BOSCHLTD", "V", Fixup = 1);
V_CIPLA = Foreign("N.CIPLA", "V", Fixup = 1);
V_COALINDIA = Foreign("N.COALINDIA", "V", Fixup = 1);
V_DRREDDY = Foreign("N.DRREDDY", "V", Fixup = 1);
V_EICHERMOT = Foreign("N.EICHERMOT", "V", Fixup = 1);
V_GAIL = Foreign("N.GAIL", "V", Fixup = 1);
V_HCLTECH = Foreign("N.HCLTECH", "V", Fixup = 1);
V_HDFCBANK = Foreign("N.HDFCBANK", "V", Fixup = 1);
V_HEROMOTOCO = Foreign("N.HEROMOTOCO", "V", Fixup = 1);
V_HINDALCO = Foreign("N.HINDALCO", "V", Fixup = 1);
V_HINDPETRO = Foreign("N.HINDPETRO", "V", Fixup = 1);
V_HINDUNILVR = Foreign("N.HINDUNILVR", "V", Fixup = 1);
V_HDFC = Foreign("N.HDFC", "V", Fixup = 1);
V_ITC = Foreign("N.ITC", "V", Fixup = 1);
V_ICICIBANK = Foreign("N.ICICIBANK", "V", Fixup = 1);
V_IBULHSGFIN = Foreign("N.IBULHSGFIN", "V", Fixup = 1);
V_IOC = Foreign("N.IOC", "V", Fixup = 1);
V_INDUSINDBK = Foreign("N.INDUSINDBK", "V", Fixup = 1);
V_INFY = Foreign("N.INFY", "V", Fixup = 1);
V_KOTAKBANK = Foreign("N.KOTAKBANK", "V", Fixup = 1);
V_LT = Foreign("N.LT", "V", Fixup = 1);
V_LUPIN = Foreign("N.LUPIN", "V", Fixup = 1);
V_MM = Foreign("N.M&M", "V", Fixup = 1);
V_MARUTI = Foreign("N.MARUTI", "V", Fixup = 1);
V_NTPC = Foreign("N.NTPC", "V", Fixup = 1);
V_ONGC = Foreign("N.ONGC", "V", Fixup = 1);
V_POWERGRID = Foreign("N.POWERGRID", "V", Fixup = 1);
V_RELIANCE = Foreign("N.RELIANCE", "V", Fixup = 1);
V_SBIN = Foreign("N.SBIN", "V", Fixup = 1);
V_SUNPHARMA = Foreign("N.SUNPHARMA", "V", Fixup = 1);
V_TCS = Foreign("N.TCS", "V", Fixup = 1);
V_TATAMOTORS = Foreign("N.TATAMOTORS", "V", Fixup = 1);
V_TATASTEEL = Foreign("N.TATASTEEL", "V", Fixup = 1);
V_TECHM = Foreign("N.TECHM", "V", Fixup = 1);
V_UPL = Foreign("N.UPL", "V", Fixup = 1);
V_ULTRACEMCO = Foreign("N.ULTRACEMCO", "V", Fixup = 1);
V_VEDL = Foreign("N.VEDL", "V", Fixup = 1);
V_WIPRO = Foreign("N.WIPRO", "V", Fixup = 1);
V_YESBANK = Foreign("N.YESBANK", "V", Fixup = 1);
V_ZEEL = Foreign("N.ZEEL", "V", Fixup = 1);
V_NIFTY = V_ADANIPORTS + V_AMBUJACEM + V_ASIANPAINT + V_AUROPHARMA + V_AXISBANK + V_BAJFINANCE + V_BPCL + V_BHARTIARTL + V_INFRATEL + V_BOSCHLTD + V_CIPLA + V_COALINDIA + V_DRREDDY + V_EICHERMOT + V_GAIL + V_HCLTECH + V_HDFCBANK + V_HEROMOTOCO + V_HINDALCO + V_HINDPETRO + V_HINDUNILVR + V_HDFC + V_ITC + V_ICICIBANK + V_IBULHSGFIN + V_IOC + V_INDUSINDBK + V_INFY + V_KOTAKBANK + V_LT + V_LUPIN + V_MM + V_MARUTI + V_NTPC + V_ONGC + V_POWERGRID + V_RELIANCE + V_SBIN + V_SUNPHARMA + V_TCS + V_TATAMOTORS + V_TATASTEEL + V_TECHM + V_UPL + V_ULTRACEMCO + V_VEDL + V_WIPRO + V_YESBANK + V_ZEEL;
Graph0 = Plot (V_NIFTY, "Vol", colorBlueGrey, styleHistogram);
_SECTION_END();
The above solution freezes AB in realtime trading hours, non trading hours works good
Solution 2:
Using addtocomposite, its has to run on everytime frame
AddToComposite (V, "~NiftyComp", "V");
Graph0 = Plot (Foreign("~NiftyComp", "V"), "VolComp", colorBlueGrey, styleHistogram);
Buy = 1;
Solution 3:
Using composite recalculation tool, once all the composite is calculated, re run the composite at intervals, all the time frame charts are updated automatically, which seems to me a good solution and less time consuming and in trading hours works good.
Issue with Solution 3:
-
Cannot schedule this task there is no write up available to scheduling (may be i would have missed it searched whole night)
-
Advance Declines do not update dynamic and advance declines numbers calculated are wrong and remain static across the timeframe
_SECTION_BEGIN("AD Adv");
Plot( AdvIssues(), _DEFAULT_NAME(), ParamColor( "Color", ColorCycle ) );
_SECTION_END();
_SECTION_BEGIN("AD Dec");
Plot( DecIssues(), _DEFAULT_NAME(), ParamColor( "Color", ColorCycle ) );
_SECTION_END();
-
Looking for how to schedule "composite recalculation tool: with options of Number of advancing/declining issues, volume for base index, copy volume to all indexes, date range, and markets options. refer to attached picture preferable from OLE or outside AB (scheduler/scan) using windows scheduler as it gives lot of flexibility
-
Custom time in mins date range as this will reduce the processing time (have not explored the bars option)
-
Dynamic change of advance and decline across the time frames.
OR
is there any better solution other than the above.
@Tomasz @fxshrat @portfoliobuilder and other gurus all your help is appreciated.
Thanks