1) Simply put in values: Plot(Close,
"Close", colorblack,
styleLine | styleOwnScale, -10,10) ; any values you want.
2) I don't think so. You can simulate
with selected values and add an "axis" like this: Plot(0,
"", colorblack,
styleLine | styleOwnScale, -10,10
) ; Plots a line at 0, could be -10 instead. Use same
scale values as 1st plot.
3) I don't think you can use array, but you can compute a
min/max as a numeric and use it. It can "float" based on displayed area.
See code for Fred's Equity Line. It's a bit complicated (for me) so learning by example is the best way. See PLOT
statements in entire code for Freds' Equity Line included at end of this email
and highlighted in red.
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Mr Valley
Sent: Thursday, November 03,
2005 23:05
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker]
StyleOwnScale - Defining Parameters
Utilizing the StyleOwnScale within a
Plot...
1.) How does one define the Minimum
and Maximum for increment unit of adjustment for the OwnScale, as with
Excel?
2.) Also is one able to define that
Axis X and Axis Y intercept at a definable parameter, as with Excel?
3.) How does one define the
minvalue and maxvalue as an array value rather than an input fixed number?
//Fred's Equity
Line
#pragma nocache
MaxGraph
= 10;
GraphZOrder =
1;
GraphXSpace = 20;
GraphYSpace = 15;
CurEq
= C;
BIR
= IIf(Status("BarInRange") > 0, 1, 0);
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(BIR, 100 * (MaxEq - CurEq) / MaxEq, 0);
RCurDD
= round(CurDD * 100) / 100;
MaxDD
= Highest(CurDD);
RMaxDD
= round(MaxDD * 100) / 100;
LMaxDD
= LastValue(MaxDD) * (1 + GraphYSpace / 100);
CumDD
= Cum(CurDD);
FirstBar = LastValue(ValueWhen(Status("FirstBarInRange")
> 0, Cum(1)));
//ValueWhen(ExRem(CurEq != Ref(CurEq, -(Cum(1) - 1)),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, log10(Ref(CurEq, -(BarNo - 1)) * (C / Ref(C, -(BarNo -
1)))));
CAR
= ValueWhen(BIR > 0, 100 * ((CurEq / Ref(CurEq, -(BarNo - 1))) ^ (1 / (BarNo
/ BPD / 252.4)) -1));
Ann
= ValueWhen(BIR > 0, 100 * ((CurEq / Ref(CurEq, -(252.4 * BPD)) - 1)));
MAR
= ValueWhen(BIR > 0, CAR / MaxDD);
UI
= ValueWhen(BIR > 0, sqrt(CumDD / BarNo));
UPI
= (CAR - 5.4) / UI;
TPI
= UPI / MaxDD;
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));
Title = EncodeColor(colorGrey50)
+ "Equity = " + EncodeColor(colorWhite)
+ WriteVal(CurEq, 3.1) + " " +
EncodeColor(colorGrey50) + "CurFlat = " + EncodeColor(colorYellow)
+ WriteVal(FlatEq, 3.0) + " " +
EncodeColor(colorGrey50) + "CAR% = " + EncodeColor(colorBrightGreen)
+ WriteVal(CAR, 3.1) + "% " +
EncodeColor(colorGrey50) + "CurDD% = " + EncodeColor(colorRed)
+ WriteVal(-CurDD, 3.1) + "% " +
EncodeColor(colorGrey50) + "MAR = " + EncodeColor(colorBrightGreen)
+ WriteVal(MAR, 3.1) + " " +
EncodeColor(colorGrey50) + "KRatio = " + EncodeColor(colorPaleGreen)
+ WriteVal(KRatio, 3.1) + " " +
EncodeColor(colorGrey50) + "UPI = " + EncodeColor(colorPaleGreen)
+ WriteVal(UPI, 3.1) + " " +
EncodeColor(colorGrey50) + "UI = " + EncodeColor(11)
+ WriteVal(UI, 3.2) +
"\n" +
EncodeColor(colorGrey50) + "LinReg = " + EncodeColor(colorLightBlue)
+ WriteVal(10 ^ y, 3.1) + " " +
EncodeColor(colorGrey50) + "MaxFlat = " + EncodeColor(colorDarkYellow)
+ WriteVal(MaxFlat, 3.0) + " " +
EncodeColor(colorGrey50) + "Ann% = " + EncodeColor(colorBrightGreen)
+ WriteVal(Ann, 3.1) + "% " +
EncodeColor(colorGrey50) + "MaxDD% = " + EncodeColor(colorRed)
+ WriteVal(-MaxDD, 3.1) + "% " +
"\n" +
EncodeColor(colorGrey50) + "B & H = " + EncodeColor(colorGrey50)
+ WriteVal(10 ^ BAHEq, 3.1);
Plot(IIf(BarNo >
0, -RCurDD, -1e10), "CDD%", colorRed,
styleOwnScale | styleHistogram, -LMaxDD, LMaxDD);
Plot(IIf(BarNo >
0, -RMaxDD, -1e10), "MDD%", colorDarkRed, styleOwnScale,
-LMaxDD, LMaxDD);
Plot(IIf(BarNo
> 0, FlatEq, -1e10), "CF", colorYellow,
styleOwnScale | styleHistogram, -LMaxFlat, LMaxFlat);
Plot(IIf(BarNo
> 0, MaxFlat,-1e10), "MF", colorDarkYellow,
styleOwnScale,
-LMaxFlat, LMaxFlat);
MinEq1 = Lowest(LLV(Y,
NoBars));
MinEq2 = Lowest(LLV(BAHEq,
NoBars));
MinEq3 = Lowest(LLV(logEq,
NoBars));
MinEq4 = Min(MinEq1,
MinEq2);
MinEq5 = Min(MinEq4,
MinEq3);
MinEq6 = LastValue(MinEq5);
MaxEq1 = Highest(HHV(Y,
NoBars));
MaxEq2 = Highest(HHV(BAHEq,
NoBars));
MaxEq3 = Highest(HHV(logEq,
NoBars));
MaxEq4 = Max(MaxEq1,
MaxEq2);
MaxEq5 = Max(MaxEq4,
MaxEq3);
MaxEq6 = LastValue(MaxEq5);
MinEq7 = MinEq6 -
((MaxEq6 - MinEq6) * GraphYSpace / 100);
MaxEq7 = MaxEq6 +
((MaxEq6 - MinEq6) * GraphYSpace / 100);
Plot(IIf(BarNo
> 0, y, -1e10), "L/R Eq", colorBlue,
styleThick | styleOwnScale | styleNoLabel, MinEq7,
MaxEq7);
Plot(IIf(BarNo
> 0, BAHEq, -1e10), "BAH Eq",
colorGrey50, styleThick | styleOwnScale | styleNoLabel, MinEq7, MaxEq7);
Plot(IIf(BarNo
> 0, LogEq, -1e10), "Sys Eq", colorWhite,
styleThick | styleOwnScale | styleNoLabel, MinEq7,
MaxEq7);
//End Fred's
Equity Line