I realize I can sort on multiple columns, by control+clicking on the additional columns. This works well, but I'm thinking that EasyLanguage is more flexible.
Here is what I have, so far. If this is completely insane, and there's this one amazing author that I am missing out on, I'm really interested in hearing it. As a matter of fact, I have a little voice telling me that I should be using three arrays and looping through each of them in one central loop.
Thanks,
Rob
Code: Select all
{
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 vol ----|| ||||
min prc ---+|| ||||
max prc --+||| ||||
0000 0000
1 - one bit
2 - two bit
3 - three bit
4 - four bit
5 - five bit
6 - Min Volume
7 - Min price
8 - Max price
The highest score anyone can get is 255.
}
Inputs:
filterPrice(close),
doMinVolFilter(1),
doMinPriceFilter(1),
doMaxPriceFilter(1),
minVolume(1000000),
minPrice(4),
maxPrice(12);
Variables:
oneBitMultiplier(1),
twoBitMultiplier(1),
threeBitMultiplier(1),
fourBitMultiplier(1),
fiveBitMultiplier(1),
maxPriceMultiplier(1),
minPriceMultiplier(1),
minVolMultiplier(1),
finalValue(0),
oneBit(0),
twoBit(1),
threeBit(2),
fourBit(3),
fiveBit(4),
minVolBit(5),
minPriceBit(6),
maxPriceBit(7);
if (LastBarOnChart) then
begin
// 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;
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, fiveBit) * fiveBitMultiplier);
finalValue = finalValue + (power(2, minVolBit) * minVolMultiplier);
finalValue = finalValue + (power(2, minPriceBit) * minPriceMultiplier);
finalValue = finalValue + (power(2, maxPriceBit) * maxPriceMultiplier);
plot1(finalValue);
setPlotColor(1, Color_DimGrey);
if (finalValue >= 255) then
begin
setPlotColor(1, Color_Green);
end
else if (finalValue >= 223) then
begin
setPlotColor(1, Color_LightSeaGreen);
end
else if (finalValue >= 191) then
begin
setPlotColor(1, Color_ForestGreen);
end;
end;