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

[amibroker] Trailing Stop Lines



PureBytes Links

Trading Reference Links

Can anybody help me? I try to program 2 simple trailing stop lines (5% 
and 10%, adjustable) to see wenn I have to sell a investment by hand. 
The code is below but it´s not realy doing what I want. My main problem 
seems to be, how can I tell the program when to start the lines. the 
easiest way would be by cliking on the chart and pressing the "Buy" 
button. Removeing with the "Sell" button. I thought using bey an sell 
instead of other variables would make it easier, but I am not sure.
If you try it you can see that it´s not doing what I wanted ;-).
Can anybody help me what to change. 

Regards
Werner

// AFL Code:

TrailStop_1 = Param("Trailing Stop 1",5,1,50,1);
TrailStop_2 = Param("Trailing Stop 2",10,1,50,1);

Buy = Sell = 0;

Buy = ParamTrigger("Start", "Start" );					
	
Sell = ParamTrigger("Clear", "Clear Trailing Stops" ); 	
Toggle = Flip( Buy, Sell);						
				
Stopline_1 = IIf( Toggle, HighestSince( Buy, High ) * ( 1 - 0.01 * 
TrailStop_1 ), Null );		// Stoplinie an wenn Toggle = 1
Stopline_2 = IIf( Toggle, HighestSince( Buy, High ) * ( 1 - 0.01 * 
TrailStop_2 ), Null );

Plot( Stopline_1 , "Trailing Stop Line 1", colorRed );
Plot( Stopline_2 , "Trailing Stop Line 2", colorBlue );



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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/