You need to make sure that you've initialized the VarSet ALSO within
the CBT-section, which often means, for example, that:
1) you first create a loop through some watchlist at the beginning of
the CBT-section;
2) assign via VarSet some variable per symbol;
3) recall via VarGet later within the C
--- In amibroker@yahoogroups.com, "vlanschot" <[EMAIL PROTECTED]> wrote:
>
>
> Personally, and FWIW, as I do not always want to clutter my Db with
> numerous ATC's, I often prefer to use VarSet.
>
> PS
>
I eventually tried using VarSet
eg. VarSet( Name() + "_trisk" , TradeRisk );
to
Ooops!! your right!
===
[3768] Symbol = BHP : dt[84] = 15/06/2000 : TRisk[84] = 0.59479
[3768] Symbol = BHP : EntryPrice = 7.96475 : ExitPrice = 7.93425
[3768] Trade.EntryDateTime = 15/06/2000 Risk = 0.59479
===
Thanks PS,
Regards
JW
--- In amibroker@yahoogroups.com, "vlanschot" <[EMAIL PROT
Not to interfere with you correspondence with GP, but I see in your
code that before the CBT-part you've defined
AddToComposite(TradeRisk, "~trisk" + Name(),"C",atcFlagDefaults
|atcFlagEnableInBacktest );
. . . but then you call it as:
TRisk = Foreign("~trisk_" + trade.Symbol,"C");// NOTE:
GP...Here's the simple BO test system i'm using, nothing flash, &
backtest entry/exit prices work as expected.
Regards
=
SetTradeDelays( 0, 0, 0, 0 );
SetOption("InitialEquity", 5 );
SetOption("MaxOpenPositions", 10 );
SetOption("AllowPositionShrinking", False );
SetOption("Price
In your calculation of TradeRisk, how are the variables EntryPrice and
ExitPrice calculated?
Regards,
GP
--- In amibroker@yahoogroups.com, "justinwonono" <[EMAIL PROTECTED]> wrote:
>
> // =
>
>
> Hi GP,
> Thanks for your time & interest.
> I managed to sort out the date problem, but as th
// =
Hi GP,
Thanks for your time & interest.
I managed to sort out the date problem, but as the trace results show
, for some reason, I can't pick up the composite risk value even
though data is definitely there.
Even if i just loop through without the date matching selection, no
data show
>Risk = ValueWhen((Foreign("~trisk_" + trade.Symbol, dt )==
>Trade.EntryDateTime), Foreign("~trisk_" + trade.Symbol,"C")) ;
In this statement, the:
Foreign("~trisk_" + trade.Symbol, dt)
part is incorrect. The second parameter to Foreign is supposed to be
the array type ("C", "O", etc) bu