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

[amibroker] Dynamic Stops



PureBytes Links

Trading Reference Links

I want to set a stop on a buy signal calculated using one formula and
then change the the stop on subsequent bars using another formula. I
have tried the following:

Buy = Cross(C, movingAverage);
stopPrice=0;
temp1=0;
if(Buy=1)
	{
		stopPrice=BuyPrice-(mmstp*exitAtr);
	}
		else
			{
				temp1 =(High - (stpParmA *exitAtr)) - stopPrice;
				if (temp1[i] > 0.0)
					{
						stopPrice=stopPrice + (stpParmB*temp1);
					}
				else
					{
						stopPrice=stopPrice; 
					}
			}
This does not work. The initial stop is set OK but the stops on
subsequent bars are not changed.

Any help would be much appreciated.

Best regards,

Drew Yallop


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.2/692 - Release Date: 2/18/2007 4:35 PM