you might be able to skip the backtester

Essentially check the change in the equity curve between the last trade and 
current trade opportunity

 

Wrote this in an email so check for syntax 

 

e=equity(); // this is your equity curve

 

lasttrade=flip(buy,sell); //if last trade is a buy then lasttrade =1 and stays  
1 until a sell comes in

buy=buy and ((lasttrade and (e>valuewhen(buy,e,2)) or not(lasttrade));

sell=sell and ((not(lasttrade) and (e>valuewhen(sell,e,2)) or lasttrade));

 

Good luck


 


To: [email protected]
From: [email protected]
Date: Mon, 16 Nov 2009 14:27:33 -0800
Subject: [amibroker] If last trade was a loss, Skip trades in same direction as 
the loss

  







Hi Everyone....


I've been getting more comfortable with AFL and have begun trying to recode 
many of my TradeStation systems into AFL... I need some help using the custom 
backtester to accomplish this:

I want to track the last trade on a per symbol basis.  If the last trade on a 
specific symbol in the portfolio was a loser, I want to skip signals in the 
same direction as the losing trade until I get a signal in the opposite 
direction for the specific symbol. 

Thanks in advance.




                                          
_________________________________________________________________
Windows 7: I wanted simpler, now it's simpler. I'm a rock star.
http://www.microsoft.com/Windows/windows-7/default.aspx?h=myidea?ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_myidea:112009

Reply via email to