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

Re: EXE code to large?



PureBytes Links

Trading Reference Links

Vince <VBatla@xxxxxxx> writes:
>I'm trying to add the ADX to a system.  I'm entering:
>
>value1 = ADX(14);
>
>When I do this and verify I get:  "EXE code to large..."

Omega's ADX code is "to" large. Try this implimentation instead:

{User function "myADX" for TS3.5 or TS4.0}
input: length(NumericSimple);
var: minusDM(0), plusDM(0), dxplus(0), dxminus(0), n(0);
var: dx(0), factor(0);

if CurrentBar = 1 then begin
    factor = 1 - 1 / length;
    for n = 0 to length-1 begin
        plusDM = High[n] - High[n+1];
        minusDM = Low[n+1] - Low[n];
        if plusDM < 0 then
            plusDM = 0;
        if minusDM < 0 then
            minusDM = 0;
        if plusDM > minusDM then
            dxplus = dxplus + plusDM
        else
        if plusDM < minusDM then
            dxminus = dxminus + minusDM;
    end;
    if dxplus + dxminus <> 0 then
        dx = absvalue(dxplus - dxminus) / (dxplus + dxminus);
    myADX = 100 * dx;
end
else begin
    plusDM = High - High[1];
    minusDM = Low[1] - Low;
    if plusDM < 0 then
        plusDM = 0;
    if minusDM < 0 then
        minusDM = 0;
    if plusDM > minusDM then
        minusDM = 0
    else
    if plusDM < minusDM then
        plusDM = 0
    else begin
        plusDM = 0;
        minusDM = 0;
    end;
    dxplus  = dxplus[1]  * factor + plusDM;
    dxminus = dxminus[1] * factor + minusDM;
    if dxplus + dxminus <> 0 then
        dx = (dx[1] * (length-1) + absvalue(dxplus - dxminus) / (dxplus + dxminus)) / length;
    myADX = 100 * dx;
end;