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

Re: [amibroker] Re: Bar number of first trade in CBT


  • Date: Sun, 21 Feb 2010 20:11:59 +0100
  • From: "Markus Witzler" <funnybiz@xxxxxx>
  • Subject: Re: [amibroker] Re: Bar number of first trade in CBT

PureBytes Links

Trading Reference Links



Don´t worry guys, I GOT IT!
 
Markus
----- Original Message -----
Sent: Sunday, February 21, 2010 7:45 PM
Subject: Re: [amibroker] Re: Bar number of first trade in CBT

 

Hello Mike,
 
ProcessTradeSignals doensn´t work since this is a mid-level method - I´m on low level.
 
Instead, I did the code below and keep my head scratching why it doens´t work.
 
As soon as I add these lines to my code and press Backtest, AB briefly jumps to Backtest mask and then all of a sudden back to Quote Editor window without any error message!
 
I initialized "instance = 0 "at the beginning of CBT routine. So, that can´t cause the problems either.
 
I must add that I inserted the loop right after the i-incremented signal loop, so that it is being checked for every time an instance of i has occured. Since I want to get the bar, the first trade of the whole system has been initiated, I only need to get i for the instance = 1.
 
for (trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos())

{

trade = bo.findopenposition(sig.symbol);

if (trade)

{

instance = instance + 1;

}

if (instance == 1)

{

StaticVarSet("Bar_numer_of_first_trade_initiation", i);

}

}

If you nee the whole code´, please let me know!
 
Thanks
 
Markus
 
 
----- Original Message -----
From: Mike
Sent: Saturday, February 20, 2010 10:56 PM
Subject: [amibroker] Re: Bar number of first trade in CBT

 

Hi,

If you're doing low level backtest, then either:

- you're the one entering the trade, in which case just take note of what bar you're on when you do.

- or you're calling ProcessTradeSignals(i) at the end of each bar, in which case just call GetFirstOpenPos(); when it returns non null that'll be the first trade bar.

Mike

--- In amibroker@xxxxxxxxxps.com, "Markus Witzler" <funnybiz@xx.> wrote:
>
> Hello,
>
> I need to retrieve the bar number of first trade in CBT (low level)., i.e. when first trade was opened.
>
> Any clue how to accomplish this?
>
> The only thing I know is I must do this in closed trade list.
>
> Thanks
>
> Markus
>



__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__________ Information from ESET Smart Security, version of virus signature database 4668 (20091207) __________

The message was checked by ESET Smart Security.

http://www.eset.com


__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___