[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parabolic code query



PureBytes Links

Trading Reference Links

In-Reply-To: <memo.513305@xxxxxxxxxxxxxxxxxxx>
Doh! Problem solved!

Been informed that TS2K already has a ParabolicCustom Function, hence 
problem. Thanks to fritz pointing this out...

Cheers,
Ian

> Hi All,
>       I received the following code as a freebie from Solidus but it 
> doesn't verify. Can someone spot the error and fix it?
> 
> It's a Function called "ParabolicCustom".
> 
> Thanks.
> 
> Cheers,
> Ian
> 
> 
> {
> ParabolicCustom
> courtesy of Solidus Capital Partners
> N. Christopher Cheatham, general partner
> ChrisCheatham@xxxxxxxxxxxxxxxxxx
> }
> 
> Input: AFVal(NumericSimple), AFAdj(NumericSimple);
> 
> Vars: Position(-1),SAR(Close),AF(AFVal),Hi(High),Lo(Low);
> 
> IF CurrentBar = 1 Then
>   Position = 1
> Else if CurrentBar >1 then Begin
>   IF High > Hi Then 
>     Hi = High;
>   IF Low < Lo Then
>     Lo = Low;
>   IF Position = 1 Then Begin
>     IF Low <= ParabolicCustom[1] Then
>       Position = -1; {Reverse position}
>   End
>   Else Begin
>     IF High >= ParabolicCustom[1] Then
>       Position = 1; {Reverse position}
>   End;
> End;
> IF Position = 1 Then Begin
>   IF Position[1] = -1 Then Begin
>     SAR = Lo;
>     AF = AFVal;
>     Lo = Low;
>     Hi = High;
>   End
>   Else Begin
>     SAR = SAR[1]+ AF * ( Hi-SAR[1]);
>     IF Hi > Hi[1] And AF < 0.2 Then 
>       AF = AF+ AFAdj;
>   End;
>   IF SAR > Low Then
>     SAR = Low;
>   IF SAR > Low[1] Then 
>     SAR = Low[1];
> End
> Else Begin
>   IF  Position[1] = 1 Then Begin
>     SAR = Hi;
>     AF = AFVal;
>     Lo = Low;
>     Hi = High;
>   End
>   Else Begin
>     SAR = SAR[1]+AF*(Lo-SAR[1]);
>     IF Lo < Lo[1] And AF < 0.2 Then 
>       AF = AF+ AFAdj;
>   End;
>   IF SAR < High Then
>     SAR = High;
>   IF SAR < High[1] Then 
>     SAR = High[1];
> End;
> ParabolicCustom = SAR;
>