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

Re: EL Function Available?



PureBytes Links

Trading Reference Links

  input:price(C),cllen(30),start(20),finish(60),fac(1.7),
                 entryx(0),exitx(0),alen(20),alenavg(20),stop$(2000);

var:dl(0),bf(0),sf(0),cb(0),cs(0),tss(0),tbs(0),ss(0),bs(0),
                      ssn(0),bsn(0),buystops(0),sellstops(0);

dl=DynamicLength(price,cllen,start,finish);              {dl.....var len user func}
bf=average(adaptive(high,alen),alenavg);          {bf.....buy filter}
sf=average(adaptive(low,alen),alenavg);       {sf.....sell filter}
cb=highest(high,dl)+entryx;                            {cb.....chan buy + extra amount}
cs=lowest(low,dl)-entryx;                                   {cs.....chan sell - extra amount}
tss=Lowest(Low,dl/fac)-exitx;                                {tss.....trails the buy = SELL STOP}
tbs=Highest(High,dl/fac)+exitx;                                 {tbs.....trails the sell = BUY STOP}

condition1=bf<>0 and bf[1]<bf;                      {buy filter not = 0 and rising}
condition2=sf<>0 and sf[1]>sf;                  {sell filter not = 0 and falling}
condition3=marketposition <>1;             {position not long}
condition4=marketposition <>-1;               {position not short}
condition5=marketposition=1;                      {market position long}
condition6=marketposition=-1;                        {market position short}
condition7=marketposition=0;                            {market position flat}

if condition1 and condition3 then begin cb=cb;end;            {cb.....buy filter rising ,market position not long}
if condition2 and condition4 then begin cs=cs;end;         {cs.....sell filter falling,market position not short}
if condition5 then begin tss=tss;end;                                 {tss.....position long then start trail buy = SELL STOP}
If condition6 then begin tbs=tbs;end;                                    {tbs.....position short then start trail sell = BUY STOP}

ss=entryprice-(stop$/bigpointvalue);                 {ss.....if long $2000 = SELL STOP}
bs=entryprice+(stop$/bigpointvalue);            {bs.....if short $2000 = BUY STOP}
ssn=cb-(stop$/bigpointvalue);                          {ssn.....if flat $2000 = SELL STOP}
bsn=cs+(stop$/bigpointvalue);                             {bsn.....if flat $2000 = BUY STOP}

sellstops=maxlist(ss,tss);                      {sellstops.....if long print the closest stop ,the trail or the fixed $2000 = SELL STOPS}
buystops=minlist(bs,tbs);                      {buystops.....if short print the closest stop ,the trail or the fixed $2000 = BUY STOPS}

If Date=LastCalcDate then begin

If CommodityNumber=2    then print("Live Cattle =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=4    then print("Live Hogs =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);

If CommodityNumber=5    then print("Pork Bellies =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=7    then print("Cotten =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Trade  P/L$",OpenPositionProfit:5:0);
If CommodityNumber=8    then print("Copper =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=9    then print("Corn =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=10   then print("Coffee =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=11   then print("Oates =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=12   then print("Orange Juice =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=13   then print("Platiumn =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=16   then print("Silver =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=17   then print("Soybeans =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=18   then print("Soybean Meal =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=19   then print("Soybean Oil =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=20   then print("Sugar=TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=21   then print("Wheat =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=24   then print("D Mark =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=25   then print("Swiss Franc =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=26   then print("British Lb =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=27   then print("Lumber =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Trade P/L $",OpenPositionProfit:5:0);
If CommodityNumber=30   then print("Gold =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=41   then print("T Bills =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=44   then print("T Bonds =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=65   then print("J Yen =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=89   then print("Heating Oil =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=141 then print("Euro $ =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=149 then print("S&P 500 =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=150 then print("T Notes =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=188 then print("Crude Oil =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);
If CommodityNumber=224 then print("Unleaded Gas =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position
$",OpenPositionProfit:5:0);
If CommodityNumber=263 then print("US $ Index =TOPMARK= Report Date:",Date:7:0," Month:",DeliveryMonth:2:0," Open Position $",OpenPositionProfit:5:0);



If MarketPosition=0 then begin
print(">>>>>>>>>>Begin Report:<<<<<<<<<<<  ");{print(" ");}
    print("Flat Date: ",EntryDate:6:0,"    Close Today at:",Close:4:4);              {flat position info}
    print("Position: Flat Closed Today at:",Close:4:4);                                  {flat in market}
    print("Orders:");                                                                                     {orders to place}
    print("Reference: Buy Order for Tomorrow at:",cb:4:4);                     {buy order}
    print("Reference: Sell Stop for Tomorrow at:",sellstops:4:4);                {sell stop}
    print("Or:");                                                                                                  {place either or}
    print("Reference: Sell Order for Tomorrow at:",cs:4:4,);                                  {sell order}
    print("Reference: Buy Stop for Tomorrow at:",buystops:4:4);                              {buy stop}
End;
If MarketPosition=-1 then begin
print(">>>>>>>>>>Begin Report:<<<<<<<<<<<  ");{print(" ");}                          {short position info}
    print("Entry Date: ",EntryDate:6:0,"    Close Today at:",Close:4:4);           {short position info}
    print("Position: Short in the Market from:",EntryPrice:4:4);                     {short in market}
    print("Orders:");                                                                                     {orders to place}
    print("Reference: Buy Stop for Tomorrow at:",buystops:4:4);           {buy stop}
    print("Reversal:");                                                                                {reversal order if short}
    print("Reference: Buy Order for Tomorrow at:",cb:4:4);                           {sell order}
    print("Reference: Sell Stop for Tomorrow at:",sellstops:4:4);                      {sell stop}
End;
If MarketPosition= 1 then begin
print(">>>>>>>>>>Begin Report:<<<<<<<<<<<  ");{print(" ");}                           {long position info}
    print("Entry Date: ",EntryDate:6:0,"     Close Today at:",Close:4:4);          {long position info}
    print("Position: Long in the Market from:",EntryPrice:4:4);                     {long in market}
    print("Orders:");                                                                                    {orders to place}
    print("Reference: Sell Stop for Tomorrow at:",sellstops:4:4);           {sell stop}
    print("Reversal:");                                                                                  {reversal order if long}
    print("Reference: Sell Order for Tomorrow at:",cs:4:4);                             {sell order}
    print("Reference: Buy Stop for Tomorrow at:",buystops:4:4);                         {buy stop}
End;
{print(" ");}print(">>>>>>>>>>End of Report:<<<<<<<<<<<  ");
End;