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

Re: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]



PureBytes Links

Trading Reference Links

Hello,

If you want to duplicate (I don't know for what purpose, but anyway), these descriptions:
http://www.amibroker.com/guide/w_report.html

are perfectly adequate.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "brian_z111" <brian_z111@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, May 19, 2008 12:12 AM
Subject: [amibroker] Re: System Performance Indicators [was: Can someone fix this OLE code?]


> Also,
> 
> I know that people in the past have asked you (Tomasz) to provide the 
> equations that you use for calculating your metrics/indicators in 
> more detail and from memory I don't think you want to say anything 
> extra about it (proprietry info?).
> 
> Personally I think you should take the risk and give full 
> transperancy.
> The fact is that I can go to the text books and calc my own metrics 
> from first principles BUT then I have to try and guess exactly what 
> you have done (in house), see if it matches my efforts and then try 
> to explain any differences (this drives me crazy because it uses up 
> so much time on bread and butter issues).
> 
> d- yes I read on after I posted - thanks.
> 
> Re scripting - my opinion is that it is not that hard and it isn't 
> getting the attention it deserves - I intend learning it - I believe 
> there is some payback there.
> 
> BTW - what do we do for srcipting if we use a Mac - what do we use 
> instead of WSH?
> 
> brian_z
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "brian_z111" <brian_z111@xxx> wrote:
>>
>> Tomasz,
>> 
>> Thanks to you for your answer, and also the other contributors to 
>> this discussion, which I find helpful.
>> 
>> First I will get on my hobby horse.
>> 
>> We have shot ourselves in the foot with our reluctance to move to a 
>> forum with better tools and support the UKB initiative because the 
>> discussion in this forum is inefficient (no whiteboard, no 
>> categorization, no inline images) - it can be hard to understand 
> what 
>> the cutting edge thinkers are talking about without some pictures.
>> 
>> Let's hope some stubborn minded fool comes along, works his  
> backside 
>> off to offer us an alternative and the majority vote with their 
> feet 
>> and actually use it.
>> 
>> 
>> 
>> Re the current discussion:
>> 
>> - now that I am an AB survivor I want different things than before
>> - I now view it as a backtesting engine fullstop (I can get stats 
>> packs and do MoneyManagement elsewhere but I can't replace the BT 
>> features)
>> - it is a good thing that AB can do anything, if I am good enough 
>> (because it is a complete programming language and because it is 
> open 
>> to development)so thanks for that Tomasz.
>> If I work hard I can do things way beyond any other program that I 
>> know of.
>> - while some people struggle with the array concept I actually find 
>> it easier for me to think in those terms and it is embedded in my 
>> mindview of how AB works SO I personally want more arrays and less 
>> COM/CBT
>> - one problem is that AB survivors have gone beyond the textbooks 
> and 
>> are cutting edge specialists (we find it hard to even talk to each 
>> other because our perspectives are totally unique). It would be 
> very 
>> hard for you to code into AB what each one of us wants.
>> - AB is not optimised for backtesting yet (it is not your fault the 
>> fact is that current practise is rooted in the past while your best 
>> students are pusning the boundaries, while not wanting to give away 
>> too much about what they are doing.
>> - 'we' need to push on with backtesting improvements
>> - for now (until I get off my butt and learn some more real 
>> programming) I am a hardened array programmer and this is what I 
> want 
>> to do:
>> 
>> a) backtest a watchlist
>> b) set the bar range to backtest (no. bars or date range) etc
>> c) get all trades irrespective of available equity 
>> d) turn off money managment (optional to turn back on if needed)
>> e) for each symbol as an array return - all trades (as%)
>>                                        - time in trade
>> f) reference the trade series for each symbol so that I can calc 
>> stdev, ave, W/L, PayOff ratios etc.
>> 
>> Do all this in AFL/arrays.
>> 
>> Perhaps I could even save the results the way we save the backtest 
>> reports at the moment.
>> 
>> In summary what I am after is a trade series matrix with a symbol 
>> list as the row header and trade no. (time based) as the column 
>> heading AND I want this to be persistent, at least for the life of 
>> the BT OR at least to export it to a spreadsheet as a matrix.
>> 
>> Can I do this, all from AFL with a click of the BT button, at the 
>> moment?
>> 
>> Please note: I have tried to talk a little bit about system root 
>> analysis in this forum but it gets lost without pictures and a 
>> tutorial BUT with trade series% and time in trade, as arrays, we 
> can 
>> perform any metric/equity analysis we can think of and plot any 
> combo 
>> we want.
>> 
>> The metrics are not actually scalar, they are only reported that 
> way 
>> in AB. They do have variance so it people are interested in that 
> they 
>> can get if from the trade series.
>> 
>> Thanks,
>> 
>> I appreciate you taking the time to consider our views on the BT 
>> feature.
>> 
>> brian_z
>> 
>>   
>> 
>> 
>> 
>> 
>> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> 
>> wrote:
>> >
>> > Hello,
>> > 
>> > You are mixing two things:
>> > a) equity derived metrics (such as drawdown) - that represent 
>> ARRAYS  and that are available already
>> > b) other metrics (like trade profits, trade duration) that are 
>> single SCALARS
>> > 
>> > a)
>> > Any EQUITY-based indicator is already possible via Equity chart.
>> > Sample Equity chart contains:
>> > equity
>> > cash,
>> > drawdown (underwater equity)
>> > bars since last equity high.
>> > 
>> > If you want to customize equity chart simply modify _Portfolio 
>> Equity.afl file. 
>> > Fred has done so and he is using for example Log(Equity) in his 
> IO 
>> together with some other metrics
>> > derived from Equity. It does not require any COM. Just take 
>> portfolio equity usign Foreign("~~~EQUITY", "C")
>> > 
>> > Below is the code that Fred is using in his IO for the reference. 
>> > 
>> > Everybody can modify his/her Portfolio Equity formula to suit 
> one's 
>> need.
>> > The code is open and you are free to modify it.
>> > 
>> > b)
>> > 
>> > As to
>> > > That SYSTEM PERFORMANCE INDICATORS are not offered as standard 
>> (build in) indicators is simply a lack of imagination. 
>> > > To plot the UPI, number of winning trades, trade profits, trade 
>> duration, or other system performance statistic 
>> > > on a time scale simply makes a lot common sense. btw, 
>> > > Applying these functions to price arrays can also give very 
>> interesting results. Price and equity arrays are not that different.
>> > 
>> > These metrics are NUMBERS. Just single SCALARS. They do NOT 
> change 
>> over time. They are constant for single backtest.
>> > If you plot them you will get FLAT LINE.
>> > 
>> > > Saying "If you really have to plot them" is like saying "if you 
>> really have to make money".
>> > 
>> > >  The lack of System Performance Indicators is simply a void in 
>> technical analysis ready (LONG OVERDUE!) to
>> > 
>> > > be filled. To have to use the CBT, export the data, import the 
>> data, etc. to create 
>> > 
>> > > System Performance Indicators is simply too much work; no one 
>> will do it. 
>> > 
>> > 
>> > 
>> > The system performance metrics are single NUMBERS (scalars). Just 
>> like 23.4. This is a number that does not change. When plotted - it 
>> is FLAT LINE.
>> > 
>> > 
>> > 
>> > They are not "overdue" because they simply are reported in 
> BACKTEST 
>> REPORT, as numbers. 
>> > 
>> > The same as in Tradestation, Wealth Lab, Trading Recipes, or 
>> whatever.
>> > 
>> > 
>> > 
>> > > Most of us are here to trade and not to > learn new programming 
>> languages; 
>> > 
>> > > OLE and CBT are advanced tools for programmers. imo, System 
>> Performance Indicators should be as readily available as the RSI() 
>> and CMO(). 
>> > 
>> > 
>> > Again, you are missing the point. Backtest metrics are scalars, 
> not 
>> arrays like RSI/CMO.
>> > The metrics are available as single numbers AFTER backtest.
>> > If some metric is say 23.4 plotting it would result in flat line 
>> like
>> > Plot( 23.4, "Sample metric plot", colorRed );
>> > 
>> > Best regards,
>> > Tomasz Janeczko
>> > amibroker.com
>> > 
>> > /**** BELOW CODE IS A PART OF IO.zip (Intelligent Optimizer by 
> Fred 
>> Tonetti) archive from the AmiBroker Mailing List File section ***/
>> > /*** http://finance.groups.yahoo.com/group/amibroker/files/IO.zip 
>> ****/
>> > /*** It shows example customization of built-in portfolio equity 
>> chart */
>> > 
>> > #pragma nocache
>> > 
>> > MaxGraph    = 10;
>> > GraphZOrder =  1;
>> > GraphYSpace =  5;
>> > 
>> > Arrows   = ParamToggle("Arrows", "No|Yes", 1);
>> > 
>> > BIR      = IIf(Status("BarInRange") > 0, 1, 0);
>> > 
>> > ISeq     = Foreign("~~~EQUITY", "C", 1);
>> > 
>> > CurEq    = Foreign("~~IO~Equity", "C", 1);
>> > CurIOS   = Foreign("~~IO~Equity", "V", 1);
>> > CurSig   = Foreign("~~IO~Equity", "I", 1);
>> > 
>> > CS128    = IIf(CurSig >= 128, 1, 0);
>> > CurSig   = IIf(CS128  == 1, CurSig - 128, CurSig);
>> > CS64     = IIf(CurSig >= 64, 1, 0);
>> > CurSig   = IIf(CS64   == 1, CurSig - 64, CurSig);
>> > CS32     = IIf(CurSig >= 32, 1, 0);
>> > CurSig   = IIf(CS32   == 1, CurSig - 32, CurSig);
>> > CS16     = IIf(CurSig >= 16, 1, 0);
>> > CurSig   = IIf(CS16   == 1, CurSig - 16, CurSig);
>> > CS8      = IIf(CurSig >= 8, 1, 0);
>> > CurSig   = IIf(CS8    == 1, CurSig - 8, CurSig);
>> > CS4      = IIf(CurSig >= 4, 1, 0);
>> > CurSig   = IIf(CS4    == 1, CurSig - 4, CurSig);
>> > CS2      = IIf(CurSig >= 2, 1, 0);
>> > CurSig   = IIf(CS2    == 1, CurSig - 2, CurSig);
>> > CS1      = IIf(CurSig >= 1, 1, 0);
>> > CurSig   = IIf(CS1    == 1, CurSig - 1, CurSig);
>> > 
>> > BarEnt   = IIf(CS1 == 1 OR CS4 == 1 OR CS16 == 1 OR CS64 == 1, 1, 
>> 0);
>> > CurEnt   = IIf(BarEnt != 0, CurEq, 0);
>> > 
>> > LastIS   = CurIOS == 0 AND Ref(CurIOS, 1) != 0;
>> > OtherOOS = CurIOS != Ref(CurIOS, 1);
>> > 
>> > MaxEq    = Highest(CurEq);
>> > FlatEq   = IIf(BIR, BarsSince(MaxEq > Ref(MaxEq,-1)),0);
>> > MaxFlat  = Highest(FlatEq);
>> > LMaxFlat = LastValue(MaxFlat) * (1 + GraphYSpace / 100);
>> > LogEq    = log10(CurEq);
>> > 
>> > CurDD    = IIf(CurEq < MaxEq, 100 * (MaxEq - CurEq) / MaxEq, 0);
>> > RCurDD   = round(CurDD * 100) / 100;
>> > MaxDD    = Highest(CurDD);
>> > RMaxDD   = round(MaxDD * 100) / 100;
>> > LMaxDD   = LastValue(MaxDD) * (1 + GraphYSpace / 100);
>> > SqrDD    = CurDD ^ 2;
>> > CumDD    = Cum(SqrDD);
>> > 
>> > MaxEnt   = Highest(CurEnt);
>> > CurDDE   = IIf(CurEq < MaxEnt, 100 * (MaxEnt - CurEq) / MaxEnt, 
> 0);
>> > RCurDDE  = round(CurDDE * 100) / 100;
>> > MaxDDE   = Highest(CurDDE);
>> > RMaxDDE  = round(MaxDDE * 100) / 100;
>> > 
>> > FirstBar = LastValue(ValueWhen(Status("FirstBarInRange") > 0, Cum
>> (1)));
>> > LastBar  = LastValue(ValueWhen(Status("LastBarInRange") > 0, Cum
>> (1)));
>> > TotBars  = LastValue(Cum(1));
>> > BarNo    = ValueWhen(BIR > 0, Cum(1) - FirstBar + 1);
>> > NoBars   = LastValue(BarNo);
>> > 
>> > Dates    = DateNum();
>> > Days     = ValueWhen(BIR > 0, IIf(Dates != Ref(Dates,-1), 1, 0));
>> > TotDays  = Cum(Days);
>> > BPD      = round(BarNo / TotDays);
>> > 
>> > BAHEq       = ValueWhen(BIR > 0, Ref(CurEq, -(BarNo - 1)) * (C / 
> Ref
>> (C, -(BarNo - 1))));
>> > BAHMaxEq    = Highest(BAHEq);
>> > BAHFlatEq   = IIf(BIR, BarsSince(BAHMaxEq > Ref(BAHMaxEq,-1)),0);
>> > BAHMaxFlat  = Highest(BAHFlatEq);
>> > BAHLMaxFlat = LastValue(BAHMaxFlat) * (1 + GraphYSpace / 100);
>> > 
>> > BAHCurDD    = IIf(BAHEq < BAHMaxEq, 100 * (BAHMaxEq - BAHEq) / 
>> BAHMaxEq, 0);
>> > BAHRCurDD   = round(BAHCurDD * 100) / 100;
>> > BAHMaxDD    = Highest(BAHCurDD);
>> > BAHRMaxDD   = round(BAHMaxDD * 100) / 100;
>> > BAHLMaxDD   = LastValue(BAHMaxDD) * (1 + GraphYSpace / 100);
>> > BAHSqrDD    = BAHCurDD ^ 2;
>> > BAHCumDD    = Cum(BAHSqrDD);
>> > 
>> > LogBAHEq   = log10(BAHEq);
>> > 
>> > CAR      = ValueWhen(BIR > 0, 100 * ((CurEq / Ref(CurEq, -(BarNo -
> 
>> 1))) ^ (1 / (BarNo / BPD / 252)) -1));
>> > Ann      = ValueWhen(BIR > 0, 100 * ((CurEq / Ref(CurEq, -(252 * 
>> BPD)) - 1)));
>> > MAR      = ValueWhen(BIR > 0, CAR / MaxDD);
>> > UI       = ValueWhen(BIR > 0, sqrt(CumDD / BarNo));
>> > UPI      = (CAR - 5.4) / UI;
>> > 
>> > BAHCAR   = ValueWhen(BIR > 0, 100 * ((BAHEq / Ref(BAHEq, -(BarNo -
> 
>> 1))) ^ (1 / (BarNo / BPD / 252)) -1));
>> > BAHAnn   = ValueWhen(BIR > 0, 100 * ((BAHEq / Ref(BAHEq, -(252 * 
>> BPD)) - 1)));
>> > BAHMAR   = ValueWhen(BIR > 0, BAHCAR / BAHMaxDD);
>> > BAHUI    = ValueWhen(BIR > 0, sqrt(BAHCumDD / BarNo));
>> > BAHUPI   = (BAHCAR - 5.4) / BAHUI;
>> > 
>> > OSCAR1   = ValueWhen(CurIOS >= 1, 100 * ISEq / Highest(ValueWhen
>> (LastIS == 1, ISEq)));
>> > OSMaxEq1 = ValueWhen(CurIOS >= 1, Highest(ISEq));
>> > OSCurDD1 = IIf(CurIOS >= 1, 100 * (OSMaxEq1 - ISEq) / OSMaxEq1, 
> 0);
>> > OSMaxDD1 = Highest(OSCurDD1);
>> > OSMAR1   = OSCAR1 / OSMaxDD1;
>> > 
>> > OSCAR2   = ValueWhen(CurIOS >= 1, 100 * CurEq / Highest(ValueWhen
>> (LastIS == 1, CurEq)));
>> > OSMaxEq2 = ValueWhen(CurIOS >= 1, Highest(CurEq));
>> > OSCurDD2 = IIf(CurIOS >= 1, 100 * (OSMaxEq2 - CurEq) / OSMaxEq2, 
> 0);
>> > OSMaxDD2 = Highest(OSCurDD2);
>> > OSMAR2   = OSCAR2 / OSMaxDD2;
>> > 
>> > WFEcar   = 100 * OSCAR2 / OSCAR1;
>> > WFEmar   = 100 * OSMAR2 / OSMAR1;
>> > 
>> > b0       = LastValue(LinRegIntercept(Ref(LogEq, -(TotBars - 
>> LastBar)), NoBars));
>> > m        = LastValue(LinRegSlope(Ref(LogEq, -(TotBars - 
> LastBar)), 
>> NoBars));
>> > y        = m * BarNo + b0;
>> > 
>> > BarsCum  = ValueWhen(BIR > 0, Cum(BarNo));
>> > AvgBar   = LastValue(BarsCum) / NoBars;
>> > SRDevSQ  = ValueWhen(BIR > 0, sqrt(Cum((BarNo - AvgBar) ^ 2)));
>> > ErrEq    = LastValue(StdErr(Ref(logEq, -(TotBars - LastBar)), 
>> NoBars));
>> > KRatio   = ValueWhen(BIR > 0, m * SRDevSQ / ErrEq / sqrt(NoBars));
>> > 
>> > Title1 = EncodeColor(ColorRGB(160,160,160)) + "LinReg= "  + 
>> EncodeColor(ColorRGB(128,128,255)) + WriteVal(10 ^ y,     3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "CurFlat="  + 
>> EncodeColor(ColorRGB(255,223,  0)) + WriteVal(FlatEq,     3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "Ann="      + 
>> EncodeColor(ColorRGB(  0,255,  0)) + WriteVal(Ann,        3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MDDE="     + 
>> EncodeColor(ColorRGB(255,128,  0)) + WriteVal(MaxDDE,     3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "CDD="      + 
>> EncodeColor(ColorRGB(255,  0,  0)) + WriteVal(CurDD,      3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "wfeCAR="   + 
>> EncodeColor(ColorRGB(255,255,  0)) + WriteVal(WFECar,     3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "wfeMAR="   + 
>> EncodeColor(ColorRGB(255,255,  0)) + WriteVal(WFEMAR,     3.2) 
> + "% ";
>> > 
>> > Title2 = "\n" +
>> >          EncodeColor(ColorRGB(160,160,160)) + "Equity = " + 
>> EncodeColor(ColorRGB(224,224,224)) + WriteVal(CurEq,      3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MaxFlat="  + 
>> EncodeColor(ColorRGB(255,223,  0)) + WriteVal(MaxFlat,    3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "CAR="      + 
>> EncodeColor(ColorRGB(  0,255,  0)) + WriteVal(CAR,        3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MDD="      + 
>> EncodeColor(ColorRGB(255,  0,  0)) + WriteVal(MaxDD,      3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MAR="      + 
>> EncodeColor(ColorRGB(  0,255,  0)) + WriteVal(MAR,        3.2) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "UI="       + 
>> EncodeColor(ColorRGB(255,  0,255)) + WriteVal(UI,         3.2) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "UPI="      + 
>> EncodeColor(ColorRGB(  0,255,  0)) + WriteVal(UPI,        3.2) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "KR="       + 
>> EncodeColor(ColorRGB(160,255,160)) + WriteVal(KRatio,     3.2) 
> + " ";
>> > 
>> > Title3 = "\n" +
>> >          EncodeColor(ColorRGB(160,160,160)) + "B & H  = " + 
>> EncodeColor(ColorRGB(128,128,128)) + WriteVal(BAHEq,      3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MaxFlat="  + 
>> EncodeColor(ColorRGB(208,176,  0)) + WriteVal(BAHMaxFlat, 3.0) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "CAR="      + 
>> EncodeColor(ColorRGB(  0,192,  0)) + WriteVal(BAHCAR,     3.2) 
> + "% " 
>> +
>> >          EncodeColor(ColorRGB(160,160,160)) + "MDD="      + 
>> EncodeColor(ColorRGB(208,  0,  0)) + WriteVal(BAHMaxDD,   3.2) 
> + "% " 
>> + 
>> >          EncodeColor(ColorRGB(160,160,160)) + "MAR="      + 
>> EncodeColor(ColorRGB(  0,192,  0)) + WriteVal(BAHMAR,     3.2) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "UI="       + 
>> EncodeColor(ColorRGB(208,  0,208)) + WriteVal(BAHUI,      3.2) 
> + " " +
>> >          EncodeColor(ColorRGB(160,160,160)) + "UPI="      + 
>> EncodeColor(ColorRGB(  0,192,  0)) + WriteVal(BAHUPI,     3.2);
>> > 
>> > Title = Title1 + Title2 + Title3;
>> > 
>> > Plot(IIf(BarNo > 0 AND BIR >  0, -RCurDD,  -1e10), "CDD",   
>> colorDarkRed, styleThick | styleOwnScale | styleArea, -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0 AND BIR == 0, -RCurDD,  -1e10), "CDD",   
>> colorDarkRed, styleThick | styleOwnScale | styleLine, -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0,              -RMaxDD,  -1e10), "MDD",   
>> colorDarkRed, styleThick | styleOwnScale,             -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0 AND BIR >  0, -RCurDDE, -1e10), "CDDE",  
>> colorOrange,  styleThick | styleOwnScale | styleArea, -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0 AND BIR == 0, -RCurDDE, -1e10), "CDDE",  
>> colorOrange,  styleThick | styleOwnScale | styleLine, -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0,              -RMaxDDE, -1e10), "MDDE",  
>> colorOrange,  styleThick | styleOwnScale,             -LMaxDD,   
>> LMaxDD);
>> > Plot(IIf(BarNo > 0,               FlatEq,  -1e10), "CF",    
>> colorGold,    styleThick | styleOwnScale | styleArea, -LMaxFlat, 
>> LMaxFlat);
>> > Plot(IIf(BarNo > 0,               MaxFlat, -1e10), "MF",    
>> colorGold,    styleThick | styleOwnScale,             -LMaxFlat, 
>> LMaxFlat);
>> > 
>> > Plot(LastIS,   "LastIS",   colorLightGrey, styleHistogram | 
>> styleThick | styleNoLabel | styleOwnScale);
>> > Plot(OtherOOS, "OtherOOS", colorLightGrey, styleHistogram 
>> |              styleNoLabel | styleOwnScale);
>> > 
>> > Plot(IIf(BIR > 0, Y,        -1e10), "L/R Eq", colorBlue,      
>> styleThick | styleNoLabel);
>> > Plot(IIf(BIR > 0, LogBAHEq, -1e10), "BAH Eq", colorGrey50,    
>> styleThick | styleNoLabel);
>> > Plot(IIf(BIR > 0, LogEq,    -1e10), "Sys Eq", colorLightGrey, 
>> styleThick | styleNoLabel);
>> > 
>> > S1   = (CS1   == 1) * shapeUpArrow;
>> > S2   = (CS2   == 1) * shapeDownArrow;
>> > S4   = (CS4   == 1) * shapeDownArrow;
>> > S8   = (CS8   == 1) * shapeUpArrow;
>> > S16  = (CS16  == 1) * shapeUpArrow;
>> > S32  = (CS32  == 1) * shapeDownArrow;
>> > S64  = (CS64  == 1) * shapeDownArrow;
>> > S128 = (CS128 == 1) * shapeUpArrow;
>> > 
>> > if (Arrows == True)
>> > {
>> >     PlotShapes(IIf(BIR > 0, S2,   -1e10), colorWhite,       0, 
>> LogEq, -11);
>> >     PlotShapes(IIf(BIR > 0, S8,   -1e10), colorWhite,       0, 
>> LogEq, -11);
>> > 
>> >     PlotShapes(IIf(BIR > 0, S1,   -1e10), colorBrightGreen, 0, 
>> logEq, IIf(CS8,   -17, -11));
>> >     PlotShapes(IIf(BIR > 0, S4,   -1e10), colorRed,         0, 
>> logEq, IIf(CS2,   -17, -11));
>> > 
>> >     PlotShapes(IIf(BIR > 0, S32,  -1e10), colorGrey50,      0, 
>> LogEq, -11);
>> >     PlotShapes(IIf(BIR > 0, S128, -1e10), colorGrey50,      0, 
>> LogEq, -11);
>> > 
>> >     PlotShapes(IIf(BIR > 0, S16,  -1e10), colorBlue,        0, 
>> LogEq, IIf(CS128, -17, -11));
>> >     PlotShapes(IIf(BIR > 0, S64,  -1e10), 11,               0, 
>> LogEq, IIf(CS32,  -17, -11));
>> > }
>> >   ----- Original Message ----- 
>> >   From: Herman 
>> >   To: Tomasz Janeczko 
>> >   Sent: Monday, May 19, 2008 2:12 AM
>> >   Subject: [amibroker] System Performance Indicators [was: Can 
>> someone fix this OLE code?]
>> > 
>> > 
>> >   Tomasz, I am neither a mathematician nor a professional 
>> programmer and I really don't know how to convey this simple and 
>> obvious idea any better. If this email doesn't get the idea across 
>> I'll let it be. If others understand what I am talking about they 
> can 
>> continue the discussion. 
>> > 
>> > 
>> > 
>> > 
>> >   Indicators to display system performance are an effective and 
>> essential tool in the design and evaluation of trading systems. 
>> Trading the equity is a simple example, plotting DrawDowns is 
>> another. 
>> > 
>> > 
>> > 
>> > 
>> >   Traditional Indicators are based on PRICE; System Performance 
>> Indicators are based on EQUITY. 
>> > 
>> > 
>> > 
>> > 
>> >   That SYSTEM PERFORMANCE INDICATORS are not offered as standard 
>> (build in) indicators is simply a lack of imagination. To plot the 
>> UPI, number of winning trades, trade profits, trade duration, or 
>> other system performance statistic on a time scale simply makes a 
> lot 
>> common sense. btw, Applying these functions to price arrays can 
> also 
>> give very interesting results. Price and equity arrays are not that 
>> different.
>> > 
>> > 
>> > 
>> > 
>> >   Saying "If you really have to plot them" is like saying "if you 
>> really have to make money". The lack of System Performance 
> Indicators 
>> is simply a void in technical analysis ready (LONG OVERDUE!) to be 
>> filled. To have to use the CBT, export the data, import the data, 
>> etc. to create System Performance Indicators is simply too much 
> work; 
>> no one will do it. Most of us are here to trade and not to learn 
> new 
>> programming languages; OLE and CBT are advanced tools for 
>> programmers. imo, System Performance Indicators should be as 
> readily 
>> available as the RSI() and CMO(). 
>> > 
>> > 
>> > 
>> > 
>> >   best regards,
>> > 
>> >   herman
>> > 
>> > 
>> > 
>> > 
>> >   Sunday, May 18, 2008, 4:17:49 AM, you wrote:
>> > 
>> > 
>> > 
>> > 
>> >         >
>> >        Hello,
>> > 
>> > 
>> > 
>> >         1. Even if it works it is completely not supported and 
> may 
>> to problems/crashes etc. It is like driving all the time on reverse 
>> gear.
>> > 
>> >         Reverse gear is not designed to be used for 10 hours 
> drive.
>> > 
>> > 
>> > 
>> >         2. I see no reason to "plot" single numbers like UPI, 
>> number of trades in indicator.  That would be just a bunch of flat 
>> lines.
>> > 
>> >         Also indicator should be lightweight. The indicator code 
>> should execute very quickly because indicators are refreshed very 
>> often.
>> > 
>> >         You are (ab)using indicators for things not designed for 
>> them. Indicator code is for indicators. Automatic analysis is for 
>> backtesting. Indicators are not
>> > 
>> >         and should never be used that way.
>> > 
>> > 
>> > 
>> >         3. If you really need to plot them
>> > 
>> >         - all stats are accessible from CUSTOM BACKTESTER, if you 
>> want to "plot" them, use custom backtester,
>> > 
>> >         write them to TEXT File (using fopen/fputs/fclose) and 
> from 
>> the indicator you will be able to read them (using 
> fopen/fgets/fclose)
>> > 
>> > 
>> > 
>> >         That's a proper way to do that.
>> > 
>> > 
>> > 
>> >         To repeat the same analogy - although you can drive on 
>> reverse gear for 100 miles, your cars is not designed to be used 
> that 
>> way.
>> > 
>> > 
>> > 
>> > 
>> >         Best regards,
>> > 
>> >         Tomasz Janeczko
>> > 
>> >         amibroker.com
>> > 
>> >         ----- Original Message ----- 
>> > 
>> >         From: Herman 
>> > 
>> >         To: Tomasz Janeczko 
>> > 
>> >         Cc: amibroker@xxxxxxxxxxxxxxx 
>> > 
>> >         Sent: Saturday, May 17, 2008 2:28 PM
>> > 
>> >         Subject: Re: [amibroker] Can someone fix this OLE code?
>> > 
>> > 
>> > 
>> > 
>> >         OK Tomasz, but the code produces a nice BT report each 
> time 
>> i click the Trigger. Seemingly flawless. Seems only a tweak would 
> be 
>> required to make it work robust.
>> > 
>> > 
>> > 
>> > 
>> >         I am going through all this trouble just to be able to 
>> access the Backtester stats from an indicator (I was going to 
> extract 
>> the last value from the report on bar-by-bar BTs!). 
>> > 
>> > 
>> > 
>> > 
>> >         System analysis in the time domain is 
> frustrated/impossible 
>> because basic AB users (non professional programmer) can't retrieve 
>> and plot the Backtester stats, like UPI, %Winners, Number of 
> trades, 
>> etc. Thus there is a big void wrt system analysis - see my 
> suggestion 
>> #1335 and support tag [#49377]. 
>> > 
>> > 
>> > 
>> > 
>> >         I wish that formulas for these functions were made public 
>> so that they can be used in indicators. This Would open up a whole 
>> new world to evaluate, analyze, and design trading systems. The 
>> single numbers in the AA give very limited information. With all 
>> respect, please do not mention the CBT... that solution is for less 
>> than 10% of users and I don't have enough days left to learn all 
> that 
>> stuff.
>> > 
>> > 
>> > 
>> > 
>> >         best regards,
>> > 
>> >         herman
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> >         Saturday, May 17, 2008, 8:10:10 PM, you wrote:
>> > 
>> > 
>> > 
>> > 
>> >               >
>> >              But... the example in help
>> > 
>> >               a) works
>> > 
>> >               b) presents OUTSIDE ***JScript*** code
>> > 
>> >               http://www.amibroker.com/guide/objects.html
>> > 
>> >               c) does not contain
>> > 
>> >               AA.Analysis.RangeN (wrong line)
>> > 
>> > 
>> > 
>> >               Again I want to stress that out that Analysis COM 
>> object must not be used form 
>> > 
>> >               AFL level. The functionality is provided to control 
>> Automatic Analysis from OUTSIDE
>> > 
>> >               of AmiBroker. 
>> > 
>> > 
>> > 
>> > 
>> >               Best regards,
>> > 
>> >               Tomasz Janeczko
>> > 
>> >               amibroker.com
>> > 
>> >               ----- Original Message ----- 
>> > 
>> >               From: Herman 
>> > 
>> >               To: dingo 
>> > 
>> >               Sent: Saturday, May 17, 2008 2:02 PM
>> > 
>> >               Subject: Re: [amibroker] Can someone fix this OLE 
>> code?
>> > 
>> > 
>> > 
>> > 
>> >               won't do. Actually 99% of this code was copied from 
>> the AB help.
>> > 
>> > 
>> > 
>> > 
>> >               h
>> > 
>> > 
>> > 
>> > 
>> >               For tips on developing Real-Time Auto-Trading 
> systems 
>> visit:
>> > 
>> >               http://www.amibroker.org/userkb/
>> > 
>> > 
>> > 
>> > 
>> >               Saturday, May 17, 2008, 7:54:44 PM, you wrote:
>> > 
>> > 
>> > 
>> > 
>> >                     >
>> >                    ON the clearfilters() take off the () and try 
> it.
>> > 
>> > 
>> > 
>> >                     d
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > ------------------------------------------------------------
>> > 
>> >                     From: amibroker@xxxxxxxxxxxxxxx 
>> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman
>> > 
>> >                     Sent: Saturday, May 17, 2008 7:49 AM
>> > 
>> >                     To: dingo
>> > 
>> >                     Cc: amibroker@xxxxxxxxxxxxxxx
>> > 
>> >                     Subject: Re: [amibroker] Can someone fix this 
>> OLE code?
>> > 
>> > 
>> > 
>> > 
>> >                     it runs fine except for the WLN and BRS 
> changes 
>> i need.
>> > 
>> > 
>> > 
>> > 
>> >                     h
>> > 
>> > 
>> > 
>> > 
>> >                     For tips on developing Real-Time Auto-Trading 
>> systems visit:
>> > 
>> >                     http://www.amibroker.org/userkb/
>> > 
>> > 
>> > 
>> > 
>> >                     Saturday, May 17, 2008, 7:46:35 PM, you wrote:
>> > 
>> > 
>> > 
>> > 
>> >                           >
>> >                          Maybe AB won't let you run a backtest 
>> within an indicator - time to ask TJ.
>> > 
>> > 
>> > 
>> >                           d
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > ------------------------------------------------------
>> > 
>> >                           From: amibroker@xxxxxxxxxxxxxxx 
>> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman
>> > 
>> >                           Sent: Saturday, May 17, 2008 7:40 AM
>> > 
>> >                           To: dingo
>> > 
>> >                           Cc: amibroker@xxxxxxxxxxxxxxx
>> > 
>> >                           Subject: Re: [amibroker] Can someone 
> fix 
>> this OLE code?
>> > 
>> > 
>> > 
>> > 
>> >                           Hi d, I tried that initially but No go.
>> > 
>> > 
>> > 
>> > 
>> >                           thanks,
>> > 
>> >                           herman
>> > 
>> > 
>> > 
>> > 
>> >                           For tips on developing Real-Time Auto-
>> Trading systems visit:
>> > 
>> >                           http://www.amibroker.org/userkb/
>> > 
>> > 
>> > 
>> > 
>> >                           Saturday, May 17, 2008, 7:35:20 PM, you 
>> wrote:
>> > 
>> > 
>> > 
>> > 
>> >                                 >
>> >                                On the lines that give the error 
>> substitute a number constant for the variable and see if it works. 
> If 
>> it does then it looks to me like it thinks the variables are arrays.
>> > 
>> > 
>> > 
>> >                                 d
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > ------------------------------------------------
>> > 
>> >                                 From: amibroker@xxxxxxxxxxxxxxx 
>> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Herman
>> > 
>> >                                 Sent: Saturday, May 17, 2008 7:01 
> AM
>> > 
>> >                                 To: AmiBroker User Group
>> > 
>> >                                 Subject: [amibroker] Can someone 
>> fix this OLE code?
>> > 
>> > 
>> > 
>> > 
>> >                                 Can someone help me fix the code 
>> below so that when triggered in an Indicator, it: 
>> > 
>> > 
>> > 
>> > 
>> >                                 1) Backtest all tickers in 
>> watchlist WLN?
>> > 
>> >                                 2) Use range of BRS bars
>> > 
>> >                                 3) Output ONLY the one line BT 
>> Report?
>> > 
>> > 
>> > 
>> > 
>> >                                 Many thanks!!!!
>> > 
>> >                                 herman
>> > 
>> > 
>> > 
>> > 
>> >                                 if ( ParamTrigger( "Run Com 
>> BT", "BT" ) )
>> > 
>> >                                 {
>> > 
>> >                                     WLN = 0; // the watchlist to 
>> backtest
>> > 
>> >                                     BRS = 100; // Number bars to 
>> test
>> > 
>> >                                     AB = CreateObject
>> ( "Broker.Application" );
>> > 
>> >                                     AA = AB.Analysis;
>> > 
>> >                                     AA.LoadFormula( "C:\\Program 
>> Files\\AmiBroker\\Formulas\\Systems\\Example.afl" );
>> > 
>> >                                     AA.ClearFilters();
>> > 
>> >                                     AA.Filter( 0, "watchlist" ) = 
>> WLN;         // This gives syntax error...
>> > 
>> >                                     AA.ApplyTo = 1;
>> > 
>> >                                     AA.RangeMode = 1;
>> > 
>> >                                     AA.Analysis.RangeN = 
>> BRS;                 // This gives syntax error...
>> > 
>> >                                     AA.Backtest();
>> > 
>> >                                     AA.Report( "" );
>> > 
>> >                                 }
>> > 
>> > 
>> > 
>> > 
>> >                                 No virus found in this incoming 
>> message.
>> > 
>> >                                 Checked by AVG.
>> > 
>> >                                 Version: 8.0.100 / Virus 
> Database: 
>> 269.23.16/1448 - Release Date: 5/16/2008 7:42 PM
>> > 
>> > 
>> >                                
>> > 
>> >                           No virus found in this incoming message.
>> > 
>> >                           Checked by AVG.
>> > 
>> >                           Version: 8.0.100 / Virus Database: 
>> 269.23.16/1448 - Release Date: 5/16/2008 7:42 PM
>> > 
>> > 
>> >                          
>> > 
>> >                     No virus found in this incoming message.
>> > 
>> >                     Checked by AVG.
>> > 
>> >                     Version: 8.0.100 / Virus Database: 
>> 269.23.16/1448 - Release Date: 5/16/2008 7:42 PM
>> >
>>
> 
> 
> 
> ------------------------------------
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 

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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

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

For other support material please check also:
http://www.amibroker.com/support.html
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:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto: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/