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

RE: [amibroker] Types of orders



PureBytes Links

Trading Reference Links

Hello,

>From: <jacklweinberg@xxxx>
> Is it possible in AMIBROKER (AFL) to simulate:
> - exiting a trade (long or short) after N days?
> - exiting a trade (long or short) when a certain price is reached?
> - exiting a trade (long or short) after achieving X % profit? (or 
> losing $Y)?
> Thanks.
> It appears to be a great product.
> If it can do those things as described above, I hope that I can 
> volunteer to learn and write AFL code to simulate Technical Analysis 
> of Stocks and Commodities indicators and systems. 

Yes, it is possible to simulate all these things:
1. Sell after N days:

sell = barssince( buy ) == N;
( sell tommorow will look sell = barssince( buy) == 1; )

2. Sell when a close price reached "level":

sell = cross( close, level );

3. Sell after achieving X% profit:

proftarget = 10; /* here you put percentage profit target */

buy = cross( macd(), 0 );
buyprice = valuewhen( buy, close );

sell = cross( 100*(close - buyprice)/buyprice, proftarget );

Above examples could be used in AmiBroker 3.2 and above.
AmiBroker 3.3 features also a direct method of defining maximum loss stops.
Upcoming AmiBroker 3.4 will feature even more options in back testing
(including SAR() function for Parabolic Stop-End-Reverse stops)

BTW: Since I am adding more and more features in 3.4 its release is delayed
again. I am sorry.

Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
Web site: http://www.amibroker.com
Mailing list: amibroker@xxxx