Author Topic: Help with BCFL custom Scans & Coding  (Read 4088 times)

0 Members and 1 Guest are viewing this topic.

Offline Campbell Sinclair

  • Support & Administration
  • Administrator
  • *****
  • Posts: 225
Re: Help with BCFL custom Scans & Coding
« Reply #105 on: 30/09/2019, 05:01:53 PM »
Rate of Change shows the % or points move between day x and day y. So Really good check to ensure overall movement from point A to point B is all positive along the way.

For a 1 day paramter input, the expanded version is this:

TODAY := ((Close - REF(Close, -1)) / Ref(Close, -1)) * 100;
TODAY;

Offline JohnR

  • Jr. Member
  • **
  • Posts: 69
Re: Help with BCFL custom Scans & Coding
« Reply #106 on: 01/10/2019, 12:06:26 AM »
Great thanks.
Have added a 3 day 'Total' percent gain for ranking stocks in both SPA3 watch lists, this gives a better way to rank (that which has gone up already).
It really does highlight what i have missed out on as my portfolio has no where near the listed gains over last 3 days as the scan indicate.

I'm going to run these percent gain scans for a week or so and think about how this could be implemented into trade actions or how it can be 'indicator' related to making more precise trade decisions. In fact I've missed quite a few high ranking stocks, more so for the Friday scans after markets close; the shear number is difficult to deal with, and all the SPA3 scan results look positive, and funds will only go so far.

It's an eye opener, I suspect the ROC indicator would be the choice indicator for furthering these studies.
As a side project I experimented by dropping the system SIROC onto the ROC indicator to get a nice midway indicator, but are unable to BCFL code for this, so constructed my own Smoothed Indexed ROC of the ROC indicator that fits very closely to the SIROC of the ROC, so will proceed to code this up for triggers and scans.
{SI_ROC}
ROC1 := MOV(ROC(CLOSE,13,%),1,E);
RMI_IN := RMI(CLOSE,8,21);
SI_ROC:= RSI(MOV(((ROC1 + RMI_IN)/2),5,E),13);
SIGNAL := MOV(SI_ROC, 13, W);

I'm wondering if you could lend your experience with some ideas to clarify the percent gain scans for identifying changing states to higher performance (without having to view individual charts), just a few pointers nothing in detail? Of course the thing I'm looking for with the percent gain scans is being able to identify at the earliest opportunity, the winning quadfecta from the pack, through scans.

The following could be implemented:
a) Deviation from an average range percentile band AND report any change in states to a column (not sure how yet), either be a percentage calculation or indicator condition or level.
b) Could scan data sheet cell background or text be coloured to highlight the change in the state of the above; like green for positive and red for negative and black for within range?
c) Can all stocks within a watch list be overlaid onto a single chart, so any higher performing stock would rise above the pack and be identifiable (see attached image), but would need to be automatic in including additions and deletions from a watch list.

I'll be adding to this list as ideas cross my desk.
« Last Edit: 02/10/2019, 12:49:45 PM by JohnR »

Offline Campbell Sinclair

  • Support & Administration
  • Administrator
  • *****
  • Posts: 225
Re: Help with BCFL custom Scans & Coding
« Reply #107 on: 03/10/2019, 11:22:31 AM »
I would not use the datasheet for state changes detection via colouring or highlighting. You already have the info at hand really. Instead combine the criteria for what you are looking for to another variable and output that to the datasheet. The main focus of Beyond Charts has always been on the charts themselves rather than the datasheets.

Remember this type of calculation will give 1 for yes, 0 for no:

Check_State := THIS AND THIS_2 AND THIS_3;

If the criteria for This_n are met, then the criteria for Check_State will be met. Having this column would cover the need for looking at THIS_n etc in the datasheet.

With regards to how to detect the highest of performing stocks off the back of SPA3 signals, that is definitely a question. One of the parts of trend following is that the trend has to be there and forming already. Otherwise it cannot be a trend to follow. We take the philosphy that anything can happen and try not to curve fit the signals but still retain a positive portfolio edge.

You probabilistically could find something that may work well enough for you to be happy using going forward for what you are looking to do. In an ideal world it would be something that only works for trades that perform highly (what you seem to be interested in) and not ones that are sideways or low or under performing. Whatever you find, will highly likely end up being a 'degrees of' working and not something with a 100% hit rate, or close to, of excluding stocks that you are not interested in. That would be something worthwhile to keep in mind. 

All I can offer otherwise is that we are a trend following system, so looking in to what builds toward a strong uptrend could be a focus. A set of criteria that has a high occurance rate in what you would have preferred to enter in to. As a simplistic recap - we already look in to what is an established trend, is outperforming the market and by patterns of our technical indicators has a high probability of continuing.

Multi Charts -- you can only do this using the base reference indicator but it is not maintainable based off inputs to a watch list. Here is a video that will be put in the new TutorMe once all the videos are ready: https://vimeo.com/354807148/0313402360

Offline JohnR

  • Jr. Member
  • **
  • Posts: 69
Re: Help with BCFL custom Scans & Coding
« Reply #108 on: 04/10/2019, 12:30:42 PM »
Thanks Campbell, you've given me something to think about, it will need time to peculate.
A referenced dynamic Ratio system sounds the goods.

I have come to realised the percent gain scan column results (in the above post image) column are not the end result, but the basis of other results, so will not publish those columns but use them for further calculations like ratios of some sort.
What I really need is a ranking system that is able to be tracked visually from day to day, so measurable and quantifiable from casual observation.

Like the above post attachment of the comparison charts showing the breakout from a moving average envelope, or based on an inception point / date, or maybe a price equalisation point for all the stocks being scanned back referenced  by x bars? I'm simply not sure at this stage and will probably need to enlist the proverbial 100 monkeys on keyboards to code this up.

I think if I can nail the above percent scans to narrow down potential gainers to the portfolio list of 10 to 14 stocks as ranked in order of fund allocations, before they really get going, would be ideal; it will suffice for my usage and I can finally go forward with greater confidence into real money trading. I doubt I will need anything more in way of charts and signals, as I have exhausted myself chasing indicator setups and trading techniques over the last 9 months. The only charts I want to see now are the system trigger charts.

So working with the SPA3 system 'forge' in this data sheet way, will further sharpen 'the edge'. And I need a sharpened edge as my funds will only go so far and my SPA3 Investor portfolio is only $361 up as of 5/10/19 after about 8 months having fallen from 5k up 3 weeks ago. At this time my SPA3 Trader portfolio shows the better gains being 10K up. And I have had to employ dynamic management to cut losing trades faster than system triggers to prevent larger losses, and in some cases this has not helped as the stock had dropped then re-gained its positive momentum, by which time I had moved funds on to a newly triggered stock.
Granted it's been a tough year for any portfolio, alas I remain a bit disappointed, more with not being able to choose the better gainer stocks of the last 8 months, or moving into them far too late from Pyramid points.
« Last Edit: 07/10/2019, 01:35:31 PM by JohnR »

Offline Campbell Sinclair

  • Support & Administration
  • Administrator
  • *****
  • Posts: 225
Re: Help with BCFL custom Scans & Coding
« Reply #109 on: 07/10/2019, 02:13:49 PM »
Remember we have backtested 1000s of portfolios, who take different signals at different times (which is how we come to the 1000s of portfolios). These exits that in combination with money management, provide an edge that results in a rising equity curve. The range of equity curves over the many portfolio outcomes all outperform the market over the long term. 

Using BCFL or fine tuning a selection process is not necessary for SPA3 operation. Based on that most of our customers do not use BCFL for stock selection purposes. When more stocks come up than capital available, all you need is consistent process that can be analytical or non-analytical (ie. A to Z or choosing a letter from the alphabet based on the time of the month). A BCFL can help refine the returns, but does require some amount of effort for an unknown additional change to the edge.

As for the oscilliation, what is described can help narrow the range to index against a value like 100 - not oscillate between 0 and 100. So you can see how it is relative to a given point by it dripping above or below the indexed value.

What you are asking for is how to scale a variable to be between 0 and 100. This is functional maths and is quite simple once you have found the bottom and top for your data. To use the below for other variables, change what is being fed in to data:

{ Move Variable to Scale }
data := ROC(C, 100, %);

max_new := 100;
min_new := 0;
max_old := hhv(data, cum(1));
min_old := llv(data, cum(1));

dot1 := (max_new - min_new) / (max_old-min_old);
dot2 := (data - min_old) + min_new;

result := dot1 * dot2;

result;

I did mean to post this on friday but some interactions with website tools on the server were taking place that stopped the forum updating for a short moment. The above is what I was going to post. Now for indicator values in a formula for scan output, the scan only looks at the indicator you give it. There are a few ways I can take the question, so here are a couple of statements that I think might be the most relevant.

The scan only looks at the variable you want to 'plot' on a chart. In the above case, it is the result variable (as it's on its own line: result;). You can change this to any earlier variable used like dot1 or dot2 and that is the criteria the scan will use. I recommend making the output the last variable created in the formula where possible because you can easily see what a formula is doing this way. 

Otherwise if you want an indicator to be part of a SHOWCOL(...); output, then you will need to either use a BCFL function if available or re-create the indicator as part of the formula. 

Pre-Edit: I see the post has changed again. Trademaster usually does the position size sorting, although you will not be able to take everything across in to Trademaster from a BCFL scan. You can save potential trades in trademaster and access them again via act on -> saved prospects after bringing them in to TradeMaster. 

Everyones portfolio experiences are different, and it is dissapointing to hear of the rapid decrease in value over the last few weeks. It would be best to email David McCulloch directly if you want to discuss your portfolio in fine detail - I can also have him get in touch with you as well - for support with portfolio execution.

Offline JohnR

  • Jr. Member
  • **
  • Posts: 69
Re: Help with BCFL custom Scans & Coding
« Reply #110 on: 07/10/2019, 08:23:54 PM »
Yes I did update the post sorry about that   :blush: several times in fact, it takes me a few attempts to get them right, and as I do work on the subject some content tends to become non relevant as I find a solutions myself. I can see how this could be annoying whilst trying to track a users questions so please bare with me while I refine it all. I only expect an end of week or once a week response or when ever you get the time, no hurry at all.

I will eventually (very soon) have to down scale my efforts to finding an optimised edge, its taking up far too much of my time in BCFL, hence my focus on percentage gains at this point on System scanned stocks collected in watch lists, to sort the short list of System scan results down to the most profitable gainers before they get going. To assist with this I have spent the last week looking at ROC indicators and percent gain scan results, I have a promising basic set up (see attachments), although I would like to get a ranking system up and running (doing google research - nothing yet).
I'm happy to be using the SWS system, and beginning to realise I wouldn't want to be using any other platform to capture trend and preserve trading capital.

Quote
Remember we have backtested 1000s of portfolios, who take different signals at different times (which is how we come to the 1000s of portfolios). These exits that in combination with money management, provide an edge that results in a rising equity curve. The range of equity curves over the many portfolio outcomes all outperform the market over the long term.

Using BCFL or fine tuning a selection process is not necessary for SPA3 operation. Based on that most of our customers do not use BCFL for stock selection purposes. When more stocks come up than capital available, all you need is consistent process that can be analytical or non-analytical (ie. A to Z or choosing a letter from the alphabet based on the time of the month). A BCFL can help refine the returns, but does require some amount of effort for an unknown additional change to the edge.

I understand the principal of the system, your explanations are helpful, my problems arise as a user based experience over the last 8 to 9 months, and how I think there could be improvement for narrowing the field to thoroughbred only race more suitable to my portfolio and cash allocation sizing. I don't see a problem with this, and the tools are there to use in BCFL. If this can be achieved as a scan it will save me time having to go through dozens of extra charts every night/day.

For broader market stock selection I agree you don't need anything more than the system selection criteria offers, and the additional complexity to implement a selection and trading system seems to be a fruitless and very time consuming effort. So I'm now working at scanning within the SPA3 Trader & Investor triggered stock selection group; added to a watch list collection, and as there is no way to screen for open trade stocks this is the best I can do, but it also drags in closed trades of prior triggered stocks, that may well be still in-trend but  are closed system trades (MA and MACD cleanser scan isolates non trending stock from the watch list fortnightly). The draw back are dozens of candidates that I'm trying to narrow down via a ranking system. This can also be applied to New Entries scans that have more than a few to select from just by adding them to the watch list.

The other software package I was (and still are) looking at is VectorVest where they have a stock ranking system of; Relative Value (RV), Relative Safety (RS), and Relative Timing (RT), used by the software.
It might be comparing (SWS software) apples with bananas, but if it works it works. They also have a Realtime Derby type overview of the market to identify outperforming stocks over periods of time,
If you aren't aware of them see link here: https://www.vectorvest.com.au/how-it-works/


So just thinking out aloud to overview the potential ranking system inputs in BCFL, in this same way; there could be a value assigned for a bunch of indicators crossing points (MA, and MACD or better the PPO) how long ago, and at what index level, indicators with overbought and oversold index levels, ATRVE level, volumes over period of time, percentage gains or price rises over same period etc. reduced to a numerical value and added together, normalised to derive at a value ranking measure, then reported in a scan column. This could be the way to compare different stocks at least. And then if this value could be then compared with the value of previous periods, maybe that would indicated an improvement, or not, going forward in individual stocks.

I'm wondering how the SPA3 Trader system scan outputs can be used in way of getting a ranking system: ATRVE, Liquidity, Market Cap, and Sector Risk.
How accurate is the ATRVE in ranking stocks? as I haven't paid much attention to this. I remember ATRVE being explained as an answer to one of my very initial questions about how do you select from multiple SPA3 scan results the best few stocks, but when I looked into it I saw no noticeable correlation to higher trend performance, maybe just volatility?, and for higher levels being overbought, but may have overlooked something there. I note the ATRVE index levels for Trade Master trade entry requirements.

Quote
Everyones portfolio experiences are different, and it is disappointing to hear of the rapid decrease in value over the last few weeks. It would be best to email David McCulloch directly if you want to discuss your portfolio in fine detail - I can also have him get in touch with you as well - for support with portfolio execution.
Ok thanks for the offer, I might follow up on this after a few weeks just to see if I can get a recovery happening myself with the new percentage scan selections. I've recently (about 5 weeks ago) adjusted the TM capital allocation to half what it was (now around 5k per stock) due to recent market uncertainty and volatility, and staying largely in cash whilst having a few punts, so profit amounts are down accordingly (one of the trading techniques I mentioned previously) I've been trying different things to compare the outcomes while still doing simulation trades. For a long while there it was the Trader portfolio that was lagging behind the Investor one, so glad to see it pick up recently, but I have had to micro manage trades in IRESS for hours every day, something I want and need to get away from, as I simply can't do this from the deck of a yacht in the middle of the Pacific.

Re the ROC Oscillator; Although my focus is now on the ranking scan system,  I did give the ROC oscillator formula a go but couldn't get it looking right and was clearly way off the mark by several dozen monkeys! What you have done looks good, if a bit raw without other code, adding mov() smoothing tends to just introduces lag. It's a basic start though and gives me the basis of adding other indicators as oscillators.

The only problem with the basic code (due to CUM(1)) is that previous data sets the index to 100 and caps more recent data (see attached chart lower panel for the oscillator), so that recent highs are not indexed to the same higher levels but are constrained. I guess this would mean employing more complex formula code.

Having had a poke around in BCFL Quick Reference I realise the CUM(1) starts indexing from day one of the price data history so replace with this:
max_old := hhv(data, 1000);
min_old := llv(data, 1000);
But this slams the recent highs up flat onto the 100 line in some cases.  Is there a bit of code that will dynamically scale data to index levels from period to period? that's about all I can offer in way of description.
[Edit] Found the Williams code piece does a good job at smoothing (for data input) and using PER() for NumPeriods, although this is not ROC any more.

NumPeriods:= PER();
data := MOV((((HHV(H,NumPeriods) - C)/(HHV(H,NumPeriods) - LLV(L,NumPeriods))) * -100),63,W);

max_new := 100;
min_new := 0;

max_old := hhv(data, cum(1));
min_old := llv(data, cum(1));

{max_old := hhv(data, 1000);}
{min_old := llv(data, 1000);}

dot1 := (max_new - min_new) / (max_old-min_old);
dot2 := (data - min_old) + min_new;
result := dot1 * dot2;

SIGNAL := MOV(result, 21, E);

result;
SIGNAL;

p.s. The system SIROC seems to be the perfect tuned indicator, even working far better than the RSI used in the RSIMH (RSI of the MACD histogram), but without access to it in BCFL there nothing I can do with it. The Metastock code of the public domain SIROC that I modified fits very closely to standard 21:8 but when deployed for the MACDH distorts and is useless.

p.s.s. The 'Base Reference Indicator' seems not available in BCFL? if it were those normalised current values could be reported for comparison in scans between scan candidates.
« Last Edit: 10/10/2019, 11:16:04 AM by JohnR »

Offline JohnR

  • Jr. Member
  • **
  • Posts: 69
Re: Help with BCFL custom Scans & Coding
« Reply #111 on: 10/10/2019, 12:30:23 PM »
Quote
Using BCFL or fine tuning a selection process is not necessary for SPA3 operation. Based on that most of our customers do not use BCFL for stock selection purposes. When more stocks come up than capital available, all you need is consistent process that can be analytical or non-analytical (ie. A to Z or choosing a letter from the alphabet based on the time of the month). A BCFL can help refine the returns, but does require some amount of effort for an unknown additional change to the edge.
Ok I think I need to understand what the broader user base is using BCFL for as you seem to have a good understanding of this?

More stocks are continually coming up than I have capital for, and about 50 percent of my portfolio is in varying stage of losses slightly down from gains at any one time. At which point I then go through and cull the worst 2 to 3 stocks on any day to replace them with new incoming entries. It's a tricky business requirng watching IRESS for most of the day, and that I want to get away from doing, so to level out and understand and have better tools for this whole process of do I hold or do I cut, based on a scan ranking system.

Ok so lets take the day of the month example from your quote extract above; lets say first day of the month (or week) as the comparison point of reference for price for all stocks that SPA3 has identified as trade-able from within a watch list as the 'analytical' and apposed to the 'non analytical' "A to Z or choosing a letter from the alphabet based on the time of the month".

How would I code to normalise all stock prices to be comparable? so that higher moving prices on the third day and forth day etc. could be identified in a scan column?
I think it is a 'normalisation code' that could then be applied to other aspects of variables like indicators, index levels, price to volume ratio, percent gains etc. Do you think this is doable in BCFL?
Could it be done by the reduction to a decimal like 0.1 or -0.1 so that adding all the variable decimals within the scan can then be added together to give a total tally for comparison purposes.

Separately but on the same agenda;
Next up is getting the RSI value to work so that the % value today is less or more than the value previous bar ago to asses if the RSI is rising or falling by x percent value over time:

I get the impression your head, Campbell, is chock full of stock formula code, so humbly ask once again if you could try solve the following:
I've tried a number of ways to get it to work without any success, it's another of those standard formula sequences that could be used for different indicators to replace the RSI with like ROC or moving average etc.;

The output I'm looking for is to get a single negative (-3) or positive (+3) % (or number) value output, so I can see if the indicator\price\anything is rising or falling in a scan column. I'm sure its trickier than it first appears so take your time no hurry.

This is what I started with and not sure if I'm heading in the right direction at all does it require the IF() statement:

%DAY_0 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -1)) * 100;
%DAY_1 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -2)) * 100;
%DAY_2 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -3)) * 100;
%DAY_3 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -4)) * 100;


I'll post the full scan code of what I have done so far, as you can see the RSI columns are too numerous and needs to be two column for RSI value and percent gain or loss:

MAM := FMLVAR("MA 60:90","MAM1");
MAS := FMLVAR("MA 60:90","MAS1");
ROC_LEVEL:= ROC(CLOSE,100,%);

RSI_level_0 := RSI(CLOSE,13);
RSI_level_3 := ref(RSI(close,13),-3);
MA_X := CROSS(MAM, MAS);

FILTER1 := MAM > MAS;
FILTER2 := ROC_Level > 8;
FILTER3 := CLOSE > REF(CLOSE, -1) AND REF(CLOSE, -1) > REF(CLOSE, -2) AND REF(CLOSE, -2) > REF(CLOSE, -3);
FILTER4 := MOV(CLOSE,60,S) * MOV(VOLUME,21,S) >= 50000;

%DAY_1 := ((Close - REF(Close, -100)) / Ref(Close, -1)) * 100;
%DAY_2 := ((Close - REF(Close, -100)) / Ref(Close, -2)) * 100;
%DAY_3 := ((Close - REF(Close, -100)) / Ref(Close, -3)) * 100;
{%DAY_4 := ((Close - REF(Close, -100)) / Ref(Close, -4)) * 100;}
{%DAY_5 := ((Close - REF(Close, -100)) / Ref(Close, -5)) * 100;}

RSI_%DAY_0 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -1)) * 100;
RSI_%DAY_1 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -2)) * 100;
RSI_%DAY_2 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -3)) * 100;
RSI_%DAY_3 := ((RSI(Close,13) - REF(RSI(Close,13), -100)) / Ref(RSI(Close,13), -4)) * 100;

Av % Gain 3_Days := (%DAY_1 + %DAY_2 + %DAY_3)/3 { + %DAY_4 + %DAY_5};
Bars_Since MA_X := barssince(MA_X);

Output := 1 AND FILTER1
AND FILTER2
AND FILTER3
AND FILTER4
AND Av % Gain 3_Days
AND ROC_LEVEL
AND Bars_Since MA_X
AND RSI_Level_0
AND RSI_%DAY_0
AND RSI_%DAY_1
AND RSI_%DAY_2
AND RSI_%DAY_3;

Output;
ShowCol(Av % Gain 3_Days, ROC_LEVEL, Bars_Since MA_X, RSI_level_0, RSI_%DAY_0, RSI_%DAY_1, RSI_%DAY_2, RSI_%DAY_3, "WL Name");
« Last Edit: 10/10/2019, 02:33:57 PM by JohnR »

Offline Campbell Sinclair

  • Support & Administration
  • Administrator
  • *****
  • Posts: 225
Re: Help with BCFL custom Scans & Coding
« Reply #112 on: 10/10/2019, 04:38:10 PM »
Quote
I understand the principal of the system, your explanations are helpful, my problems arise as a user based experience over the last 8 to 9 months, and how I think there could be improvement for narrowing the field to thoroughbred only race more suitable to my portfolio and cash allocation sizing. I don't see a problem with this, and the tools are there to use in BCFL. If this can be achieved as a scan it will save me time having to go through dozens of extra charts every night/day.

This is fair enough and understood, there will often be cases where there are more positions than cash available. There is also nothing wrong with trying to do what you are doing, but there can be reasons why we have got to the point we have as well. The system design from the team here has focused on the equity curve and the day to day transitions to achieve that equity curve. I could write for days on this and probably go on some cycling ramblings while doing it, but just know it's all fine. The core point I wanted to make was that it is not necessary to use BCFL, or should not be seen as a requirement more so for SPA3 operation.

BCFL is one of those degrees of tools that may make the edge go sideways, back or far higher. You don't know until it is done and it can take a long time to get to "done" or a starting point. I think this is well understood and I'll leave it there.

Quote
So just thinking out aloud to overview the potential ranking system inputs in BCFL, in this same way; there could be a value assigned for a bunch of indicators crossing points (MA, and MACD or better the PPO) how long ago, and at what index level, indicators with overbought and oversold index levels, ATRVE level, volumes over period of time, percentage gains or price rises over same period etc. reduced to a numerical value and added together, normalised to derive at a value ranking measure, then reported in a scan column. This could be the way to compare different stocks at least. And then if this value could be then compared with the value of previous periods, maybe that would indicated an improvement, or not, going forward in individual stocks.

This sounds like a scoring method, based on a number of inputs with different weights and the higher the value the better. An aim could be that the score itself be enough on its own, without having to compare prior periods.

Quote
I'm wondering how the SPA3 Trader system scan outputs can be used in way of getting a ranking system: ATRVE, Liquidity, Market Cap, and Sector Risk.

ATRVE is the volatility in a number. The more volatile a stock the more it can potentially move upwards, same as downwards. A low volatility stock is the same but in smaller amounts each way. Liquidity is used more so for money management & position sizing relative to portfolio, which sector risk is a common one. Market Cap really just tells you the potential circulation for a stock, while liquidity is the active / in transition average of much the stock is moving.

Specifically ATRVE is an indicator that expresses the ATRE as a percentage of the stock’s price on any given day. For an ATRE 15 of a 57 cent stock is 3.1 cents then the ATRVE = 5.43% (3.1 divided by 57). The 3.1 means that the daily average true range exponentially smoothed over the last 15 trading days is 3.1 cents.

You can apply an F5 overlay via Side Panels -> Overlay for your given SIROC setting to see it on a chart and get an eye for it. It does hold true that the more a stock moves (ATR) the higher the indicator value.

Quote
I have had to micro manage trades in IRESS for hours every day, something I want and need to get away from, as I simply can't do this from the deck of a yacht in the middle of the Pacific.

My suggestion would be to find a way to start accepting the outcomes of trades, or at least devise a plan to take a step back from these actions. It sounds like low volume day trading which is a job in of itself. Of course it can come back to being happy with the system / methodology, but also there is a psychology element involved in accepting investment outcomes. Studying (!) "Trading in the Zone" by Mark Douglas is something the team here strongly recommend to take a look in to with these situations, Gary you may have noticed already (or not) swear by it.

Quote
The only problem with the basic code (due to CUM(1)) is that previous data sets the index to 100 and caps more recent data (see attached chart lower panel for the oscillator), so that recent highs are not indexed to the same higher levels but are constrained. I guess this would mean employing more complex formula code.

Having had a poke around in BCFL Quick Reference I realise the CUM(1) starts indexing from day one of the price data history so replace with this:
max_old := hhv(data, 1000);
min_old := llv(data, 1000);

What I see happening is that this function finds what the previous maximum and minimum data points are. By making it 1000, you are capping its look back to the most recent 1000 data points instead of the all time range the function needs to operate. While it is fine for anything 1000 data points or less, generally taking away information may result in distorted outcomes.

If you find the data is staying at 100 or near that, it may be more to do with the data being supplied in moving sideways at a relative point.

Quote
p.s.s. The 'Base Reference Indicator' seems not available in BCFL? if it were those normalised current values could be reported for comparison in scans between scan candidates.

No it is not. You do have access to SECURITY() which grabs the prices from another stock, which can be used in a normalising function, but even if Base Ref was included it would be very manual to compare two items against each other. BCFL will have to be told about the othere existence explicitly.

Quote
Ok I think I need to understand what the broader user base is using BCFL for as you seem to have a good understanding of this?

BCFL exists primarily to implement your own ideas as either a scan (which doubles as a signal on a chart) or an indicator. Of course as you found with the SIROC, not everything in Beyond Charts is interactive with BCFL. SPA3 may not also be the only investment system that someone uses, or method of deciding which stocks to buy.

Quote
More stocks are continually coming up than I have capital for, and about 50 percent of my portfolio is in varying stage of losses slightly down from gains at any one time. At which point I then go through and cull the worst 2 to 3 stocks on any day to replace them with new incoming entries. It's a tricky business requirng watching IRESS for most of the day, and that I want to get away from doing, so to level out and understand and have better tools for this whole process of do I hold or do I cut, based on a scan ranking system.

Most SPA3 Trader trades, statistically which is represented in the back testing, will not be a profit trade. The system edge comes from exiting the losing trades early than the winning trades which results in overall larger winning trades then compounding the returns over time.

All of this can only be implemented and visibly seen in a portfolio outcome (ie. achieved), if you take SPA3 out of the equation for a moment, by having a process and sticking to it. SPA3 is the process enabler. There are systems that do better and do worse than SPA3, which are more active & less active, but finding them and working them out takes time and effort. Generally people come to us as they want to be able to achieve the equity curves that SPA3 has displayed over time and embrace the direction that having signals can provide.

Quote
Ok so lets take the day of the month example from your quote extract above; lets say first day of the month (or week) as the comparison point of reference for price for all stocks that SPA3 has identified as trade-able from within a watch list as the 'analytical' and apposed to the 'non analytical' "A to Z or choosing a letter from the alphabet based on the time of the month".

This is looking far too much in to it. It is a process to enable stock selection, not a system in of itself. The point of analytics vs not using them, is the contents of the process which enables the habits - to be able to follow a system. It all comes back to the portfolio backtests and how those 1000s of portfolios look. In the end, one of the portfolios goes down a different tree point which include the bad and mediocre trades along the way.

Quote
Next up is getting the RSI value to work so that the % value today is less or more than the value previous bar ago to asses if the RSI is rising or falling by x percent value over time:

The output I'm looking for is to get a single negative (-3) or positive (+3) % (or number) value output, so I can see if the indicator\price\anything is rising or falling in a scan column. I'm sure its trickier than it first appears so take your time no hurry.

Instead of looking at a number - what is the end objective you are trying to find? A rank of increase I suppose? Or to see if something is rising, falling or some combination of both? You cannot output text in to the scan columsn, but you can devise an output based on what you are after.

To find if they are rising a singular, sortable number, use the ROC() function over the desired amount of days. You can feed in your own variables as it will look at the change between the current bar and bar n (ago) as a stand alone % difference between the two. Based on your current formula, it could be a function like this perhaps:

ROC(RSI(Close, 13), 5, %);

Offline JohnR

  • Jr. Member
  • **
  • Posts: 69
Re: Help with BCFL custom Scans & Coding
« Reply #113 on: 10/10/2019, 10:49:57 PM »
Outstanding! thanks for the succinct replies. Going to sit back and read for a few days. You could have easily have flipped me off with all those nube questions, but your professionalism and comprehension of the system clearly shines through, a credit to you and the Share Wealth Team.

I should yield to your wisdom and just eyeball the ROC indicator, cross my fingers and pack all this stuff up and leave you to get on with it, but...

I have the RSI worked out and was going to edit my above post but your reply beat me to it, so will just say the RSI percentage change was nothing more than a subtraction:
RSI_%Change := RSI_% Today - % DAY_3;
This gives the current change percent from bar -3 and the column next to: RSI % Today, so two columns.
Probably not quite what I was looking for but will do for now so I can move on with other columns to build up the code base so I can then cut and paste between indicators..


I take your point about Rate of Change indicator 'as' the measure of comparative change, taken at face value.  So if the ROC formula is compared to another reference value, like a market index, or just the ROC zero line itself from a date like the 1st day of the month, so that a comparative level of reference can be achieved. Sounds simple but my brain doesn't work in code yet, I can think it out in words but zip in code.

Need to chew on this for a bit, might see if anyone has done this sort of thing in TradingView.

Cheers.