Вы упускаете торговые возможности:
- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Регистрация
Вход
Вы принимаете политику сайта и условия использования
Если у вас нет учетной записи, зарегистрируйтесь
hma=(h[i+2]+h[i+1]+h[i])/3 ко всем хаям добавить спрэд. Тогда получится
hma=(h[i+2]+h[i+1]+h[i])/3+СПРЭД. Спрэд можно взять из MarkenInfo().
Фишка видишь в чём? В МТ3 лоу строятся по бидам, а хаи по аскам, а в МТ4 всё строится только по бидам. При трансляции индикаторов это надо учитывать.
hma=(h[i+2]+h[i+1]+h[i])/3 ко всем хаям добавить спрэд. Тогда получится
hma=(h[i+2]+h[i+1]+h[i])/3+СПРЭД. Спрэд можно взять из MarkenInfo().
Фишка видишь в чём? В МТ3 лоу строятся по бидам, а хаи по аскам, а в МТ4 всё строится только по бидам. При трансляции индикаторов это надо учитывать.
//| HighLow.mq4 | #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Lime extern int Per = 3; double buf0[], buf1[]; int PrevPr = 0; int init() { IndicatorShortName ( "HighLow" ); SetIndexBuffer ( 0, buf0 ); SetIndexStyle ( 0, DRAW_ARROW ); SetIndexArrow ( 0, 119 ); SetIndexBuffer ( 1, buf1 ); SetIndexStyle ( 1, DRAW_ARROW ); SetIndexArrow ( 1, 119 ); return(0); } int start() { int counted_bars=IndicatorCounted(); if ( counted_bars < 0 ) { Print( "Indicator Error (Counted bars < 0)!" ); return(-1); } if ( Bars < 10 ) { Print( "Indicator Error (Bars < 10)!" ); return(-1); } int limit = Bars - 6; if ( counted_bars > 6 ) { limit = Bars - counted_bars; } double hma, lma; int Pr; for ( int i = limit; i >= 0; i -- ) { hma = iMA( NULL, 0, Per, 1, MODE_SMA, PRICE_HIGH, i ); lma = iMA( NULL, 0, Per, 1, MODE_SMA, PRICE_LOW , i ); if ( Close[i] < lma && PrevPr == 1 ) { Pr = 0; } if ( Close[i] > hma && PrevPr == 0 ) { Pr = 1; } PrevPr = Pr; if ( Pr == 0 ) { buf0[i] = hma; } if ( Pr == 1 ) { buf1[i] = lma; } } return(0); }//| HighLowART.mq4 | #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue double buf0[], buf1[]; bool up = true; int init() { IndicatorShortName ( "HighLowART" ); SetIndexBuffer ( 0, buf0 ); SetIndexStyle ( 0, DRAW_ARROW ); SetIndexArrow ( 0, 159 ); SetIndexLabel ( 0, "Low" ); SetIndexBuffer ( 1, buf1 ); SetIndexStyle ( 1, DRAW_ARROW ); SetIndexArrow ( 1, 159 ); SetIndexLabel ( 1, "High" ); return(0); } int start() { int counted_bars=IndicatorCounted(); if ( counted_bars < 0 ) { Print( "Indicator Error (Counted bars < 0)!" ); return(-1); } if ( Bars < 10 ) { Print( "Indicator Error (Bars < 10)!" ); return(-1); } int limit = Bars - 6; if ( counted_bars > 6 ) { limit = Bars - counted_bars; } double hma, lma; for ( int i = limit; i >= 0; i -- ) { hma = ( High[i+2] + High[i+1] + High[i] ) / 3; lma = ( Low[i+2] + Low[i+1] + Low[i] ) / 3; if ( Close[i] < lma && !up ) { buf1[i] = lma; up = true; } if ( Close[i] > hma && up ) { buf0[i] = hma; up = false; } if ( up ) { buf0[i] = hma; } else { buf1[i] = lma; } } return(0); }хотя единственное их отличие (насколько я понял) - в последних 2-х строках цикла =)
а вообще индюки идентичны - SMA с шифтом 1 и периодом 3 сравниваются с ценой закрытия.
//+------------------------------------------------------------------+ //| Хайло.mq4 | //| Copyright © 2005, MetaQuotes Software Corp. | //| http://www.metaquotes.ru/forum/6298/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.ru/forum/6365/" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- input parameters extern int per=3; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double TrendBuffer[]; double spread; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(3); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,159); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexBuffer(2,TrendBuffer); SetIndexEmptyValue(2,0.0); spread=MarketInfo(Symbol(),MODE_SPREAD)*Point; //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit; double h3,l3,curClose; if (counted_bars>0) limit=Bars-counted_bars; if (counted_bars==0) limit=Bars-per; limit--; //---- for (int cnt=limit;cnt>=0;cnt--) { curClose=Close[cnt]+spread/2.0; h3=iMA(NULL,0,per,0,MODE_SMA,PRICE_HIGH,cnt+1)+spread; l3=iMA(NULL,0,per,0,MODE_SMA,PRICE_LOW,cnt+1); TrendBuffer[cnt]=TrendBuffer[cnt+1]; if (curClose>h3 && TrendBuffer[cnt+1]<=0.0) { ExtMapBuffer1[cnt]=0.0; ExtMapBuffer2[cnt]=l3; TrendBuffer[cnt]=1.0; } if (curClose<l3 && TrendBuffer[cnt+1]>=0.0) { ExtMapBuffer1[cnt]=h3; ExtMapBuffer2[cnt]=0.0; TrendBuffer[cnt]=-1.0; } if (TrendBuffer[cnt]==1.0) ExtMapBuffer2[cnt]=l3; if (TrendBuffer[cnt]==-1.0) ExtMapBuffer1[cnt]=h3; } //---- return(0); } //+------------------------------------------------------------------+hma=(h[i+2]+h[i+1]+h[i])/3 ко всем хаям добавить спрэд. Тогда получится
hma=(h[i+2]+h[i+1]+h[i])/3+СПРЭД. Спрэд можно взять из MarkenInfo().
Фишка видишь в чём? В МТ3 лоу строятся по бидам, а хаи по аскам, а в МТ4 всё строится только по бидам. При трансляции индикаторов это надо учитывать.
пробовал. Дело не в этом
как раз в этом.
к High надо добавить спред, а к Close спред/2
Profi_R, а можно сделать и то и другое?