PureBytes Links
Trading Reference Links
|
Someone posted this system a while back, and I just got around to testing
it. When I applied it to a P&F chart, however, it triggered on every single
bar. Is there some way I should be setting up the chart so this doesn't
happen (right now it's 0.5 x 3), or is there some flaw in the code that
isn't making it behave the way it's supposed to?
Here's the code as I have it:
INPUTS: Input1(1);
VARS: Hook(0), Box(0), Start(TRUE);
{
for point & figure charting
hook is a point above the market
if the market rises thro hook, hook becomes one box higher
if market sinks through hook - box, hook becomes
hook - box and so on
initially decides to be long or short from MA
but after that, is always in market.
if long and price goes below hook - box, reverse to short
if short and price goes above hook, reverse to long
}
Box = Input1;
Value2 = Average(Close, 14);
IF Start AND Value2[1] > 0 THEN BEGIN
Value1 = IntPortion(Close);
While Value1 < Close Begin
Value1 = Value1 + Box;
End;
Hook = Value1;
IF Value2 > Value2[1] THEN BEGIN
BUY ("LongPos1") ON Close;
END ELSE
IF Value2 < Value2[1] THEN BEGIN
SELL ("Short1") ON Close;
END;
Start = FALSE;
END;
IF Close[1] <= Hook AND Close > Hook THEN BEGIN
WHILE Hook <= Close BEGIN
Hook = Hook + Box;
END;
EXITSHORT ("ShortEx") ON Close;
BUY ("RvrsLong") ON Close;
END ELSE
IF Close[1] >= Hook - Box AND Close < Hook - Box THEN BEGIN
WHILE Close < Hook - Box BEGIN
Hook = Hook - Box;
END;
EXITLONG ("LongPosEx") ON Close;
SELL ("RvrsShrt") ON Close;
END;
|