PureBytes Links
Trading Reference Links
|
I am going to apologize in advance if I am missing something really
easy. I am trying to remove any variablilty associated with my sell
condition so that I can better tweak my buy condition. My original
thought was to go into the future by say 20 periods and find the
highest high and the lowest low at close. I would then sell at which
ever difference is greater than the buy price of my buy condition at
the close of that day. So whenever close = the value of high or low
close then I want to sell. The problem is that the HHV and LLV
functions as well as for loops keep running and recalculating this
value for every new day in backtest mode. Is there any way that I can
set my sell to occur at some point where I will know whether the stock
went up or down so that I can guage the effectiveness of my buy condition?
My current code is as follows:
HighestClose = HHV(Close, 19); // high and low values
LowestClose = LLV(Close, 19); // for next 20 days
BoughtAt = Ref(Open, 1); //buy at open tomorrow
Gained = HighestClose - BoughtAt; // find difference
Lost = BoughtAt - LowestClose;
SellAt = IIf (Gained > Lost, HighestClose, LowestClose);
//calc sell point
Sell = (Close == SellAt);
Any ideas? Thanks in advance.
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|