matthias,
Does your code works? I tried to use it in my code but it is not working. The
TP/SL percentages stays 3 and 5.
My code is like this:
Buy = Cross(MA(C,10),MA(C,40));
BuyPrice = Open;
Sell =0;
Short = Cross(MA(C,60), MA(C,15));
ShortPrice = Open;
Cover = 0;
Buypos=Flip(Buy,Sell);
Shortpos=Flip(Short,Cover);
_TRACE("#" + "Buypos " + Buypos);
_TRACE("#" + "Shortpos " + Shortpos);
SLpercent=IIf(Buypos,3,IIf(Shortpos,7,0));
TPpercent=IIf(Buypos,5,IIf(Shortpos,10,0));
ApplyStop( 0, 1, SLpercent, 1 );
ApplyStop( 1, 1, TPpercent, 1);
--- In [email protected], "Matthias" <m.kusche...@...> wrote:
>
>
> Hi,
>
>
>
> I use this one:
>
> buypos=Flip(Buy,Sell);
>
> Shortpos=Flip(Short,Cover);
>
> SLbuy=Optimize("SLbuy",0.5,0.3,0.7,0.05); ////If you wanna optimize your
> stops and profit targets
>
> SLshort=Optimize("SLshort",0.5,0.3,0.7,0.05);
>
> TPbuy=Optimize("TPbuy",1,0.9,1.2,0.05);
>
> TPshort=Optimize("TPshort",1,0.9,1.2,0.05);
>
> SL=IIf(Buypos,SLbuy,IIf(Shortpos,slshort,0));
>
> TP=IIf(Buypos,TPbuy,IIf(Shortpos,tpshort,0));
>
> ApplyStop(stopTypeLoss,stopModePercent,SL);
>
> ApplyStop(stopTypeProfit,stopModePercent,TP);
>
>
>
> Sorry for the strange line breaks...
>
> Cheers,
>
> Matthias
>
>
>
>
>
>
>
>
> --- In [email protected], "Markus Witzler" <funnybiz@> wrote:
> >
> > Hello,
> >
> > I want to specify different appystop conditions for long and short
> posisions.
> >
> > How does AB recognize which one is for which trade?
> >
> > Thanks
> >
> > Markus
> >
> >
> >
> > __________ Information from ESET Smart Security, version of virus
> signature database 4668 (20091207) __________
> >
> > The message was checked by ESET Smart Security.
> >
> > http://www.eset.com
> >
>