|
- #property indicator_chart_window
- #property indicator_buffers 3
- #property indicator_color1 Blue
- #property indicator_color2 Red
- #property indicator_color3 Green
- extern int 变色均线=60;
- double duo[];
- double kong[];
- double yuan[];
- int init()
- {
- SetIndexBuffer(0,duo);
- SetIndexBuffer(1,kong);
- SetIndexBuffer(2,yuan);
- SetIndexStyle(0,0,DRAW_LINE,2,Blue);
- SetIndexStyle(1,0,DRAW_LINE,2,Red);
- SetIndexStyle(2,0,DRAW_LINE,2,Green);
- SetIndexDrawBegin(0,变色均线);
- SetIndexDrawBegin(1,变色均线);
- SetIndexDrawBegin(2,变色均线);
- IndicatorDigits(Digits-2);
- return(0);
- }
- int start()
- {
- double temp0,temp1,t5,t10,t20;
- int limit;
- int counted_bars=IndicatorCounted();
- if(counted_bars<0) return(-1);
- if(counted_bars>0) counted_bars--;
- limit=Bars-counted_bars;
- for(int i=limit; i>=0; i--)
- {
- duo[i]=EMPTY_VALUE;
- kong[i]=EMPTY_VALUE;
- yuan[i]=EMPTY_VALUE;
- t5=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,i);
- t10=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i);
- t20=iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,i);
- temp0=iMA(NULL,0,变色均线,0,MODE_SMA,PRICE_CLOSE,i);
- temp1=iMA(NULL,0,变色均线,0,MODE_SMA,PRICE_CLOSE,i+1);
- if(t5>t10 && t10>t20 && Close[i]>t5)
- {
- duo[i]=temp0;
- duo[i+1]=temp1;
- }
- else if(t5<t10 && t10<t20 && Close[i]<t5 )
- {
- kong[i]=temp0;
- kong[i+1]=temp1;
- }
- else if(t5<t10 || t10<t20 || t5>t10|| t10>t20 )
- {
- yuan[i]=temp0;
- yuan[i+1]=temp1;
-
- }
- }
- return(0);
- }
复制代码 |
|