000
Site Admin
Зарегистрирован: 10.12.2007
Сообщения: 9106
|
Например так
Код: |
dn = DateTime();
sd = SelectedValue( dn );
start = dn == sd;
mp = (H+L)/2;
PV = mp * V;
CV = Cum( V );
VSS = CV - ValueWhen( start, CV );
denom = IIf( VSS == 0, 1, VSS );
num = Cum( PV ) - ValueWhen( start, Cum( PV ) );
M = IIf( BarsSince( start ), num/denom, mp );
Q1 = Param("Percentage Upper", 1.36, 0, 10, 0.01 );
Q2 = Param("Percentage Lower", 1.5, 0, 10, 0.01 );
PlotLine = ParamToggle("Plot Line","Off|On",0);
TakeProfit = M * ( 1 + Q1 * 0.01 );
StopLoss = M * ( 1 - Q2 * 0.01 );
TP = LineArray(SelectedValue(BarIndex() - 5), SelectedValue(TakeProfit),SelectedValue(BarIndex()), SelectedValue(TakeProfit));
SL = LineArray(SelectedValue(BarIndex() - 5), SelectedValue(StopLoss),SelectedValue(BarIndex()), SelectedValue(StopLoss));
if(PlotLine==1)
{
Plot( C, Date() + " Close", colorBlack, styleCandle );
Plot( M, "M" + _PARAM_VALUES(), colorBlue );
Plot( M * ( 1 + Q1 * 0.01 ), "Upper", colorGreen );
Plot( M * ( 1 - Q2 * 0.01 ), "Lower", colorRed );
Plot( TP, "TP", colorGreen );
Plot( SL, "SL", colorRed );
}
|
|
_________________ ceterum censeo carthaginem esse delendam
Удачи. Олег. |
|