I have struggled with the same issue.... can someone help - is there 
a solution?
Larry

--- In [email protected], "janhausd" <[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I did some searching in the posts, and it looks like many people 
have
> asked for methods to remove the extraneous signals from HighestSince
> or LowestSince so that the function can return the very first signal
> and not the ones which appear afterwards.
> 
> I've tried copying the code from these two posts, using loops or 
loops
> + global vars, or some combination of ExRem, or Flip or ExRemSpan 
but
> I have not yet gotten it working:
> http://finance.groups.yahoo.com/group/amibroker/message/117998
> http://finance.groups.yahoo.com/group/amibroker/message/72151
> 
> Is there a simple way to accomplish this? Otherwise, the trailing
> stops don't work correctly since HighestSince is reset with each
> succeeding Buy signal and vice versa for LowestSince. The below is 
the
> code I'm looking to fix:
> 
> ---
> Buy = Signal1 & Signal2;
> Short = Signal1Rev & Signal2Rev;
> Buy = Ref(Buy,-1);
> Short = Ref(Short,-1);
> BuyPrice = O;
> ShortPrice = O;
> SetTradeDelays(0,0,0,0);
> 
> sellstopline = HighestSince( Buy, High ) * STrailingStopPct;
> BuyBarsSince = BarsSince(Buy == 1);
> sellprofitline = Ref(BuyPrice, -BuyBarsSince) * SProfitStopPct;
> sellex = sellstopline > P;
> sellex2 = P > sellprofitline;
> Sell= IIf(sellex,4,(IIf((sellex2),3,0)));
> SellPrice = O;
> 
> coverstopline = LowestSince( Short, Low ) * BTrailingStopPct;
> ShortBarsSince = BarsSince(Short == 1);
> coverprofitline = Ref(ShortPrice, -ShortBarsSince) * BProfitStopPct;
> buyex = P > coverstopline;
> buyex2 = coverprofitline > P;
> Cover= IIf(buyex==1, 4, (IIf((buyex2),3,0)));
> CoverPrice = O;
> Equity(1,0);
> --
>


Reply via email to