RE: [amibroker] Re: Back test questions

2009-12-22 Thread Somnath Auddy
: [amibroker] Re: Back test questions Hi Peter -- In this code, Buy is True on every bar where the condition RSI(4) is less than 30. As long as RSI(4) stays below 30, Buy stays True. The statement Sell = Close sets the Sell to the value of the Closing price. Since any non-zero value

[amibroker] Re: Back test questions

2009-12-22 Thread peter843
As for the apparent use of stops in your results, do you have any AFL code that is overriding the settings (e.g. ApplyStops)? No. The sample code I posted produces the issues I discussed. One interesting thing about the stops showing up in the trade column is that many of the trades marked

[amibroker] Re: Back test questions

2009-12-21 Thread peter843
Hi Howard, Here is some sample code that has the issues I discussed. --- RSISignal = RSI(4) 30 ; PositionSize = -10; // invest 10% of portfolio equity in single trade Buy = RSISignal ; Sell = Close ; --- --- In amibroker@yahoogroups.com, Howard B howardba...@... wrote: Hi Peter --

[amibroker] Re: Back test questions

2009-12-21 Thread peter843
Hi Howard, Here is some sample code that has the issues I discussed. --- RSISignal = RSI(4) 30 ; PositionSize = -10; // invest 10% of portfolio equity in single trade Buy = RSISignal ; Sell = Close ; --- --- In amibroker@yahoogroups.com, Howard B howardba...@... wrote: Hi Peter --

Re: [amibroker] Re: Back test questions

2009-12-21 Thread Howard B
Hi Peter -- In this code, Buy is True on every bar where the condition RSI(4) is less than 30. As long as RSI(4) stays below 30, Buy stays True. The statement Sell = Close sets the Sell to the value of the Closing price. Since any non-zero value is interpreted as True, and only exactly zero is

[amibroker] Re: Back test questions

2009-12-21 Thread peter843
Hi Howard, I want sell to be true on every bar since I want to cover the position the next day. That works correctly on most trades but there are some in the trade list that lasted much longer - for hundreds of bars. --- In amibroker@yahoogroups.com, Howard B howardba...@... wrote: Hi Peter

[amibroker] Re: Back test questions

2009-12-21 Thread peter843
I changed the code to Sell = 0 and set an n-bar stop of 1. That took care of my issues. --- In amibroker@yahoogroups.com, peter843 yahoogro...@... wrote: Hi Howard, Here is some sample code that has the issues I discussed. --- RSISignal = RSI(4) 30 ; PositionSize = -10; //

[amibroker] Re: Back test questions

2009-12-21 Thread Mike
I believe that either of the two following examples would give you what you want. SetTradeDelays(0, 1, 0, 0); // Delay Sell 'till bar after signal PositionSize = -10; // invest 10% of portfolio equity in single trade RSISignal = RSI(4) 30; Buy = RSISignal; BuyPrice = Close; Sell = Buy;