An indicator framework for the scanner.

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
biffhero
Posts: 47
Joined: 22 Sep 2020
Has thanked: 29 times
Been thanked: 7 times

An indicator framework for the scanner.

Postby biffhero » 08 Nov 2020

Here is my contribution of an indicator that I use on my scanner window.

Here is what I do with my scanner on a day-to-day basis, and how this code works for me.

1. Multiple groups.
- Today
- Yesterday
- Old
- Market

2. Trickle down the first three.
Today -> Yesterday -> Old

3. Market pre-filled
$TICK
$VIX.X
$ADD
$PCVA
$VOLSPD
$TRIN
SPY

The code in the indicator has one plot, which I use as the primary sorting field in my scanner. This way the instruments I'm watching are sorted to the top of their respective groups, and colored with a green <--> red gradient.

I'd appreciate any suggestions to make this better.

Thanks,
Rob

Code: Select all

{ _scannerData Rob Walker (rob@ladle.net) Build a script for scanner values. Basically, a script that takes different parameters and filters out the items I don't want. Higher values are better. I think a bitmask is in order here. Bits, from least significant to most significant. ----------+ ---------+| --------+|| -------+||| |||| min ma -----+ |||| min vol ----|| |||| min prc ---+|| |||| max prc --+||| |||| 0000 0000 1 - one bit 2 - two bit 3 - three bit 4 - four bit 5 - Min Ma bit 6 - Min Volume 7 - Min price 8 - Max price The highest score anyone can get is 255. I am going to divide the final score by 255 so that we can get a number between 0 and 1. TODO : Generate maxValue from a length of an array. Currently maxValue is hardcoded to 255, which is (power(2, 8) - 1). This will allow us to grow or shrink the array of evaluators at will, without having to keep maxValue up to date. } inputs: filterPrice(close), doMinVolFilter(1), doMinPriceFilter(1), doMaxPriceFilter(1), doMinMaFilter(1), minVolume(1000000), minPrice(4), maxPrice(12), minMaFilterLen(200), minMaFilterPrice(close); variables: oneBitMultiplier(1), twoBitMultiplier(1), threeBitMultiplier(1), fourBitMultiplier(1), minMaMultiplier(1), maxPriceMultiplier(1), minPriceMultiplier(1), minVolMultiplier(1), finalValue(0), oneBit(0), twoBit(1), threeBit(2), fourBit(3), minMaBit(4), minVolBit(5), minPriceBit(6), maxPriceBit(7), maxValue(255), j(0), minMaFilterVar0(0); arrays: indexNames[6](""), indexValues[6](0); finalValue = 0; // If the price is too high if (doMaxPriceFilter = 1) then begin if (filterPrice >= maxPrice) then maxPriceMultiplier = 0; end; // If the price is too low if (doMinPriceFilter = 1) then begin if (filterPrice <= minPrice) then minPriceMultiplier = 0; end; // If the volume is too low if (doMinVolFilter = 1) then begin if (dailyVolume <= minVolume) then minVolMultiplier = 0; end; // If the price is below the 200 EMA // SMA is AverageFC // maFilterVar0 = AverageFC( minMaFilterPrice, minMaFilterLen) ; if (doMinMaFilter = 1) then begin // EMA is XAverage minMaFilterVar0 = XAverage( minMaFilterPrice, minMaFilterLen ) ; if (close < minMaFilterVar0) then minMaMultiplier = 0; end; finalValue = finalValue + (power(2, oneBit) * oneBitMultiplier); finalValue = finalValue + (power(2, twoBit) * twoBitMultiplier); finalValue = finalValue + (power(2, threeBit) * threeBitMultiplier); finalValue = finalValue + (power(2, fourBit) * fourBitMultiplier); finalValue = finalValue + (power(2, minMaBit) * minMaMultiplier); finalValue = finalValue + (power(2, minVolBit) * minVolMultiplier); finalValue = finalValue + (power(2, minPriceBit) * minPriceMultiplier); finalValue = finalValue + (power(2, maxPriceBit) * maxPriceMultiplier); indexNames[0] = "$TICK"; indexValues[0] = 255; indexNames[1] = "$VIX.X"; indexValues[1] = 254; indexNames[2] = "$ADD"; indexValues[2] = 253; indexNames[3] = "$PCVA"; indexValues[3] = 252; indexNames[4] = "$VOLSPD"; indexValues[4] = 251; indexNames[5] = "$TRIN"; indexValues[5] = 250; indexNames[6] = "SPY"; indexValues[6] = 249; for j = 0 to array_getmaxindex(indexNames) begin if (symbol = (indexNames[j])) then finalValue = indexValues[j]; end; // TODO : hardcoding '8' here is suboptimal. // 1. Use a list / array. // 2. Get the length of that array. // finalValue = finalValue / ((power(2, 8) - 1)); finalValue = finalValue / maxValue; finalValue = round(finalValue, 4); plot1(finalValue); value1 = (gradientcolor(finalValue, 0, 1, red, green)); setPlotColor(1, value1);

bomberone1
Posts: 310
Joined: 02 Nov 2010
Has thanked: 26 times
Been thanked: 23 times

Re: An indicator framework for the scanner.

Postby bomberone1 » 10 Nov 2022

Great. Thanks.


Return to “User Contributed Studies and Indicator Library”