DANTON STOP--please help convert ELA code to afl

#1
Hi friends

Here is a special soploss formula but it is in tradestation code ELA.
Can anybody help convert this into afl please!

Ref link
http://forum.esignal.com/showthread.php?7143-NEWS-I-am-releasing-my-quot-Favourite-Code-quot-for-Code-Conversion-!!!
HTML:
Its based on higher highs, and lower lows and a stop ratio that you can use to ( ie 0.68, 1.68, Fibonacci ratios are best) hold the stop and reverse line back before make as confirmed a change.

PLEASE IF you use this code please post the ESIGNAL VERSION on this thread....as a trader I realise that two traders can have exactly the same tools and yet one can win and the other loose because its more than your tools that make you a winner, so I hope you do as well, and post your code here freely.


HERE IS THE Tradestation 2000i ELA code.....

Inputs :
Series(Close), 
Ratio(1.25),{0.68,1.00,1.32,1.50,1.68}
Forward(2),
Back(2), 
ColorDwn(red),
ColorUp(Blue), 
BackColor(white), {Color equals the back color of your chart}
LineWidth(1);

Variables : LongStop(0),Lstop(0),ShortStop(0),Sstop(0), CloseX(0), HighX(0), LowX(0), DataInput(0);

{Using a moving average can produce better results and less }{whipsaws, use a MA thats has less lag}
{DataInput = T3Average(Series,6);}
{DataInput = jrc.jma.2k(Series,6,0);}
DataInput = Series;

CloseX = DataInput;
HighX = High;
LowX = Low;


{calculate long stop}
Lstop = lowx-(highx[1] - lowx[1])*ratio;

If Lstop < Longstop[1] and condition1 = true then Lstop = Longstop[1];

If closex > highest(closex[1],Forward) or lowx < lowest(lowx[1],Back) and condition1 = true then begin
Longstop = Lstop;
end
else begin
Longstop = Longstop[1];
end;

Condition1 = closex > Longstop;
Condition2 = closex < Longstop;

IF Condition1 and condition98 = false THEN 
Condition99 = TRUE{short}
ELSE IF Condition2 THEN
Condition99 = FALSE;{long}

If Condition99 then Begin
SetPlotColor(1, ColorUp);
SetPlotWidth(1,LineWidth);
END
ELSE BEGIN
SetPlotColor(1, BackColor);
SetPlotWidth(1,0);
End;



Sstop = highx+(highx[1] - lowx[1])*ratio;

If Sstop > Shortstop[1] and condition3 = true then Sstop = shortstop[1];

If closex < lowest(closex[1],Forward) or highx > highest(highx[1],Back) and condition3 = true then begin
Shortstop = Sstop;
end
else begin
Shortstop = Shortstop[1];
end;

Condition3 = closex <= Shortstop;
Condition4 = closex > Shortstop;

IF Condition3 and condition99 = false THEN 
Condition98 = TRUE{short}
ELSE IF Condition4 THEN
Condition98 = FALSE;{long}


If Condition98 then Begin
SetPlotColor(2, ColorDwn);
SetPlotWidth(2,LineWidth);
END
ELSE BEGIN
SetPlotColor(2, BackColor);
SetplotWidth(2,0);
End;


Plot1(Longstop,"Long");
Plot2(Shortstop,"Short");
 

Similar threads