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

[amibroker] Re: How to get a few figures during backtesting?



PureBytes Links

Trading Reference Links

Change SellPrice line to 
SellPrice = IIf(L<Ref(L,-BarsSince(Buy)),Ref(L,-1),C); 

--- In amibroker@xxxxxxxxxxxxxxx, "andreyoffline" 
<andrey.offline@xxxx> wrote:
> Try this code
> 
> Buy = H>Ref(H,-1);
> BuyPrice = C;
> Sell = L<Ref(L,-BarsSince(Buy)) OR BarsSince(Buy)>5;
> SellPrice = C;
> SetTradeDelays(0,0,0,0); 
> Buy = ExRem(Buy,Sell);
> Sell = ExRem(Sell,Buy);
> ApplyStop(1,2,250,1,False,0);
> 
> PlotShapes( IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L);
> PlotShapes( IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H);
> Plot(C,"Price",colorBlack,styleCandle);
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "clement" <clement@xxxx> wrote:
> > 
> > 
> > I am trying to write a simple test to Long a position and would 
> like to get the following figures:
> > 
> > The system will enter a long position if today trades higher 
than 
> previous day. Profit target is entry price + $2.50. Stop is 
previous 
> low. If the price does not hit the stop or exit in 5 days, I will 
> close the trade at Close. I have the following codes:
> > 
> > BuyPrice = ref(H,-1); 
> > SellPrice = ref(L,-1);
> > Buy = H>ref(H,-1);
> > Sell = ref(L,-1)>L;
> > 
> > How to pinpoint the target price of the entry date after a few 
> days? It seems like a static figure. Shall I use 
> Target_profit=buyprice+2.5?
> > 
> > How to exit a trade if the price does not hit the stop or target 
> in 5 days?
> > 
> > How to pinpoint the no. of days after an entry? Using Barssince?
> > 
> > Thanks.
> > 
> > Clement




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/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/