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

RE: Easy Lang Prob



PureBytes Links

Trading Reference Links

Firstly, thanks for the help.

I tried this, but the trades don't take place as the high and low pivots are
taken out but at strange places in between the peaks and troughs.

Here is what I ran:

Inputs: PriceH(High), LStrenH(6), RStrenH(2), PriceL(Low), LStrenL(6),
RStrenL(2);

  Vars: PivHigh(0), BuyStop(0), PivLow(0), SellStop(0);

  { Clear stops if hit }
  if BuyStop <> 0 and H >= BuyStop then BuyStop = 0;

  { Avoid calling the function twice }
  PivHigh = PivotHighVS(1, PriceH, LStrenH, RStrenH, RStrenH+1);
  if PivHigh <> -1 Then Begin
   If H crosses above PivHigh Then BuyStop = H;
  End;

  if BuyStop <> 0 then buy at BuyStop stop;

 { Clear stops if hit }
  if SellStop <> 0 and L  >= SellStop then SellStop = 0;

  { Avoid calling the function twice }
  PivLow = PivotLowVS(1, PriceL, LStrenL, RStrenL, RStrenL+1);
  if PivLow <> -1 Then Begin
   If L crosses below PivLow Then SellStop = L;
  End;

  if SellStop <> 0 then sell at sellStop stop;

Any ideas?

Tom



-----Original Message-----
From: Gary Fritz [mailto:fritz@xxxxxxxx]
Sent: Friday, June 16, 2000 1:08 PM
To: Omega-list@xxxxxxxxxx
Subject: Re: Easy Lang Prob


Personally I suspect Dennis is right -- that pivot function probably
returns a bar number, not a price.  But there might be another
problem too.

> You won't get a buy or sell signal the way you have it set up. It
> is not the "crosses above" or "crosses below" or the ">" or the "<"
> that's the problem. It is the stops. You have to use a filter
> because the high of the bar cannot buy at itself on a stop. It
> cannot refer to itself.

No, that's not the problem.  The code as he wrote it says:
  "Set a stop on the NEXT BAR at the high price of THIS BAR."

So if this bar has a high of 1491.5, the stop can be hit if the NEXT
bar goes to 1491.5.  Which is apparently what he wants.

Tom, you said it "doesn't trade right" but you didn't say HOW it
failed.  Does it trade sometimes, but not always when you think it
should?

I suspect the problem is:  you forgot that TS forgets.  Stop orders
apply to the NEXT BAR ONLY.  So in the example above, if the NEXT BAR
hits 1491.5, the system should buy.  But if it takes two or more bars
before the market hits 1491.5, TS "forgets" the order and your system
doesn't buy.

So you need to remember the entry price for TS.  Try something like
this:

  Inputs: PriceH(High), LStrenH(6), RStrenH(2);

  Vars: PivHigh(0), BuyStop(0);

  { Clear stops if hit }
  if BuyStop <> 0 and H >= BuyStop then BuyStop = 0;

  { Avoid calling the function twice }
  PivHigh = PivotHighVSBar(1, PriceH, LStrenH, RStrenH, RStrenH+1);
  if PivHigh <> -1 Then Begin
   If H crosses above PivHigh Then BuyStop = H;
  End;

  if BuyStop <> 0 then buy at BuyStop stop;

You might also want to clear the SellStop variable when you set up
the BuyStop.

It's a pain to have to manage stops manually like this, but that's
the way TS works.

Gary