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

Re: [amibroker] Re: Backtester is opening positions at bar *low*,notat *close*


  • Date: Wed, 30 Dec 2009 22:23:23 +0100
  • From: Tomasz Janeczko <groups@xxxxxxxxxxxxx>
  • Subject: Re: [amibroker] Re: Backtester is opening positions at bar *low*,notat *close*

PureBytes Links

Trading Reference Links

Hello,

You may be using SetForeign (with tradeprices set to true) that will 
give similar effects.

To enable us to serve you best include:
a) AFL formula
b) symbol list you are backtesting on
c) trade list output with transactions that you are questioning  (please 
point out which line you are having trouble with)
d) settings file (go to Automatic Analysis, press "Settings" press 
"Save" and send the .abs file)

Best regards,
Tomasz Janeczko
amibroker.com

On 2009-12-30 22:06, Potato Soup wrote:
> I will send the formula soon. Just know that I'm not using BuyPrice/SellPrice/ShortPrice/CoverPrice at all.
>
> Thx.
>
> -----Original Message-----
> From: Tomasz Janeczko<groups@xxxxxxxxxxxxx>
> Date: Wed, 30 Dec 2009 21:40:11
> To:<amibroker@xxxxxxxxxxxxxxx>
> Subject: Re: [amibroker] Re: Backtester is opening positions at bar *low*,not
>   at *close*
>
> Hello,
>
> I wrote you send the formula to support. It is pointless to discuss
> otherwise.
> Let me give you simple example. If you write in your formula things like
> that:
>
> BuyPrice = Ref( C, -1 );
>
> It will assign BUYPRICE variable to be CLOSE OF YESTERDAY.
>
> But the trade occurs TODAY (because you have set "delay of zero" as you
> wrote).
>
> Now if YESTERDAY CLOSE was lower than TODAYS LOW,  the backtester will
> use  todays LOW price (lowest possible price) because by default it
> protects from using prices outside H-L range as described in the manual
> http://www.amibroker.com/guide/h_backtest.html
>
> The other example can be:
>
> BuyPrice = C - ATR(1);
>
> This will SUBTRACT true range from todays close price and use it as
> buyprice, but if result is lower than todays low, the backtester will
> use lowest possible price (i.e. todays low).
>
> The above is just example of what can happen if you manipulate
> BuyPrice/SellPrice/ShortPrice/CoverPrice in the formula without really
> knowing what you are doing.
>
> As this is academic discussion without you showing the formula you are
> using , I repeat that if you have troubles understanding what your own
> formula is doing you should send it to support.
>
> Best regards,
> Tomasz Janeczko
> amibroker.com
>
> On 2009-12-30 21:03, Potato Soup wrote:
>    
>> Its not assigning a trade price outside the boundaries of the bar. Its assigning it to the low of the bar, not the close. So where does lower than low come in to play?
>> -----Original Message-----
>> From: "progster01"<progster@xxxxxxxxxxxxxxxxxx>
>> Date: Wed, 30 Dec 2009 18:21:07
>> To:<amibroker@xxxxxxxxxxxxxxx>
>> Subject: [amibroker] Re: Backtester is opening positions at bar *low*,not at *close*
>>
>>
>> No, he meant "lower than low" as stated.
>>
>> The reason is that the backtester "knows" not to assign a trade price outside the boundaries of the bar.
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, "Potato Soup"<potatosoupz@xxx>   wrote:
>>
>>      
>>> You mean with prices lower than "Close", not Low right?
>>>
>>>        
>>
>>      
>>> -----Original Message-----
>>> From: Tomasz Janeczko<groups@xxx>
>>> Date: Wed, 30 Dec 2009 16:48:53
>>> To:<amibroker@xxxxxxxxxxxxxxx>
>>> Subject: Re: [amibroker] Re: Backtester is opening positions at bar *low*,
>>>    not at *close*
>>>
>>> Hello,
>>>
>>> Such behaviour can only have one explanation, you
>>> are overriding BuyPrice/ShortPrice with prices lower than Low.
>>> It can happen for example if you are referring to previous day prices
>>> (using Ref())
>>> that can easily be lower than todays.
>>> If you can not spot the error in formula send it to support and Marcin
>>> will tell you where
>>> error is.
>>>
>>> Best regards,
>>> Tomasz Janeczko
>>> amibroker.com
>>>
>>> On 2009-12-30 13:12, Potato Soup wrote:
>>>
>>>        
>>>> I have that value set to 0% in the Portfolio tab. Has been that way
>>>> for some tmie. I will run the test with detailed reports. Thanks.
>>>>
>>>> ------------------------------------------------------------------------
>>>> *From:* Mike<sfclimbers@xxx>
>>>> *To:* amibroker@xxxxxxxxxxxxxxx
>>>> *Sent:* Wed, December 30, 2009 1:32:53 AM
>>>> *Subject:* [amibroker] Re: Backtester is opening positions at bar
>>>> *low*, not at *close*
>>>>
>>>> There is a setting in AA Settings that prevents taking a position if
>>>> your volume exceeds a certain threshold of the bar's volume. If you
>>>> were right on the cusp of that threshold with a lessor commission,
>>>> perhaps with the greater commission (fewere units, same total price)
>>>> you squeeked under the limit and took the trade.
>>>>
>>>> Best way to compare is to set AA Settings reporting to detailed, then
>>>> run under both scenarios and compare the output. You will see why each
>>>> signal was accepted/rejected.
>>>>
>>>> Mike
>>>>
>>>> --- In amibroker@xxxxxxxxxxxxxxx<mailto:amibroker@xxxxxxxxxxxxxxx>,
>>>> Potato Soup<potatosoupz@>   wrote:
>>>>
>>>>          
>>>>> Well I have my account balance at $350k and I'm trading no more than
>>>>>
>>>>>            
>>>> $30k max in positions, how on earth could it skip a trade with that? I
>>>> am using 2:1 margin but with that ratio of capital to exposure it
>>>> should be impossible to have an effect. What else could be the reason?
>>>>
>>>>          
>>>>> Also I have no changes or uses of BuyPrice/SellPrice and I have
>>>>>
>>>>>            
>>>> trade delays set to 0 for all four types of orders.
>>>>
>>>>          
>>>>> Given all that, what other reasons could cause this behavior?
>>>>>
>>>>> Thanks for your help, as always.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ________________________________
>>>>> From: Mike<sfclimbers@>
>>>>> To: amibroker@xxxxxxxxxxxxxxx<mailto:amibroker@xxxxxxxxxxxxxxx>
>>>>> Sent: Tue, December 29, 2009 11:52:48 PM
>>>>> Subject: [amibroker] Re: Backtester is opening positions at bar
>>>>>
>>>>>            
>>>> *low*, not at *close*
>>>>
>>>>          
>>>>> 1. Changing *any* setting related to pricing can affect your trades.
>>>>>
>>>>>            
>>>> All it takes is one penny too little in your account to prevent the
>>>> taking of a trade, which in turn would mean having more funds
>>>> available for the next opportunities (i.e. able to take other trades)
>>>> that would not have been there if the original trade were able to be
>>>> taken at a penny less.
>>>>
>>>>          
>>>>> 2. If you've confirmed that the AA Settings window has the trade
>>>>>
>>>>>            
>>>> price marked as Close, and that you have not put in an override in
>>>> your AFL code (look for BuyPrice, SellPrice and Signal alteration in
>>>> custom backtester code), then check too that you have not set any
>>>> trade delays. A trade delay will cause the next bar(s) price to be
>>>> used which will likely be different than that of the bar on which the
>>>> signal was triggered.
>>>>
>>>>          
>>>>> Mike
>>>>>
>>>>> --- In amibroker@xxxxxxxxxxxxxxx<mailto:amibroker@xxxxxxxxxxxxxxx>,
>>>>>
>>>>>            
>>>> Potato Soup<potatosoupz@>   wrote:
>>>>
>>>>          
>>>>>> Now this is really weird. I just ran the backtester again and also
>>>>>>
>>>>>>              
>>>> noticed that the trade opening and closing is happening on the LOW of
>>>> bars that have signals, not on the CLOSE, as I've defined it in the
>>>> settings for the backtester. I have it set to execute trades on Close
>>>> for all four parameters (buy,sell,short,cover).
>>>>
>>>>          
>>>>>> Why would this be happening? I haven't overriden it in my AFL
>>>>>>
>>>>>>              
>>>> either. It's completely throwing off the results of the test.
>>>> Obviously there's no way to know what the low of a bar would be until
>>>> the bar is complete, and in the past.
>>>>
>>>>          
>>>>>>
>>>>>>              
>>>>>
>>>>>
>>>>> ------------------------------------
>>>>>
>>>>> **** IMPORTANT PLEASE READ ****
>>>>> This group is for the discussion between users only.
>>>>> This is *NOT* technical support channel.
>>>>>
>>>>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>>>>> SUPPORT {at} amibroker.com<http://amibroker.com>
>>>>>
>>>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>>>> http://www.amibroker.com/feedback/
>>>>> (submissions sent via other channels won't be considered)
>>>>>
>>>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>>>> http://www.amibroker.com/devlog/
>>>>>
>>>>> Yahoo! Groups Links
>>>>>
>>>>>
>>>>>            
>>>>
>>>>
>>>> ------------------------------------
>>>>
>>>> **** IMPORTANT PLEASE READ ****
>>>> This group is for the discussion between users only.
>>>> This is *NOT* technical support channel.
>>>>
>>>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>>>> SUPPORT {at} amibroker.com
>>>>
>>>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>>>> http://www.amibroker.com/feedback/
>>>> (submissions sent via other channels won't be considered)
>>>>
>>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>>> http://www.amibroker.com/devlog/
>>>>
>>>> Yahoo! Groups Links
>>>>
>>>>
>>>> amibroker-fullfeatured@xxxxxxxxxxxxxxx
>>>> <mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>          
>>>
>>>        
>>
>>
>> ------------------------------------
>>
>> **** IMPORTANT PLEASE READ ****
>> This group is for the discussion between users only.
>> This is *NOT* technical support channel.
>>
>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>> SUPPORT {at} amibroker.com
>>
>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> http://www.amibroker.com/feedback/
>> (submissions sent via other channels won't be considered)
>>
>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>> ------------------------------------
>>
>> **** IMPORTANT PLEASE READ ****
>> This group is for the discussion between users only.
>> This is *NOT* technical support channel.
>>
>> TO GET TECHNICAL SUPPORT send an e-mail directly to
>> SUPPORT {at} amibroker.com
>>
>> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> http://www.amibroker.com/feedback/
>> (submissions sent via other channels won't be considered)
>>
>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>>
>>      
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>
>
>    


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/