smilespirit 发表于 2016-10-26 20:00:33

看看,学习,谢谢。

wolfpack 发表于 2016-11-1 23:14:25

学习以下!!!!!

jinxueli1971 发表于 2016-11-2 20:58:33

学习学习学习

emplykey 发表于 2016-11-3 18:22:47

好强大啊

kookai 发表于 2016-11-6 22:53:58

国际顶尖的十种日内交易策略

cstseng0615 发表于 2016-11-7 00:10:29


当价格跌穿下轨,卖出开仓。

zfblkj 发表于 2016-11-7 01:22:55

感谢分享!!!!

GYDATOUTIE 发表于 2016-11-8 18:42:39

#property indicator_separate_window

#property indicator_maximum 0.7
#property indicator_minimum 0.0


#property indicator_buffers 3
#property indicator_color1C'40,70,125'
#property indicator_color2C'125,70,40'
#property indicator_color3C'125,70,40'
#property indicator_width117
#property indicator_width217
#property indicator_width317



string         TimeFrame         = "Current time frame";
extern int   Periods         = 10;
double         Phase             = 0;
extern int   Price             = PRICE_CLOSE;
bool         SmoothDouble      = false;
string         ForSymbol         = "";
bool         Interpolate       = true;
extern bool    alertsOn          = true;
extern bool    alertsOnCurrent   = true;
extern bool    alertsMessage   = true;
extern bool    alertsSound       = false;
extern bool    alertsEmail       = false;



double buffer1[];
double buffer2[];
double buffer3[];
double trend[];



string indicatorFileName;
bool   returnBars;
bool   calculateValue;
int    timeFrame;



int init()
{
   IndicatorBuffers(4);
   SetIndexBuffer(0,buffer1);
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(1,buffer2);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(2,buffer3);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(3,trend);
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   SetIndexLabel(3, NULL);


      Periods = MathMax(Periods,1);
      if (ForSymbol=="") ForSymbol=Symbol();



         indicatorFileName = WindowExpertName();
         calculateValue    = TimeFrame=="calculateValue"; if (calculateValue) { return(0); }
         returnBars      = TimeFrame=="returnBars";   if (returnBars)   { return(0); }
         timeFrame         = stringToTimeFrame(TimeFrame);



   IndicatorShortName("[ "+timeFrameToString(timeFrame)+" ]");

}
int deinit() { return(0); }



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

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
         limit=MathMin(Bars-counted_bars,Bars-1);
         if (returnBars) { buffer1 = MathMin(limit+1,Bars-1); return(0); }



   if (calculateValue || (timeFrame == Period() && ForSymbol==Symbol()))
   {
      if (trend==-1) CleanPoint(limit,buffer2,buffer3);
      for(i=limit; i>=0; i--)
      {
         buffer1 = iDSmooth(iMA(NULL,0,1,0,MODE_SMA,Price,i),Periods,Phase,SmoothDouble,i);
         buffer2 = EMPTY_VALUE;
         buffer3 = EMPTY_VALUE;
         trend   = trend;
            if (buffer1>buffer1) trend =1;
            if (buffer1<buffer1) trend = -1;
            if (trend==-1) PlotPoint(i,buffer2,buffer3,buffer1);
      }            
      manageAlerts();
      return(0);
   }      



   limit = MathMax(limit,MathMin(Bars-1,iCustom(ForSymbol,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));
   if (trend==-1) CleanPoint(limit,buffer2,buffer3);
   for (i=limit; i>=0; i--)
   {
      int y = iBarShift(ForSymbol,timeFrame,Time);
         trend   = iCustom(ForSymbol,timeFrame,indicatorFileName,"calculateValue",Periods,Phase,Price,SmoothDouble,3,y);
         buffer1 = iCustom(ForSymbol,timeFrame,indicatorFileName,"calculateValue",Periods,Phase,Price,SmoothDouble,0,y);
         buffer2 = 0;//EMPTY_VALUE;
         buffer3 = 1;//EMPTY_VALUE;



         if (!Interpolate || y==iBarShift(ForSymbol,timeFrame,Time)) continue;



            datetime time = iTime(NULL,timeFrame,y);
               for(int n = 1; i+n < Bars && Time >= time; n++) continue;      
               for(int k = 1; k < n; k++)
                  buffer1 = buffer1 + (buffer1 - buffer1)*k/n;
   }
   for (i=limit;i>=0;i--) if (trend==-1) PlotPoint(i,buffer2,buffer3,buffer1);
   manageAlerts();



   return(0);
}





void manageAlerts()
{
   if (!calculateValue && alertsOn)
   {
      if (alertsOnCurrent)
         int whichBar = 0;
      else   whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));
      if (trend != trend)
      {
         if (trend ==1) doAlert(whichBar,"UP");
         if (trend == -1) doAlert(whichBar,"DOWN");
      }
   }
}



void doAlert(int forBar, string doWhat)
{
   static string   previousAlert="nothing";
   static datetime previousTime;
   string message;

   if (previousAlert != doWhat || previousTime != Time) {
       previousAlert= doWhat;
       previousTime   = Time;



       message =StringConcatenate(Symbol()," ",timeFrameToString(timeFrame)," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," OSCILLATOR Trend changed to ",doWhat);
          if (alertsMessage) Alert(message);
          if (alertsEmail)   SendMail(StringConcatenate(Symbol(),"OSCILLATOR X"),message);
          if (alertsSound)   PlaySound("alert.wav");
   }
}




double wrk[];

#define bsmax5
#define bsmin6
#define volty7
#define vsum   8
#define avolty 9



double iDSmooth(double price, double length, double phase, bool isDouble, int i, int s=0)
{
   if (isDouble)
         return (iSmooth(iSmooth(price,MathSqrt(length),phase,i,s),MathSqrt(length),phase,i,s+10));
   elsereturn (iSmooth(price,length,phase,i,s));
}



double iSmooth(double price, double length, double phase, int i, int s=0)
{
   if (length <=1) return(price);
   if (ArrayRange(wrk,0) != Bars) ArrayResize(wrk,Bars);

   int r = Bars-i-1;
      if (r==0) { for(int k=0; k<7; k++) wrk=price; for(; k<10; k++) wrk=0; return(price); }



      double len1   = MathMax(MathLog(MathSqrt(0.5*(length-1)))/MathLog(2.0)+2.0,0);
      double pow1   = MathMax(len1-2.0,0.5);
      double del1   = price - wrk;
      double del2   = price - wrk;
      double div    = 1.0/(10.0+10.0*(MathMin(MathMax(length-10,0),100))/100);
      int    forBar = MathMin(r,10);
      
         wrk = 0;
               if(MathAbs(del1) > MathAbs(del2)) wrk = MathAbs(del1);
               if(MathAbs(del1) < MathAbs(del2)) wrk = MathAbs(del2);
         wrk =      wrk + (wrk-wrk)*div;



         wrk = wrk+(2.0/(MathMax(4.0*length,30)+1.0))*(wrk-wrk);
            if (wrk > 0)
               double dVolty = wrk/wrk; else dVolty = 0;   
                     if (dVolty > MathPow(len1,1.0/pow1)) dVolty = MathPow(len1,1.0/pow1);
                  if (dVolty < 1)                      dVolty = 1.0;


               
         double pow2 = MathPow(dVolty, pow1);
      double len2 = MathSqrt(0.5*(length-1))*len1;
      double Kv   = MathPow(len2/(len2+1), MathSqrt(pow2));

         if (del1 > 0) wrk = price; else wrk = price - Kv*del1;
         if (del2 < 0) wrk = price; else wrk = price - Kv*del2;
      


      double R   = MathMax(MathMin(phase,100),-100)/100.0 + 1.5;
      double beta= 0.45*(length-1)/(0.45*(length-1)+2);
      double alpha = MathPow(beta,pow2);

         wrk = price + alpha*(wrk-price);
         wrk = (price - wrk)*(1-beta) + beta*wrk;
         wrk = (wrk + R*wrk);
         wrk = (wrk - wrk)*MathPow((1-alpha),2) + MathPow(alpha,2)*wrk;
         wrk = (wrk + wrk);



   return(wrk);
}



void CleanPoint(int i,double& first[],double& second[])
{
   if ((second!= EMPTY_VALUE) && (second != EMPTY_VALUE))
      second = EMPTY_VALUE;
   else
      if ((first != EMPTY_VALUE) && (first != EMPTY_VALUE) && (first == EMPTY_VALUE))
          first = EMPTY_VALUE;
}



void PlotPoint(int i,double& first[],double& second[],double& from[])
{
   if (first == EMPTY_VALUE)
      {
         if (first == EMPTY_VALUE) {
                first   = from;
                first = from;
                second= EMPTY_VALUE;
            }
         else {
                second   =from;
                second =from;
                first    = EMPTY_VALUE;
            }
      }
   else
      {
         first= from;
         second = EMPTY_VALUE;
      }
}



string sTfTable[] = {"M1","M5","M15","M30","H1","H4","D1","W1","MN"};
int    iTfTable[] = {1,5,15,30,60,240,1440,10080,43200};



int stringToTimeFrame(string tfs)
{
   tfs = stringUpperCase(tfs);
   for (int i=ArraySize(iTfTable)-1; i>=0; i--)
         if (tfs==sTfTable || tfs==""+iTfTable) return(MathMax(iTfTable,Period()));
                                                      return(Period());
}
string timeFrameToString(int tf)
{
   for (int i=ArraySize(iTfTable)-1; i>=0; i--)
         if (tf==iTfTable) return(sTfTable);
                              return("");
}



string stringUpperCase(string str)
{
   string   s = str;

   for (int length=StringLen(str)-1; length>=0; length--)
   {
      int char = StringGetChar(s, length);
         if((char > 96 && char < 123) || (char > 223 && char < 256))
                     s = StringSetChar(s, length, char - 32);
         else if(char > -33 && char < 0)
                     s = StringSetChar(s, length, char + 224);
   }
   return(s);
}

qq1030029698 发表于 2016-11-10 15:49:45

啊,还要先回复啊

simen 发表于 2016-11-12 15:37:45

regr4gtt5t54t54

aghlqp 发表于 2016-11-12 22:44:28

学习下,看看有没有适合的方法

inameone 发表于 2016-11-16 01:09:28

谢谢 看看看看

4188.82 发表于 2016-11-16 07:31:49

520fx有你更精彩

ctxl888 发表于 2016-11-16 08:16:14

fhgfhgf

ferrari0078 发表于 2016-11-20 12:12:10

该波动幅度进行必要的调整
页: 1 2 3 4 5 6 7 8 [9] 10 11 12 13 14 15 16 17 18
查看完整版本: 国际顶尖的十种日内交易策略