What value do you expect to see in your scanner. May this makes it much clearer ... Please be aware that you set a condition, in your case <CONDITION20> where the <HIGH> has to be higher than the <HIGHEST(CLOSE,20> of the last 20 bars.
I assume you would like to see the <HIGH> value of the bar in the following screenshot :
So if you can tell us which value you are expecting we might find the solution. I wrote a basic output for you to check which condition was met on every day and if all the conditions to plot <H> was met, it gives you the value. Please check it in the PowerLanguageEditor - Output section.
Code: Select all
// <INPUT> SECTION
input: Price(Close), Length(50);
// [VARIABLES] SECTION
var: DCHi(0), DCLo(0), DCMid(0), BarPercentage(50);
var: OC_Cond(false), HOOC_Cond(false), CLOC_Cond(false), C10(false), C20(false), Plot_Cond(false); // Conditions Check for Debug
DCHi = Highest(Price,Length); // Highest <PRICE> defined for Periot of <LENGTH>
DCLo = Lowest(Price,Length); // Lowest <PRICE> defined for Periot of <LENGTH>
DCMid = (DCHi + DCLo) * 0.5; // Calculate Mid of HPrice (DCHi) & LPrice (DCLo)
// CONDITIONS SECTION
condition10 = (O > C) // OC_Cond
and ((H - O) > (O - C)) // HOOC_Cond
and ((C - L) < (O - C)); // CLOC_Cond
condition20 = (H > DCHi);
// Conditions Debug
if O > C then OC_Cond = true else OC_Cond = false;
if ((H - O) > (O - C)) then HOOC_Cond = true else HOOC_Cond = false;
if ((C - L) < (O - C)) then CLOC_Cond = true else CLOC_Cond = false;
if condition10 then C10 = true else C10 = false;
if condition20 then C20 = true else C20 = false;
if c10 and C20 then Plot_Cond = true else Plot_Cond = false;
If condition10 and condition20 then
begin
Plot1(H, "Hammer");
end;
Plot2(DCHi, "DCHi");
Plot3(DCMid, "DCMid");
Plot4(DCLo, "DCLo");
if Plot_Cond then Print( Date , " - Check Conditions >> " ,
" 1. OC_Cond : ", OC_Cond,
" - 2. HOOC_Cond : ", HOOC_Cond,
" - 3. CLOC_Cond : ", CLOC_Cond,
" / Check Condition10 : ", C10,
" - Check Condition20 : ", C20,
" // MET PLOT CONDITION ??? >> ", Plot_Cond,
">> PlotValue : ", H)
else
Print( Date , " - Check Conditions >> " ,
" 1. OC_Cond : ", OC_Cond,
" - 2. HOOC_Cond : ", HOOC_Cond,
" - 3. CLOC_Cond : ", CLOC_Cond,
" / Check Condition10 : ", C10,
" - Check Condition20 : ", C20,
" // MET PLOT CONDITION ??? >> ", Plot_Cond);
May it helps to understand when your conditions were met and when not. Please give some feedback.
Regards
Ben