PureBytes Links
Trading Reference Links
|
I have adjusted the chandelier exit which someone posted a while ago for
intraday S&P trading. The adjustment is simply that the stop (for short
trades in the below code) goes over the the 'even' or over the '50'. The
original code and the adjusted code are below. (The division by 100 is
because I use Futursource and they don't include decimal points) My problem
is that when the Original code gives a value of exactly say 1231.50 the stop
in the adjusted should go to 1231.60 but it is going to 1232.10. It seems
to work fine for all other values but I have stumbled across this example
and am stumped as to why it is giving me the wrong answer. I assumed it
must be rounding in that SRnd-MinChand is giving .499 or .501 but I checked
for this and it is not the case.
Any suggestions?
regards
Philip
------Adjusted Code-----------
If Pos=-1 then begin
if Time>=StrtTime and Date>=StrtDate then begin
if (L +Fac*Average(TrueRange,ATRLen))/100 < MinChand then
MinChand= (L +Fac*Average(TrueRange,ATRLen))/100;
SRnd=Round(MinChand,0);
If (SRnd-MinChand)<0 and (SRnd-MinChand)>-0.50 then SStop=SRnd*100+60;
If (SRnd-MinChand)=0.50 Then Sstop=Minchand*100+10;
If (SRnd-MinChand)>0 then Sstop=SRnd*100+10;
If (SRnd-Minchand)=0 then SStop=Minchand*100+10;
Plot2(SStop,"ShortExit");
end;
end;
----------Original Code--------------
If Pos=-1 then begin
if Time>=StrtTime and Date>=StrtDate then begin
if (L +Fac*Average(TrueRange,ATRLen)) < MinChand then
MinChand= (L +Fac*Average(TrueRange,ATRLen));
Plot2(MinChand,"ShortExit");
end;
end;
|