0
(0)
ชื่อ:
Envelopes, Env
ผู้เขียน: MetaQuotes (2005.12.07 11:30)
ดาวน์โหลดแล้ว: 6759
ดาวน์โหลด:
Envelopes, Env 1
Envelopes.mq4 (2.8 Kb) ดู
Envelopes, Env 2 envelopes.gif (10.3 Kb)
Envelopes, Env 3
Envelopes Technical Indicator is formed with two Moving Averages one of which is shifted upward and another one is shifted downward. The selection of optimum relative number of band margins shifting is determined with the market volatility: the higher the latter is, the stronger the shift is.

Envelopes define the upper and the lower margins of the price range. Signal to sell appears when the price reaches the upper margin of the band; signal to buy appears when the price reaches the lower margin.

The logic behind envelopes is that overzealous buyers and sellers push the price to the extremes (เช่น., the upper and lower bands), at which point the prices often stabilize by moving to more realistic levels. This is similar to the interpretation of Bollinger Bands.

การคำนวณ
Upper Band = SMA(ปิด, N)*[1+K/1000]

Lower Band = SMA(ปิด, N)*[1-K/1000]

Where:
SMA — Simple Moving Average;
N — averaging period;
K/1000 — the value of shifting from the average (measured in basis points).

คำอธิบายตัวบ่งชี้ทางเทคนิค

Full description of Env is available in the การวิเคราะห์ทางเทคนิค: Envelopes

2 ความคิดเห็น หากต้องการโพสต์ความคิดเห็นใหม่, โปรด เข้าสู่ระบบ หรือ ลงทะเบียน

buccas13:
สวัสดี,

Thanks for this developing this indicator and sharing it.

Is it possible to change the MA method to Smoothed or Linear weighted or Exponential?

You could call any of the Ma functions from this code sample, to use in the Envelopes indicator.

//+------------------------------------------------------------------+
//|                                        Custom Moving Average.mq4 |
//|                      ลิขสิทธิ์ © 2004, เมตาโควตส์ ซอฟต์แวร์ คอร์ป. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#ลิขสิทธิ์ทรัพย์สิน "ลิขสิทธิ์ © 2004, MetaQuotes Software Corp."
#ลิงค์คุณสมบัติ      "http://www.metaquotes.net/"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
extern int MA_Period=13;
extern int MA_Shift=0;
extern int MA_Method=0;
//---- indicator buffers
double ExtMapBuffer[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   int    draw_begin;
   string short_name;
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexShift(0,MA_Shift);
   IndicatorDigits(MarketInfo(เครื่องหมาย(),MODE_DIGITS));
   ถ้า(MA_ระยะเวลา<2) MA_Period=13;
   draw_begin=MA_Period-1;
//---- indicator short name
   switch(MA_Method)
     {
      case 1 : short_name="แม่(";  draw_begin=0; break;
      case 2 : short_name="เอสเอ็มเอ็มเอ("; break;
      case 3 : short_name="LWMA("; break;
      ค่าเริ่มต้น :
         MA_Method=0;
         short_name="SMA(";
     }
   IndicatorShortName(short_name+MA_Period+")");
   SetIndexDrawBegin(0,draw_begin);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   ถ้า(บาร์<=MA_Period) return(0);
   ExtCountedBars=IndicatorCounted();
//---- check for possible errors
   if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
   if (ExtCountedBars>0) ExtCountedBars--;
//----
   switch(MA_Method)
     {
      case 0 : สมา();  break;
      case 1 : อีมา();  break;
      case 2 : อืม(); break;
      case 3 : มะ();
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+
//| ค่าเฉลี่ยเคลื่อนที่อย่างง่าย                                            |
//+------------------------------------------------------------------+
void sma()
  {
   double sum=0;
   int    i,pos=Bars-ExtCountedBars-1;
//---- initial accumulation
   if(pos<MA_ระยะเวลา) pos=MA_Period;
   สำหรับ(i=1;ฉัน<MA_ระยะเวลา;i++,pos--)
      sum+=Close[pos];
//---- main calculation loop
   while(pos>=0)
     {
      sum+=Close[pos];
      ExtMapBuffer[pos]=sum/MA_Period;
           sum-=Close[pos+MA_Period-1];
           pos--;
     }
//---- zero initial bars
   if(ExtCountedBars<1)
      สำหรับ(i=1;ฉัน<MA_ระยะเวลา;ฉัน ++) ExtMapBuffer[Bars-i]=0;
  }
//+------------------------------------------------------------------+
//| ค่าเฉลี่ยเคลื่อนที่แบบเอ็กซ์โปเนนเชียล                                       |
//+------------------------------------------------------------------+
void ema()
  {
   double pr=2.0/(MA_Period+1);
   int    pos=Bars-2;
   ถ้า(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
//---- main calculation loop
   while(pos>=0)
     {
      ถ้า(pos==Bars-2) ExtMapBuffer[pos+1]=Close[pos+1];
      ExtMapBuffer[pos]=Close[pos]*pr+ExtMapBuffer[pos+1]*(1-ประชาสัมพันธ์);
           pos--;
     }
  }
//+------------------------------------------------------------------+
//| Smoothed Moving Average                                          |
//+------------------------------------------------------------------+
void smma()
  {
   double sum=0;
   int    i,เค,pos=Bars-ExtCountedBars+1;
//---- main calculation loop
   pos=Bars-MA_Period;
   ถ้า(pos>Bars-ExtCountedBars) pos=Bars-ExtCountedBars;
   ในขณะที่(pos>=0)
     {
      ถ้า(pos==Bars-MA_Period)
        {
         //---- initial accumulation
         for(i=0,k=pos;ฉัน<MA_ระยะเวลา;i++,k++)
           {
            sum+=Close[เค];
            //---- zero initial bars
            ExtMapBuffer[เค]=0;
           }
        }
      else sum=ExtMapBuffer[pos+1]*(MA_Period-1)+ปิด[pos];
      ExtMapBuffer[pos]=sum/MA_Period;
           pos--;
     }
  }
//+------------------------------------------------------------------+
//| Linear Weighted Moving Average                                   |
//+------------------------------------------------------------------+
void lwma()
  {
   double sum=0.0,lsum=0.0;
   double price;
   int    i,weight=0,pos=Bars-ExtCountedBars-1;
//---- initial accumulation
   if(pos<MA_ระยะเวลา) pos=MA_Period;
   สำหรับ(i=1;ฉัน<=MA_Period;i++,pos--)
     {
      price=Close[pos];
      sum+=price*i;
      lsum+=price;
      weight+=i;
     }
//---- main calculation loop
   pos++;
   i=pos+MA_Period;
   ในขณะที่(pos>=0)
     {
      ExtMapBuffer[pos]=sum/weight;
      ถ้า(pos==0) break;
      pos--;
      i--;
      price=Close[pos];
      sum=sum-lsum+price*MA_Period;
      lsum-=Close[ฉัน];
      lsum+=price;
     }
//---- zero initial bars
   if(ExtCountedBars<1)
      สำหรับ(i=1;ฉัน<MA_ระยะเวลา;ฉัน ++) ExtMapBuffer[Bars-i]=0;
  }
//+------------------------------------------------------------------+
02.01.2012 22:29 AmIBroke

สวัสดี,

Thanks for this developing this indicator and sharing it.

Is it possible to change the MA method to Smoothed or Linear weighted or Exponential?

โพสต์นี้มีประโยชน์เพียงใด?

คลิกที่ดาวเพื่อให้คะแนน!

คะแนนเฉลี่ย 0 / 5. นับคะแนนเสียง: 0

ยังไม่มีคะแนนโหวต! เป็นคนแรกที่ให้คะแนนโพสต์นี้.

ขออภัยที่โพสต์นี้ไม่มีประโยชน์สำหรับคุณ!

ให้เราปรับปรุงโพสต์นี้!

บอกเราว่าเราจะปรับปรุงโพสต์นี้ได้อย่างไร?



ผู้เขียน: ทีมงาน Forex Wiki
เราคือทีมผู้ซื้อขาย Forex ที่มีประสบการณ์สูง [2000-2023] ที่อุทิศตนเพื่อใช้ชีวิตในแบบของเรา. วัตถุประสงค์หลักของเราคือการได้รับอิสรภาพทางการเงินและอิสรภาพ, และเราได้ติดตามการศึกษาด้วยตนเองและได้รับประสบการณ์ที่กว้างขวางในตลาด Forex เพื่อเป็นหนทางในการบรรลุวิถีชีวิตที่ยั่งยืนด้วยตนเอง.