Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
/*[[ Name := RoshStops Author := Rosh Link := http://www.metaquotes.net/ Notes := Стопы по зоне Вильямса Separate Window := Yes First Color := Green First Draw Type := Histogram First Symbol := 217 Use Second Data := Yes Second Color := Red Second Draw Type := Histogram Second Symbol := 218 ]]*/ Input : BeginBars(500); Variable : shift(0),cnt(0),StopUp(0),StopDown(0),AO_Sum(0),Y(0),X(0); SetLoopCount(0); // loop from first bar to current bar (with shift=0) If Period<>240 then Exit; For shift=BeginBars Downto 1 Begin AO_Sum=0; // Comment("StopUp=",StopUp); For cnt=shift+4 Downto shift+1 Begin AO_Sum=AO_Sum+iAO(cnt); End; Y=170/58*AO_Sum-170/14.5*(iMAex(5,MODE_SMA,0,PRICE_MEDIAN,shift+1)-iMAex(34,MODE_SMA,0,PRICE_MEDIAN,shift+1)) +17/14.5*(H[shift+5]+L[shift+5])-2.5/14.5*(H[shift+34]+L[shift+34])-O[shift]; // Вычисление граничной точки АС // X2=O[shift]+(170*(iAO(shift+1)-iMAex(5,MODE_SMA,0,PRICE_MEDIAN,shift+1)+iMAex(34,MODE_SMA,0,PRICE_MEDIAN,shift+1)) // +17*(H[shift+5]+L[shift+5])-2.5*(H[shift+34]+L[shift+34]))/14.5; X=(17*(H[shift+5]+L[shift+5])-2.5*(H[shift+34]+L[shift+34]))/14.5-O[shift]; // Вычисление граничной точки АО // If Y>X then // { StopUp=Y; // StopDown=X;} // Else { StopUp=X;StopDown=Y ;}; //Comment("StopUp=",X); // If GetIndexValue(shift+1)<>0 then // { If (X-Y)>(GetIndexValue(shift+1)+GetIndexValue2(shift+1)) then SetIndexValue(shift,X-Y) Else SetIndexValue2(shift,X-Y); // }; // If GetIndexValue2(shift+1)<>0 then // { // If (X-Y)>GetIndexValue(shift+1) then SetIndexValue(shift,X-Y) Else SetIndexValue2(shift,X-Y); // }; // SetIndexValue2(shift, StopDown); End;/*[[ Name := AMA Author := Copyright © 2004, MetaQuotes Software Corp. 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 : PeriodEMA(21),PeriodCMO(5),WidthChanel(0.5),BeginBar(3000); Variable : shift(0),CMO(0),SC(0),UpSum(0),DnSum(0),CurrentValue(0),Signal(0),Noise(0),HelpCnt(0),StdDev(0); Variable : F(0),MovIndex(7000),OrderSign(0),CurrentValue2(0),CurrentUp(0),CurrentDown(0); F=2/(PeriodEMA+1); 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 UpSum=0; DnSum=0; For HelpCnt=(shift+PeriodCMO) DownTo shift Begin CurrentUp=0; CurrentDown=0; If C[HelpCnt]-C[HelpCnt+1]>0 then CurrentUp=C[HelpCnt]-C[HelpCnt+1] Else CurrentDown=C[HelpCnt+1]-C[HelpCnt]; UpSum=UpSum+CurrentUp; DnSum=DnSum+CurrentDown; End; CMO=(UpSum-DnSum)/(UpSum+DnSum); If (Bars-shift)<PeriodEMA then CurrentValue=iMA(PeriodEMA,Mode_EMA,shift) Else CurrentValue=C[shift]*F*Abs(CMO)+GetIndexValue(shift+1)*(1-F*Abs(CMO)); //GetIndexValue(shift+1)+(ER*(fastSC-slowSC)+slowSC)*(ER*(fastSC-slowSC)+slowSC)*(C[shift]-GetIndexValue(shift+1)); SetIndexValue(shift,CurrentValue); CurrentValue2=CurrentValue*(100+WidthChanel)/100; SetIndexValue2(shift,CurrentValue2); // 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," баре. CMO=",CMO); //Comment("StdDev=",StdDev," LowestAMA=",LowestAMA,"HighestAMA =",HighestAMA); MovIndex=shift-1; // CurrentValue2=0; End; End;Да пожалуйста выложите еще раз.
Для Cool2.mql ношел только:
http://www.nwbroker.ru/platform/20
но это не то.
СПАСИБО, буду разбираться на выходных.
Вычисление цены при которой изменится цвет пользовательского индикатора АО для текущего бара.
Текст индикатора:
extern int period0 = 5; extern int period1 = 34; extern int nMaxCount = 1000; #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Gold #property indicator_color2 Blue double AO[]; double ExtBuffer1[]; double ExtBuffer2[]; double LineStop[]; int init() { SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_NONE); IndicatorDigits(Digits+1); SetIndexDrawBegin(0,period1); SetIndexDrawBegin(1,period1); SetIndexBuffer(0,LineStop); SetIndexBuffer(1,AO); SetIndexArrow(0,159); IndicatorShortName("AO MY Stop("+period0+","+period1+")"); SetIndexLabel(1,NULL); SetIndexLabel(2,NULL); return(0); } int start() { int limit,i,j,k; int counted_bars=IndicatorCounted(); double iMA_0,iMA_1; double arrayHIGH[]; double arrayLOW[]; double nHIGH,nLOW,AONew; limit=Bars-counted_bars-MathMax(period0,period1); ArrayCopySeries( arrayHIGH, MODE_HIGH,NULL,0); ArrayCopySeries( arrayLOW , MODE_LOW,NULL,0) ; for(i=0; i<limit; i++){ iMA_0 =0; iMA_1 =0; for(j=0; j<period0; j++) iMA_0+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; for(j=0; j<period1; j++) iMA_1+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; AO[i]=iMA_0/period0-iMA_1/period1; } for(i=0; i<limit; i++){ if(AO[i]<AO[i+1]){ AONew = AO[i]; nHIGH = arrayHIGH[i]; k=0; while (AONew<AO[i+1]&&k<nMaxCount){ k++; nHIGH += Point; iMA_0 =(nHIGH+arrayLOW[i])/2; iMA_1 =iMA_0; for(j=1; j<period0; j++) iMA_0+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; for(j=1; j<period1; j++) iMA_1+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; AONew=iMA_0/period0-iMA_1/period1; } LineStop[i]=nHIGH; } else { AONew = AO[i]; nLOW = arrayLOW[i]; k=0; while (AONew>AO[i+1]&&k<nMaxCount){ k++; nLOW -= Point; iMA_0 =(arrayHIGH[i]+nLOW)/2; iMA_1 =iMA_0; for(j=1; j<period0; j++) iMA_0+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; for(j=1; j<period1; j++) iMA_1+=(arrayHIGH[j+i]+arrayLOW[j+i])/2; AONew=iMA_0/period0-iMA_1/period1; } LineStop[i]=nLOW; } } return(0); }