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

Mr Code's Code



PureBytes Links

Trading Reference Links

Below is a system that was posted by Mr Code back in March.  Does anyone
know how to set this up? What
is Data1, Data2, and Data3? What time frame is required?

Any Help is appreciated.

Regards,

Bill Vedder

Input:  MixtMa(20), MixtLag(5), BigN(60), BigEnv(250), PStop(2.75),
             PThresh(2), Trail(60), conf(15) ,FailBrs(0), BWidth(0) ;

vars: Mixt(false),LiraBund(false), BigMean(0), TopDog(0), BotDog(0),
BandWidth(0),
           LgPStop(0), ShPStop(0), ProfitTarget(false), counter(0);

{***** Variable Assignment *****}

if close of data2 >= Waverage(close of data2, MixtMa)[MixtLag]


        then Mixt = True
        else Mixt = False;
if close of data3 >= Waverage(close of data3,29)[5]
                    then Lirabund  = True
        else Lirabund  = False;

BigMean = XAverage(AvgPrice, BigN);
TopDog = BolBandXav(AvgPrice, BigN, BigEnv);
BotDog = BolBandXav(AvgPrice, BigN, -BigEnv);
BandWidth = (TopDog - BotDog)*100 / BigMean;

LgPStop = EntryPrice * (1 - (PStop/100));
ShPStop = EntryPrice * (1 + (PStop/100));

{***** Entry Signals *****}

if  Low<=BotDog  and MarketPosition<>1 and BandWidth >= BWidth
     and LiraBund = true then
 begin
 buy("Long") 1 contract at the market;
 ProfitTarget=False;
 LgPStop = close * (1 - (PStop/100));
end;

if  High>=TopDog  and MarketPosition<>-1 and BandWidth >= BWidth
    and LiraBund = false then
 begin
 sell("Short") 1 contract at the market;
 ProfitTarget=False;
 ShPStop = close * (1 + (PStop/100));
end;

{***** Protection Stop *****}

ExitLong("LgPStop") at LgPStop on a Stop;
ExitShort("ShPStop") at ShPStop on a Stop;

if date = 921002 or date = 921005 then
Print(date:7:0, time:5:0, "  LgStop", LgPStop:5:2);

{***** Profit Trailing Stop *****}

if MarketPosition = 1 and close >= EntryPrice * (1+(PThresh/100))
then ProfitTarget = true
else ProfitTarget = false;

If ProfitTarget = true and close < Xaverage(AvgPrice,Trail)
then
  begin
    condition1 = true;
    for counter = 1 to Conf
      begin
        if close[counter] < Xaverage(AvgPrice,Trail)[counter]
        then condition1= false;
      end;
   If condition1=true then ExitLong("LgProfStop") at the market;
 end;

if MarketPosition = -1 and close <= EntryPrice * (1-(PThresh/100))
then ProfitTarget = true
else ProfitTarget = false;

If ProfitTarget = true and close > Xaverage(AvgPrice,Trail)
then
  begin
    condition1 = true;
    for counter = 1 to Conf
      begin
        if close[counter] > Xaverage(AvgPrice,Trail)[counter]
        then condition1= false;
      end;
   If condition1=true then ExitShort("ShProfStop") at the market;
 end;

{ *****  FailureExit ***** }

If BarsSinceEntry >= FailBrs
    and MarketPosition = 1
    and LiraBund = false
    and Close <= BotDog
then ExitLong("LgFail") at market;

If BarsSinceEntry >= FailBrs
    and MarketPosition = -1
    and LiraBund = true
    and Close >= TopDog
then ExitShort("ShFail") at market;


{ *****  PrintBoolean *****}

{Print(file("c:\1ascii\boolean\sp81m.boo"), date, time,@marketPosition +

10,
                                @marketPosition + 10,
                                 @marketPosition + 10,
                                @marketPosition + 10);}


IncludeSystem:"$zCount Bull/Bear";