COULD SOMEBODY PLEASE PUT THIS FORMULA TO A EFS STUDY.
Bullish Divergence (bull_div)
FUNCTION(source1, source2, period, strength)
HISTORY(period - 1);
VAR
hBarS1; hBarS2;
count;
BEGIN
if period < 2 or strength >= period or strength < 0 then
return;
end_if;
if source1 <> NaN() then
hBarS1 = lowest_barnum(source1, period, currentBar);
end_if;
if source2 <> NaN() then
hBarS2 = lowest_barnum(source2, period, currentBar);
end_if;
if hBarS1 = NaN() or hBarS2 = NaN() or source1 = NaN() or source2 = NaN() then
return;
end_if;
function = iff( hBarS1 > hBarS2 and (hBarS1 - hBarS2) >= strength, 1, 0);
END_FUNCTION
Bullish Divergence (bull_div)
FUNCTION(source1, source2, period, strength)
HISTORY(period - 1);
VAR
hBarS1; hBarS2;
count;
BEGIN
if period < 2 or strength >= period or strength < 0 then
return;
end_if;
if source1 <> NaN() then
hBarS1 = lowest_barnum(source1, period, currentBar);
end_if;
if source2 <> NaN() then
hBarS2 = lowest_barnum(source2, period, currentBar);
end_if;
if hBarS1 = NaN() or hBarS2 = NaN() or source1 = NaN() or source2 = NaN() then
return;
end_if;
function = iff( hBarS1 > hBarS2 and (hBarS1 - hBarS2) >= strength, 1, 0);
END_FUNCTION