绿色园林 发表于 2017-5-25 16:35:05

学习学习交流一下

j1k1 发表于 2017-5-25 16:58:29

CCI, MACD, KDJ 背离菲薄定位优化版

tanwei373709470 发表于 2017-5-25 20:15:07

CCI, MACD, KDJ 背离菲薄定位优化版

bonbo 发表于 2017-5-25 22:35:02

11111111111111111111

15206662636 发表于 2017-5-27 13:07:26

CCI, MACD, KDJ 背离菲薄定位优化版 [修改]

quyangwudi 发表于 2017-5-28 18:03:38

阿萨飒飒的所得税所得税的的是的

猫猫看看 发表于 2017-5-28 18:15:50


#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Brown
#property indicator_color4 Olive
#property indicator_width1 5
#property indicator_width2 5

double TrendUp[], TrendDown[],dn[],up[];
int changeOfTrend;
extern int Nbr_Periods = 10;
extern double Multiplier = 3.0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   IndicatorBuffers(4);
   SetIndexBuffer(0, TrendUp);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 5);
   SetIndexLabel(0, "Trend Up");
   SetIndexBuffer(1, TrendDown);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 5);
   SetIndexLabel(1, "Trend Down");
   SetIndexBuffer(2, dn);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexLabel(2, "Up");
   SetIndexBuffer(3, up);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexLabel(3, "Dn");
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                     |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int limit, i, flag, flagh, trend;
   double medianPrice, atr;
   int counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) counted_bars--;
   limit=Bars-counted_bars;
   //Print(limit);
   
//----
   for (i = Bars; i >= 0; i--) {
      TrendUp = EMPTY_VALUE;
      TrendDown = EMPTY_VALUE;
      atr = iATR(NULL, 0, Nbr_Periods, i);
      //Print("atr: "+atr);
      medianPrice = (High+Low)/2;
      //Print("medianPrice: "+medianPrice);
      up=medianPrice+(Multiplier*atr);
      //Print("up: "+up);
      dn=medianPrice-(Multiplier*atr);
      //Print("dn: "+dn);
      trend=1;
   
      
      if (Close>up) {
         trend=1;
         if (trend == -1) changeOfTrend = 1;
         //Print("trend: "+trend);
         
      }
      else if (Close<dn) {
         trend=-1;
         if (trend == 1) changeOfTrend = 1;
         //Print("trend: "+trend);
      }
      else if (trend==1) {
         trend=1;
         changeOfTrend = 0;      
      }
      else if (trend==-1) {
         trend=-1;
         changeOfTrend = 0;
      }

      if (trend<0 && trend>0) {
         flag=1;
         //Print("flag: "+flag);
      }
      else {
         flag=0;
         //Print("flagh: "+flag);
      }
      
      if (trend>0 && trend<0) {
         flagh=1;
         //Print("flagh: "+flagh);
      }
      else {
         flagh=0;
         //Print("flagh: "+flagh);
      }
      
      if (trend>0 && dn<dn)
         dn=dn;
      
      if (trend<0 && up>up)
         up=up;
      
      if (flag==1)
         up=medianPrice+(Multiplier*atr);
         
      if (flagh==1)
         dn=medianPrice-(Multiplier*atr);
         
      //-- Draw the indicator
      if (trend==1) {
         TrendUp=dn;
         if (changeOfTrend == 1) {
            TrendUp = TrendDown;
            changeOfTrend = 0;
         }
      }
      else if (trend==-1) {
         TrendDown=up;
         if (changeOfTrend == 1) {
            TrendDown = TrendUp;
            changeOfTrend = 0;
         }
      }
   }
   WindowRedraw();
      
//----
   return(0);
}
//+------------------------------------------------------------------+

MACD@Zh 发表于 2017-5-28 18:26:02


这个必须要顶啊

loofass 发表于 2017-5-30 10:20:18


CCI, MACD, KDJ 背离菲薄定位优化版 [修改]

迷茫 发表于 2017-5-30 16:14:20

111111111111111111
页: 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16
查看完整版本: CCI, MACD, KDJ 背离菲薄定位优化版