|
不是横线,是箭头,横线好难
这是h1的
- //去当前bar的最低/最高值,看布林当前的值变化范围
- #property indicator_chart_window
- #property indicator_buffers 5
- #property indicator_color1 LightSeaGreen
- #property indicator_color2 LightSeaGreen
- #property indicator_color3 LightSeaGreen
- #property indicator_color4 Yellow
- #property indicator_color5 Yellow
- //---- indicator parameters
- extern int BandsPeriod=20;
- extern int BandsShift=0;
- extern double BandsDeviations=2.0;
- extern int Symbol_Arrow=223;
- int ArrowShift=3;
- //---- buffers
- double MovingBuffer[];
- double UpperBuffer[];
- double LowerBuffer[];
- double UpperArrowBuffer[];
- double LowerArrowBuffer[];
- //int HowManyStart;
- //+------------------------------------------------------------------+
- //| Custom indicator initialization function |
- //+------------------------------------------------------------------+
- int init()
- {
- //---- indicators
- SetIndexStyle(0,DRAW_LINE);
- SetIndexBuffer(0,MovingBuffer);
- SetIndexStyle(1,DRAW_LINE);
- SetIndexBuffer(1,UpperBuffer);
- SetIndexStyle(2,DRAW_LINE);
- SetIndexBuffer(2,LowerBuffer);
-
- SetIndexStyle(3,DRAW_ARROW,0,2);
- SetIndexArrow(3,Symbol_Arrow);
- SetIndexBuffer(3,UpperArrowBuffer);
- SetIndexShift(3,ArrowShift);
- SetIndexEmptyValue(3,0.0);
-
- SetIndexStyle(4,DRAW_ARROW,0,2);
- SetIndexArrow(4,Symbol_Arrow);
- SetIndexBuffer(4,LowerArrowBuffer);
- SetIndexShift(4,ArrowShift);
- SetIndexEmptyValue(4,0.0);
- //----
- SetIndexDrawBegin(0,BandsPeriod+BandsShift);
- SetIndexDrawBegin(1,BandsPeriod+BandsShift);
- SetIndexDrawBegin(2,BandsPeriod+BandsShift);
-
- // HowManyStart=0;
- //----
- return(0);
- }
- int deinit()
- {
- //----
-
- //----
- return(0);
- }
- int start()
- {
- if(Period()==PERIOD_H4 || Period()==PERIOD_D1 || Period()==PERIOD_W1 || Period()==PERIOD_MN1)
- return(0);
-
- int i,k,counted_bars=IndicatorCounted();
- double deviation;
- double sum,oldval,newres;
- //删除上一个时间段的箭头
- UpperArrowBuffer[1]=0;
- LowerArrowBuffer[1]=0;
- //----
- if(Bars<=BandsPeriod) return(0);
- //---- initial zero
- if(counted_bars<1)
复制代码 |
|