if (HH — LC) >= (HC — LL) then
BuyRange := HH — LC
else
BuyRange := HC — LL;
BuyTrig := K1 * BuyRange;
SellTrig := K2 * SellRange;
if LastPositionActive then
begin
p := LastPosition;
bLongSAR := PositionLong( p );
if PositionLong( p ) then
begin
SellAtStop( Bar, PriceOpen(bar) — FloatToStr(SellTrig), p, '');
end;
if PositionShort( p ) then
begin
CoverAtStop( Bar, PriceOpen(bar) + FloatToStr(BuyTrig), p, '');
end;
end;
if not bLongSAR then
begin
BuyAtStop(bar, PriceOpen(bar) + BuyTrig, '');
end;
if bLongSAR then
begin
ShortAtStop(bar, PriceOpen(bar) — SellTrig, '');
end;
end;
📱 📈 Ростелеком: Возможность на горизонте? 🔍 Технический разбор:1️⃣ Поддержка: Уровень 50.5 удержал цену от дальнейшего падения, и актив демонстрирует первые признаки разворота.
2️⃣ Сопротивление: Бл...
Китайский юань по итогам ноября занял четвертое место по объему использования в глобальных платежах, обогнав японскую йену, свидетельствуют данные SWIFT.
Доля китайской национальной валюты увели...
var Bar, p, Mday, Nday, K1, K2: integer;
var HH, HC, LL, LC, SellRange, BuyRange, BuyTrig, SellTrig: float;
var bLongSAR: boolean;
Mday := #OptVar1;
Nday := #OptVar1;
K1 := 5/10;
K2 := 5/10;
for Bar := 20 to BarCount — 1 do
begin
HH := Highest(bar-1, #High, Mday);
HC := Highest(bar-1, #Close, Mday);
LL := Lowest(bar-1, #Low, Mday);
LC := Lowest(bar-1, #Close, Mday);
if (HH — LC) >= (HC — LL) then
SellRange := HH — LC
else
SellRange := HC — LL;
HH := Highest(bar-1, #High, Nday);
HC := Highest(bar-1, #Close, Nday);
LL := Lowest(bar-1, #Low, Nday);
LC := Lowest(bar-1, #Close, Nday);
if (HH — LC) >= (HC — LL) then
BuyRange := HH — LC
else
BuyRange := HC — LL;
BuyTrig := K1 * BuyRange;
SellTrig := K2 * SellRange;
if LastPositionActive then
begin
p := LastPosition;
bLongSAR := PositionLong( p );
if PositionLong( p ) then
begin
SellAtStop( Bar, PriceOpen(bar) — FloatToStr(SellTrig), p, '');
end;
if PositionShort( p ) then
begin
CoverAtStop( Bar, PriceOpen(bar) + FloatToStr(BuyTrig), p, '');
end;
end;
if not bLongSAR then
begin
BuyAtStop(bar, PriceOpen(bar) + BuyTrig, '');
end;
if bLongSAR then
begin
ShortAtStop(bar, PriceOpen(bar) — SellTrig, '');
end;
end;
BDay=Optimize( «BDay», 5, 1, 16, 1 );
SDay=Optimize( «SDay», 5, 1, 16, 1 );
Kl=0.5;
BuyRange=SellRange=0;
HHb = HHV(High,BDay);
HCb = HHV(Close,BDay);
LLb = LLV(Low,BDay);
LCb = LLV(Close,BDay);
HHs = HHV(High,SDay);
HCs = HHV(Close,SDay);
LLs = LLV(Low,SDay);
LCs = LLV(Close,SDay);
for( i =1+Max(BDay,SDay); i < BarCount; i++ )
{
if ((HHb[i-1] — LCb[i-1]) >= (HCb[i-1] — LLb[i-1])) BuyRange[i] = HHb[i-1] — LCb[i-1];
else
BuyRange[i] = HCb[i-1] — LLb[i-1];
if ((HHs[i-1] — LCs[i-1]) >= (HCs[i-1] — LLs[i-1])) SellRange[i] = HHs[i-1] — LCs[i-1];
else
SellRange[i] = HCs[i-1] — LLs[i-1];
};
BuyTrig = Kl*BuyRange;
SellTrig = Kl*SellRange;
ColorCh0=colorRed;
Band_Top=O+BuyTrig;
Band_Bot=O-SellTrig;
Plot(Band_Top, «Band_Top», ColorCh0, 1);
Plot(Band_Bot, «Band_Bot», ColorCh0, 1);
Buy=Cover=Cross(H,Band_Top);BuyPrice=CoverPrice=Band_Top;
Short=Sell=Cross(Band_Bot,L); ShortPrice=SellPrice=Band_Bot;
PlotShapes( (Buy == 1) * shapeHollowUpArrow, colorBrightGreen, 0,BuyPrice);
PlotShapes( (Buy == sigScaleIn ) * shapeSmallUpTriangle, colorBrightGreen, 0,BuyPrice,1);
PlotShapes( (Buy == sigScaleOut) * shapeSmallDownTriangle, colorBrightGreen, 0,BuyPrice,1);
PlotShapes( (Short == 1) * shapeHollowDownArrow, colorRed, 0, ShortPrice);
PlotShapes( (Short == sigScaleIn ) * shapeSmallDownTriangle, colorRed, 0,ShortPrice,1);
PlotShapes( (Short == sigScaleOut ) * shapeSmallUpTriangle, colorRed, 0, ShortPrice,1);
PlotShapes( (Sell== 1) * shapeHollowDownArrow, colorBlue, 0,SellPrice);
PlotShapes( (Sell == 2) * shapeSmallCircle, colorBlue, 0,SellPrice,0);// stop
PlotShapes( (Sell == 5) * shapeSmallCircle, colorLightBlue, 0,SellPrice,0);// stop
PlotShapes( (Sell == 3) * shapeSquare, colorBlue, 0, SellPrice,0);// profit
PlotShapes( (Cover == 1) * shapeHollowUpArrow, colorOrange, 0, CoverPrice);
PlotShapes( (Cover == 2) * shapeSmallCircle, colorOrange, 0, CoverPrice,0);// stop
PlotShapes( (Cover == 3) * shapeSquare, colorOrange, 0,CoverPrice);// limit
PlotShapes( (Cover == 5) * shapeSmallCircle, colorLightOrange, 0,CoverPrice,0);// limit