Yes to be specific, the Incredible Charts Comparison type setup, but only with the XDJ index snapped into single charts in BC, so I can judge how far above, equal to, below, each stock in the list is compared to the XDJ / XAO index.
Execution wise it appears to be a series of moving averages and if that hunch is right you may not need BCFL, but I cannot see the specifics on what you are trying to replicate.
I would like to get a price chart overlay
intercept for: Security("$XDJ.XASX", C) if it can be done through BCFL code, and then saved to a function key, so that it intercepts each stock I review from the left hand side.
If I use moving averages for the index, what would be the best direction to take to get an intercept working like you see in I.C.
Overlaying a Formula indicator, set as a moving average doesn't link the two different indexes; price and base index level, and resultant price chart will look squished to allow for the higher index.
So normalising the two data sets is the fist step? matching one data set to the others index level automatically as an overlay overlaid, at the chart window loaded data start period, or at a specific point in time like 4 weeks ago.
Could 'Value When' have some importance?
[Lookup & Reference]
Returns the value of the DATA ARRAY when the EXPRESSION was TRUE on the Nth most recent occurrence.
This includes all data loaded for the security according to the PERIOD selection on the CHART tab.
SYNTAX valuewhen(Nth, EXPRESSION, DATA ARRAY )
I was thinking the RSC could be the way in to normalising data to the sector or index used in the code, but when I set up two RSC's in the one formula the second one didn't plot out, or no output. Not sure why. I might try this again tomorrow.
One thing I have noticed is that the reference index ($XDJ) represents as almost a flat linein IC's charts much like a MA / Envelope set to 500 or so. If the MA could be the actual XDJ line and matched to a data time period point.
I guess its all about the breakout range from the envelopes set at 15% or whatever, so just a moving average envelope might do? as that out sets itself on each chart. need to think this out more. I have a % above a MA line code for an indicator, might set it to 500 and see if it works similar to IC's Comparison.
As far as I can find there isn't a lot on normalising data sets in Metastock there being only one post on their forum about it, and I'm not sure what its about.
https://forum.metastock.com/posts/t144349--Normalized--Relative-Strength-ComparativeThe best I can do is search for others formulas, and by asking questions here. Much of the formula I'll be cut and pasting from others work, if I can find something substantial enough to use.
Post Edit:
Just as a final edit to this post; I have worked the Moving Average Envelope up with the Percent Above MA indicators (Separately, see attached snapshot). If the Moving Average 500 were to actually be the XDJ index line, this would work as a comparison to index. But I can't get my head around how to link the one to many index scales. 'One' being the XDJ, the 'many' being the stock price data charts.
Code here. I tried adopting the RSC code into the MA but didn't work:
> - - - - - - <
{ RSC }
COMP1 := Security("$XDJ.XASX", CLOSE);
RSC1 := (CLOSE / COMP1){*1000000};
MA1 := MOV(CLOSE,500,E);
{ McGinley MA }
MA2 := Ref(Mov(C,60,E),-1)+((C-(Ref(Mov(C,60,E),-1))) / (C/(Ref(Mov(C,2,E),-1))*10));
{ MA Envelope Bands }
Band_upper_inner := Mov(MA1, 1,E) + 0.5;
Band_lower_inner := Mov(MA1, 1,E) - 0.5;
Band_upper_outer := Mov(MA1, 1,E) + 1;
Band_lower_outer := Mov(MA1, 1,E) - 1;
MA1;
MA2;
Band_upper_inner;
Band_lower_inner;
Band_upper_outer;
Band_lower_outer;
> - - - - - - <
This MA1 code doesn't reflect the price chart accurately enough.
{Percent Above/Below Moving Average}
MA1 := ROC(CLOSE, 500, %);
MA2 := MOV(MA1, 50, E);
LINE1 :=0;
LINE1_UP:=50;
LINE1_DN:=-50;
LINE2_UP := 100;
LINE2_DN := -100;
MA1;
MA2;
LINE1;
LINE1_UP;
LINE1_DN;
LINE2_UP;
LINE2_DN;
> - - - - - - <
First Image is of code above in BC.
Second Image IC chart of MP1 and 500EMA bands with Comparison $XDJ
Third Image is the $XDJ with EMA500 Bands and comparison MP1.
I don't think the third will work in BC to flip through stock charts as you can't load in comparison stocks like in I.C. , but the Second would so is my preferred layout, if I can get the MA Bands to fit to the index line not the price chart.