/*[[ Name := XO-timotei Author := timotei Link := timotej@inbox.ru Notes := XO indicator Separate Window := No First Color := Blue First Draw Type := Symbol First Symbol := 119 Use Second Data := Yes Second Color := Red Second Draw Type := Symbol Second Symbol := 119 ]]*/ input: BoxSize(5); Input: Reverse(2); Input: BarCount(300); Input: UpHC_DnLC(1); // При Восходящем Текущую цену берем как H+C/2, а при нисходящем L+C/2 Input: HL1_HLC2_OHLC3_C4(4); var: Step(0); var: CurrentBar(0); var: startflag(0), cnt(0), cur(0); var: Up(0), Dn(0); var: RndCur(0), RndLast(0); var: LastBox(0),BoxNoCur(0); SetLoopCount(0); Dn=1; if bars=4 then Cur = c[CurrentBar] else if HL1_HLC2_OHLC3_C4=3 then Cur = (o[CurrentBar]+h[CurrentBar]+l[CurrentBar]+c[CurrentBar])/4 else if HL1_HLC2_OHLC3_C4=2 then Cur = (h[CurrentBar]+l[CurrentBar]+c[CurrentBar])/3 else if HL1_HLC2_OHLC3_C4=1 then Cur = (h[CurrentBar]+l[CurrentBar])/2; } else { if Up=1 then Cur = (h[CurrentBar]+c[CurrentBar])/2 else if Dn=1 then Cur = (l[CurrentBar]+c[CurrentBar])/2; }; if startflag<1 then { LastBox=Floor(Cur/step); startflag=1; }; Step = (BoxSize)*point; RndCur = Floor(cur/step)*Step; BoxNoCur= Floor(cur/step); if Dn = 1 then { if LastBox>BoxNoCur then LastBox=BoxNoCur; if BoxNoCur-LastBox >= Reverse then { setIndexValue(CurrentBar, RndCur); setIndexValue2(CurrentBar, 0); Dn=0; Up=1; LastBox=BoxNoCur; } else { setIndexValue2(CurrentBar, LastBox*Step); setIndexValue(CurrentBar, 0); }; } else if Up = 1 then { if LastBox= Reverse then { setIndexValue2(CurrentBar, RndCur); setIndexValue(CurrentBar, 0); Dn=1; Up=0; LastBox=BoxNoCur; } else { setIndexValue(CurrentBar, LastBox*Step); setIndexValue2(CurrentBar, 0); }; }; };