顯示具有 自製指標 標籤的文章。 顯示所有文章
顯示具有 自製指標 標籤的文章。 顯示所有文章

2010年9月9日 星期四

自製指標 :EMA Slope Long


自製指標 :EMA Slope Long

用當天的 EMA 來減去前一天的 EMA

用來看某一條 EMA 的斜率

有趣的是 這個算法和 Pips_To_EMA 的圖表看起來差不多是完全一樣哦

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//+------------------------------------------------------------------+
//|                                                        Bulls.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters

extern int BullsPeriod=250;

//---- buffers

double BullsBuffer[];

double TempBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   string short_name;

   //---- 1 additional buffer used for counting.

   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   //---- indicator line

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,BullsBuffer);
   SetIndexBuffer(1,TempBuffer);

   //---- name for DataWindow and indicator subwindow label

   short_name="EMA_Slope_Long("+BullsPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

   return(0);
}

//+------------------------------------------------------------------+
//| Bulls Power                                                      |
//+------------------------------------------------------------------+

int start()
{
   int i,counted_bars=IndicatorCounted();

   if(Bars<=BullsPeriod) return(0);
  
   int limit=Bars-counted_bars;
  
   if(counted_bars>0) limit++;
  
   for(i=0; i<limit; i++)
      TempBuffer[i]=iMA(NULL,0,BullsPeriod,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod,0,MODE_EMA,PRICE_CLOSE,i+1);
      i=Bars-counted_bars-1;
      while(i>=0)
     {

         BullsBuffer[i]=TempBuffer[i];

         i--;
   }
   return(0);
}

全部的指標都放在一起


全部的指標都放在一起

就是這個樣子了

自製指標 : Pips To EMA


自製指標 : Pips To EMA

用來計算 Close 和某一條 EMA 之間的距離

這裡是設定 250 天的 EMA

也許這可以大致上看出趨勢什麼時候要 反彈 不過不是一定的哦

只是多一個 參考 而已啦

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//+------------------------------------------------------------------+
//|                                                        Bulls.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters

extern int BullsPeriod=250; // 13

//---- buffers

double BullsBuffer[];
double TempBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   string short_name;

   //---- 1 additional buffer used for counting.

   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   //---- indicator line

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,BullsBuffer);
   SetIndexBuffer(1,TempBuffer);

   //---- name for DataWindow and indicator subwindow label

   short_name="Pips_To_EMA("+BullsPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

   return(0);
}

//+------------------------------------------------------------------+
//| Bulls Power                                                      |
//+------------------------------------------------------------------+

int start()
{
   int i,counted_bars=IndicatorCounted();

   if(Bars<=BullsPeriod) return(0);
  
   int limit=Bars-counted_bars;
  
   if(counted_bars>0) limit++;
  
   for(i=0; i<limit; i++)
      TempBuffer[i]=iMA(NULL,0,BullsPeriod,0,MODE_EMA,PRICE_CLOSE,i);
      i=Bars-counted_bars-1;
      while(i>=0)
     {
         BullsBuffer[i]=Close[i]-TempBuffer[i];
         i--;
   }
   return(0);
}

自製指標 : Days Maximum


自製指標 : Days Maximum

這個非常簡單

就是用 High 減 Low 來找出每一條蠟燭所震盪的 最大 範圍

用 D1 的圖來看 如果最近最大的指標數值是 0.0379 的話 那就是說那天的震盪範圍是 379 點

如果你玩 30 倍的槓桿 而且又看錯方向也不止損 爆倉 的機率就非常的高哦

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//+------------------------------------------------------------------+
//|                                                        Bulls.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters

extern int BullsPeriod=0;

//---- buffers

double BullsBuffer[];
double TempBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   string short_name;

   //---- 1 additional buffer used for counting.

   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   //---- indicator line

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,BullsBuffer);
   SetIndexBuffer(1,TempBuffer);

   //---- name for DataWindow and indicator subwindow label

   short_name="Days_Maximum("+BullsPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

   return(0);
}

//+------------------------------------------------------------------+
//| Bulls Power                                                      |
//+------------------------------------------------------------------+

int start()
{
   int i,counted_bars=IndicatorCounted();

   if(Bars<=BullsPeriod) return(0);
  
   int limit=Bars-counted_bars;
  
   if(counted_bars>0) limit++;
  
   for(i=0; i<limit; i++)
      TempBuffer[i]=Low[i];
      i=Bars-counted_bars-1;
      while(i>=0)
     {
         BullsBuffer[i]=High[i]-TempBuffer[i];
         i--;
   }
   return(0);
}

自製指標 :EMA Slope


自製指標 :EMA Slope

這個就比較複雜

是計算 4 條 EMA 的斜率 這裡用的是 5 天 10 天 15 天 和 20 天

如果 4 條 EMA 的斜率全部都是 向上 也就是 正數 的話 那指標的數值就設定為 1

如果 4 條 EMA 的斜率全部都是 向下 也就是 負數 的話 那指標的數值就設定為 -1

如果 4 條 EMA 的斜率 有一些 向上 有一些 向下 也就是有 正數 也有 負數 的話 那指標的數值就設定為  0.5 也可以看作是短期盤整的意思

要玩這個最好是和 EMA 250 天一起配合

如果 EMA 250 天是 向下 也就是說在 下跌 的時候 那如果指標的數值是 -1 的話 就可以下 賣單 咯 果指標的數值是 0.5 和 1 的話 就不要動作 觀望就可以了

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//+------------------------------------------------------------------+
//|                                                        Bulls.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters

extern int BullsPeriod1=5;
extern int BullsPeriod2=10;
extern int BullsPeriod3=15;
extern int BullsPeriod4=20;

//---- buffers

double BullsBuffer[];

double TempBuffer1[];
double TempBuffer2[];
double TempBuffer3[];
double TempBuffer4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   string short_name;

   //---- 1 additional buffer used for counting.

   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   //---- indicator line

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,BullsBuffer);
  
   SetIndexBuffer(1,TempBuffer1);
   SetIndexBuffer(1,TempBuffer2);
   SetIndexBuffer(1,TempBuffer3);
   SetIndexBuffer(1,TempBuffer4);

   //---- name for DataWindow and indicator subwindow label

   short_name="EMA_Slope("+BullsPeriod1+","+BullsPeriod2+","+BullsPeriod3+","+BullsPeriod4+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

   return(0);
}

//+------------------------------------------------------------------+
//| Bulls Power                                                      |
//+------------------------------------------------------------------+

int start()
{
   int i,counted_bars=IndicatorCounted();

   if(Bars<=BullsPeriod4) return(0);
  
   int limit=Bars-counted_bars;
  
   if(counted_bars>0) limit++;
  
   for(i=0; i<limit; i++)
      TempBuffer1[i]=iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i+1);
      TempBuffer2[i]=iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i+1);
      TempBuffer3[i]=iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i+1);
      TempBuffer4[i]=iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i+1);
      i=Bars-counted_bars-1;
      while(i>=0)
     {

         BullsBuffer[i]=0.5;
         if(iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i+1) > 0 && iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i+1) > 0 && iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i+1) > 0 && iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i+1) > 0)
         {
            BullsBuffer[i]=1;
         }
         if(iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod1,0,MODE_EMA,PRICE_CLOSE,i+1) < 0 && iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod2,0,MODE_EMA,PRICE_CLOSE,i+1) < 0 && iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod3,0,MODE_EMA,PRICE_CLOSE,i+1) < 0 && iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,BullsPeriod4,0,MODE_EMA,PRICE_CLOSE,i+1) < 0)
         {
            BullsBuffer[i]=-1;
         }

         i--;
   }
   return(0);
}

自製指標 : Days Interval


自製指標 : Days Interval

就是類似多少天突破就買賣的指標

這裡是設定 20 天

計算的方法是用當天的 Close 減去 20 天之前的 Close

所以你說看到的數字如果是 正數 就表示當天比 20 天前 上升 了多少點

所以你說看到的數字如果是 負數 就表示當天比 20 天前 下降 了多少點

喜歡玩 突破 的人可以在看到數字由 負數區間 突破到 正數區間 的時候就 買入

就是這麼簡單咯

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//+------------------------------------------------------------------+
//|                                                        Bulls.mq4 |
//|                      Copyright ?2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Silver

//---- input parameters

extern int BullsPeriod=20;

//---- buffers

double BullsBuffer[];
double TempBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
{
   string short_name;

   //---- 1 additional buffer used for counting.

   IndicatorBuffers(2);
   IndicatorDigits(Digits);

   //---- indicator line

   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,BullsBuffer);
   SetIndexBuffer(1,TempBuffer);

   //---- name for DataWindow and indicator subwindow label

   short_name="Days_Interval("+BullsPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);

   return(0);
}

//+------------------------------------------------------------------+
//| Bulls Power                                                      |
//+------------------------------------------------------------------+

int start()
{
   int i,counted_bars=IndicatorCounted();

   if(Bars<=BullsPeriod) return(0);
  
   int limit=Bars-counted_bars;
  
   if(counted_bars>0) limit++;
  
   for(i=0; i<limit; i++)
      TempBuffer[i]=Close[i+BullsPeriod];
      i=Bars-counted_bars-1;
      while(i>=0)
     {
         BullsBuffer[i]=Close[i]-TempBuffer[i];
         i--;
   }
   return(0);
}

三個不同來源的指標的比較


三個不同來源的指標的比較

AO 是 MT4 裡面內置的指標

Days_Interval 是我自己寫的指標 就是用當天的 Close 減去 20 天之前的 Close 就是了

Trigger 是從網上找來的指標 沒有原始碼 所以也不知道它是怎麼算的 也不知道要不要花錢去買

仔細的看一下 你應該會發現 3 個指標都是相差不多吧?!

如果你還在找些什麼 萬能 的指標 可以每一次都很 準確 的告訴你那裡是 最高點 最低點 的話

那你很可能 永遠 也找不到 哦

其實指標是滯後的 要賺錢 靠的還是 策略 啦 那個還比較重要

哈哈