Хотел приколоться,да не стал, может еще кому напоследок пригодится.
/*[[ Name := AMA Author := Rosh Link := http://www.metaquotes.net/ Notes := Àäàïòèâíàÿ ñêîëüçÿùàÿ Êàóôìàíà Separate Window := No First Color := Yellow First Draw Type := Line First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Inputs : PeriodAMA(5),fastSC(0.66667),slowSC(0.06452),KFilter(0.1),PeriodStdDev(5),BeginBar(3000); Variable : shift(0),ER(0),SSC(0),CurrentValue(0),Signal(0),Noise(0),HelpCnt(0),StdDev(0); Variable : Filter(0),LowestAMA(1000),HighestAMA(0),MovIndex(7000),OrderSign(0),CurrentValue2(0); SetLoopCount(0); // loop from first bar to current bar (with shift=0) //For shift=(Bars-2*PeriodAMA) Downto 0 Begin If MovIndex>0 then Begin For shift=MovIndex Downto 0 Begin Signal=Abs(C[shift]-C[shift+PeriodAMA]); Noise=0; For HelpCnt=(shift+PeriodAMA) DownTo shift Begin Noise=Noise+Abs(C[HelpCnt]-C[HelpCnt+1]); End; ER=Signal/Noise; If (Bars-shift)<PeriodAMA then CurrentValue=iMA(PeriodAMA,Mode_EMA,shift) Else CurrentValue=GetIndexValue(shift+1)+(ER*(fastSC-slowSC)+slowSC)*(ER*(fastSC-slowSC)+slowSC)*(C[shift]-GetIndexValue(shift+1)); SetIndexValue(shift,CurrentValue); HighestAMA=CurrentValue; StdDev=0; For HelpCnt=(shift+PeriodStdDev+1) DownTo (shift+1) Begin StdDev=StdDev+(GetIndexValue(HelpCnt+1)-GetIndexValue(HelpCnt))*(GetIndexValue(HelpCnt+1)-GetIndexValue(HelpCnt)); If GetIndexValue(HelpCnt)>HighestAMA then HighestAMA=GetIndexValue(HelpCnt); End; StdDev=Sqrt(StdDev/PeriodAMA); Filter=KFilter*StdDev; LowestAMA=CurrentValue; For HelpCnt=(shift+PeriodStdDev+1) DownTo (shift+1) Begin If GetIndexValue(HelpCnt)<LowestAMA then LowestAMA=GetIndexValue(HelpCnt); End; Comment("Çàêîí÷èëè íà ",MovIndex," áàðå. StdDev=",StdDev," LowestAMA=",LowestAMA," HighestAMA =",HighestAMA); //Comment("StdDev=",StdDev," LowestAMA=",LowestAMA,"HighestAMA =",HighestAMA); MovIndex=shift-1; CurrentValue2=0; // If OrderSign<=0 then If (CurrentValue-LowestAMA)>Filter then //>Filter then { CurrentValue2=LowestAMA+Filter; //CurrentValue2=C[shift]; OrderSign=1; }; // If OrderSign>=0 then If (HighestAMA-CurrentValue)>Filter then //>Filter then { CurrentValue2=HighestAMA-Filter; //CurrentValue2=C[shift]; OrderSign=-1; }; SetIndexValue2(shift,CurrentValue2); If GetIndexValue2(shift)>=GetIndexValue(shift)and GetIndexValue2(shift+1)<GetIndexValue(shift+1)then SetArrow(Time[shift],C[shift],226,Blue);//ïðîäàæà If GetIndexValue2(shift)<=GetIndexValue(shift)and GetIndexValue2(shift+1)>GetIndexValue(shift+1)then SetArrow(T[shift],C[shift],225,Red);//ïîêóïêà End; End;
Похоже , возможность редактирования своих постов поламалась, кнопки фиксации после редактирования я не нашел, поэтому заново выложу с русскими комментами.
/*[[ Name := AMA Author := Rosh Link := http://www.metaquotes.net/ Notes := Адаптивная скользящая Кауфмана Separate Window := No First Color := Yellow First Draw Type := Line First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Line Second Symbol := 218 ]]*/ Inputs : PeriodAMA(5),fastSC(0.66667),slowSC(0.06452),KFilter(0.1),PeriodStdDev(5),BeginBar(3000); Variable : shift(0),ER(0),SSC(0),CurrentValue(0),Signal(0),Noise(0),HelpCnt(0),StdDev(0); Variable : Filter(0),LowestAMA(1000),HighestAMA(0),MovIndex(7000),OrderSign(0),CurrentValue2(0); SetLoopCount(0); // loop from first bar to current bar (with shift=0) //For shift=(Bars-2*PeriodAMA) Downto 0 Begin If MovIndex>0 then Begin For shift=MovIndex Downto 0 Begin Signal=Abs(C[shift]-C[shift+PeriodAMA]); Noise=0; For HelpCnt=(shift+PeriodAMA) DownTo shift Begin Noise=Noise+Abs(C[HelpCnt]-C[HelpCnt+1]); End; ER=Signal/Noise; If (Bars-shift)<PeriodAMA then CurrentValue=iMA(PeriodAMA,Mode_EMA,shift) Else CurrentValue=GetIndexValue(shift+1)+(ER*(fastSC-slowSC)+slowSC)*(ER*(fastSC-slowSC)+slowSC)*(C[shift]-GetIndexValue(shift+1)); SetIndexValue(shift,CurrentValue); HighestAMA=CurrentValue; StdDev=0; For HelpCnt=(shift+PeriodStdDev+1) DownTo (shift+1) Begin StdDev=StdDev+(GetIndexValue(HelpCnt+1)-GetIndexValue(HelpCnt))*(GetIndexValue(HelpCnt+1)-GetIndexValue(HelpCnt)); If GetIndexValue(HelpCnt)>HighestAMA then HighestAMA=GetIndexValue(HelpCnt); End; StdDev=Sqrt(StdDev/PeriodAMA); Filter=KFilter*StdDev; LowestAMA=CurrentValue; For HelpCnt=(shift+PeriodStdDev+1) DownTo (shift+1) Begin If GetIndexValue(HelpCnt)<LowestAMA then LowestAMA=GetIndexValue(HelpCnt); End; Comment("Закончили на ",MovIndex," баре. StdDev=",StdDev," LowestAMA=",LowestAMA," HighestAMA =",HighestAMA); //Comment("StdDev=",StdDev," LowestAMA=",LowestAMA,"HighestAMA =",HighestAMA); MovIndex=shift-1; CurrentValue2=0; // If OrderSign<=0 then If (CurrentValue-LowestAMA)>Filter then //>Filter then { CurrentValue2=LowestAMA+Filter; //CurrentValue2=C[shift]; OrderSign=1; }; // If OrderSign>=0 then If (HighestAMA-CurrentValue)>Filter then //>Filter then { CurrentValue2=HighestAMA-Filter; //CurrentValue2=C[shift]; OrderSign=-1; }; SetIndexValue2(shift,CurrentValue2); If GetIndexValue2(shift)>=GetIndexValue(shift)and GetIndexValue2(shift+1)<GetIndexValue(shift+1)then SetArrow(Time[shift],C[shift],226,Blue);//продажа If GetIndexValue2(shift)<=GetIndexValue(shift)and GetIndexValue2(shift+1)>GetIndexValue(shift+1)then SetArrow(T[shift],C[shift],225,Red);//покупка End; End;
Интересный индикатор, а почему приколоться? Он что, очень смешной ? :) Моей проблеме это как-нить поможет?
Он как раз и решает твою проблему. Приколоться - значит начать спрашивать - зачем тебе МТ3 :)
Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
Если секунды за 2 неуспел посчитаться, то не выведется уже никогда, а если успел - то выводится. Мне не важно время расчета перед выводом, пусть хоть 10 минут считается, его нужно редко считать, однако он совсем не выводится! Как быть?