PureBytes Links
Trading Reference Links
|
: Next is, how would you discover with which box size
: and reversal amount you should use?
The code below is what I wrote based on the instruction from the link
http://www.stockcharts.com/support/pnfCharts.html. You can use it to
optimize it for Box Size and Reversal Amount. No guarantees on
profitabilities.
{Signal: Point N Figure}
Inputs: Box(5), Rev(3);
Vars: HH(0), LL(0), Dir(0), Dist(0);
Dist = Box * Rev;
{Initialize everyhting, Pick a direction}
{Dir = -1 is down; Dir = 1 is up}
If Currentbar = 1 then begin
HH = Highd(1);
LL = Lowd(1);
If Closed(1) < OpenD(1) then Dir = -1 else Dir = 1;
end;
{main body}
If Dir = -1 then begin
{Check to see if new Low is made by Box size}
If L < LL - Box then LL = L
else begin
{If new Low is not made, check to see if H is high enough
to start a new column; if it is, switch DIR and mark new H}
If H > LL + Dist then begin
Dir = 1;
HH = H;
end;
end;
end else begin
{Check to see if new High is made By Box size}
If H > HH then HH = H
else begin
{If new H is not made, check to see if L is low enough to
start a new column; if it is, switch DIR and mark new L}
If L < HH - Dist then begin
Dir = -1;
LL = L;
end;
end;
end;
If Dir = 1 then buy("Buy") on close;
If Dir = -1 then sell("Sell") on close;
---
|