dennishh2024 Posted September 4 Report Share Posted September 4 Hi, I am trying to replicate a market-gauge. The preferred way to do this is to standardize the change on different instruments and compare them For example, take the standardized change of 3 more offensive ETF's (XLC, XLK, XLY( and compare then to 3 more defensive ETF's (XLP, XLU, XLV) to gauge if the market move is a risk sentiment one: (other example would be to take largecaps vs smallcaps) To standardize it a good way is good to use the daily ATR(14). So change XLC/ATR_XLC + change XLK/ATR_XLK + change XLY/ATR_XLK divided by change XLP/ATR_XLP + change XLU/ATR_XLU + change XLV/ATR_XLV That supposedly gives a line we can plot on an intraday chart. Let's call it the OD-line. I made a script for the scanner on a 1 day historical chart to calculate the ATR. It scans a list of 60 stocks/ETF's and displays the corresponding ATR in the scanner. How exactly is this stored? How is the link to the symbol made? How can I use this in a paintbar? My idea is to plot the OD-line on some chart, like using the compare symbol function to plot it on the $TICK-NYSE chart that already goed from +1000 to -1000. Is it possible to do this? I tried it but my program skills are lacking. See my attempt... Do I have to retrieve and store individual symbol ATR by an unique name? For reference I included the Pinescript from TradingView. Any help is appreciated. Pinescript_odline.txt scan 1day historical.txt attempt at ODline.txt Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted September 8 Report Share Posted September 8 Ok - that OD line - is it the same thing for every chart? That is - it is XLC... XLY (6 symbols) combo and that's used then on every chart? Quote Link to comment Share on other sites More sharing options...
dennishh2024 Posted September 9 Author Report Share Posted September 9 No just on one chart. You treat it like the NYSE-Advance-Decline, or TICK-NYSE. TRIN-NYSE. o gauge where the market is going and if it is a sustained broad move or just on a few names. But the standardized way of comparing is the interesting part. It allows in a single line/paintbar all this information. You could do it with offensive sector ETF vs Defensive sector ETF. Or Mag7 stocks vs SPY/NDX. Or Mega caps ETF vs Small Caps ETF. It just needs the historical ATR and store it. And then recall it in an intraday paintbar script, and use it in the calculation. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted September 9 Report Share Posted September 9 Here is the easiest and most efficient way.. 1. Make a portfolio that contains XLP, XLC, XLY etc. - the 6 symbols. 2. Make a historical scan that just has ATR in it, calculates Change/ATR (make sure to check for 0) and does a SetInterVar(SymbolData.Symbol+"-ATR") for it. Run it on that 6 symbol portfolio separately. 3. In your paintbar or scan that wants to utilize those values, do the GetInterVar("XLC-ATR"), GetInterVar("XLP-ATR") etc, then use those values to do your calculation (again, check for 0 when you divide :)) and do a SetYValue() for that in order to show it on the chart. Quote Link to comment Share on other sites More sharing options...
dennishh2024 Posted September 10 Author Report Share Posted September 10 historical scan script: See picture of scanresults. Paintbar script: And then I get these errors on line 18 "double ODline = offense_move - defense_move;" Error CS0650 CS0270 about matrix declaration. And I can't figured what to change. I searched the internet for these codes but that didnt help. Could you point me in the right direction? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted September 11 Report Share Posted September 11 Send me both scripts to support@medvedtrader.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.