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
To: [email protected]
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 [email protected], "Markus Witzler" <funny...@...> 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