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

[amibroker] Help to Lock in the Actual Buyiny Date



PureBytes Links

Trading Reference Links

Hello,

I would like to code some sort of chandelier trailing stop (not the
built-in ATR trailing stop) and the stop line will trail the HHV since
the actual buying date. The sell instruction will then be generated
based upon the stop line. The code is something like the following:

Stop_Line=HHV(High,BarsSince(Buy))-2.5*ATR(14);
Sell=cross(close,Stop_Line);

However, the excessive buy signals will reset the BarsSince(Buy) value
and shift the stop line. I know the excessive buy signals can be removed
by code the following code:
buy = ExRem( buy, sell );

But the ExRem() function will require sell value which will rely on
correct stop line.

Stop line --> Sell signal --> remove excessive buy signals --> get
actual buy signal --> get correct Stop line --> dead loop

Would anybody help me to lock in the actual buying date.
Your help is highly appreciated.

Best Regards,

Darwin Ding











Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006