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

[amibroker] Re: Frustrated with fixed stops



PureBytes Links

Trading Reference Links

just a quick idea, without testing...


 BuySetup = Ref(inside(), -1);
 BuySetup = Flip(BuySetup, Sell);
 BuySetup = BuySetup and NOT Ref(BuySetup, -1);

 BuyStop = ValueWhen(BuySetup, ref(H, -1) + 0.01);
 SellStop = ValueWhen(BuySetup, ref(L, -1) - 0.01);
> Buy = Cross(H,BuyStop);
> Sell = Cross(SellStop,L);
> 
> ExRem(Buy,Sell);
> ExRem(Sell,Buy);
> BuyPrice = Max( BuyStop, O );
> SellPrice = Min(SellStop,H);



--- In amibroker@xxxxxxxxxxxxxxx, "moneypro" <protrader0668@xxxx> 
wrote:
>
>    Can anybody help me with my codes here, please. I am trying to 
buy
> at Inside bar high, put a fixed stop at low. Sell at fixed number of
> bars later (eg, End of day). 
>    
> BuySetup = inside();
> BuyStop = ValueWhen(BuySetup,H+0.01);
> SellStop = ValueWhen(BuySetup,L-0.01);
> Buy = Cross(H,BuyStop);
> Sell = Cross(SellStop,L);
> 
> ExRem(Buy,Sell);
> ExRem(Sell,Buy);
> BuyPrice = Max( BuyStop, O );
> SellPrice = Min(SellStop,H);
> 
>  The problem is: if another "inside()" bar shows up before SellStop 
is
> hit, a new SellStop will be automatically set at higher level 
(because
> of the new BuySetup. So, the SellStop level is moved up. I just want
> to keep it where it is. What can I do? Use Flip()? How? Thanks
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/