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

[amibroker] HOW TO: Profit Retracement stop - Backtesting



PureBytes Links

Trading Reference Links

Hi there

I have built a backtesting script in AFL for going LONG with stocks - 
it appears to be working. (I am very pleased with the ability to set 
the PositionSize dynamically based on the ATR of the current stock.)

When a long position is performing well, I want to be able to check 
for "retreating profit" and add an extra condition to the SELL 
command. For example, if 40% profit has been made on this position, I 
want to sell the stock if profit then retreats back to 20%.

I am not clear how to do this. How do I ask if we are currently Long? 
Is it possible to find out in AFL the current gain on a long position? 
How can I ask "what is the highest Close since I went Long on this 
stock?"

Many thanks for any suggestions on how to do this!

-Andy (aka Fog)



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date: 1/2/2007 2:58 PM