客服热线:18391752892

通道加KD组合的物件箭头信号

   日期:2019-01-12     浏览:454    
马上注册,结交更多好友,下载更多资源

您需要 登录 才可以下载或查看,没有帐号?注册 //[i] StochasticonChart ------ 通道加KD组合的物件箭头信号

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Yellow
#property indicator_width1 2
#property indicator_color2 Yellow
#property indicator_width2 1
#property indicator_color3 Yellow
#property indicator_width3 1
#property indicator_color4 Yellow
#property indicator_width4 1

#import  shell32.dll        //Connect a dll (provided with Windows)         
 int ShellExecuteA(int hwnd, string Operation, string File, string Parameters, string Directory, int ShowCmd);
#import user32.dll
 int MessageBoxA(int hWnd , string lpText, string lpCaption, int uType);
//------------------------------------------------------------------------------------------------------

extern int K周期   = 5;
extern int D周期   = 3;
extern int 慢周期 = 3;
extern int MA     = 50;
extern int Scale   = 100;
extern int 使用通道显示   = 1;
extern int 使用箭头显示   = 1;

double 信率Ma[];
double 黄上轨[];
double 黄下轨[];
double 黄中轨[];
double KD信组[];
//----
int 始绘处1   = 0;
int 始绘处2   = 0;

int 绘箭数   = 15;

//---------------初始化----------------+

int init()
 {
   string 简称;
   
   string 箭头名;
   for(int n=0; n n++){
     箭头名= KD信号 +K周期+ _ +n;
     ObjectDelete(箭头名);
   }

   CheckDonate();

   IndicatorBuffers(4);

   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, 信率Ma);

   if(使用通道显示==1){
     SetIndexStyle(1, DRAW_LINE);
     SetIndexBuffer(1, 黄上轨);
     SetIndexStyle(2, DRAW_LINE);
     SetIndexBuffer(2, 黄中轨);
     SetIndexStyle(3, DRAW_LINE);
     SetIndexBuffer(3, 黄下轨);
   }
   else
     for(int i=1; i i++)
       SetIndexStyle(i, DRAW_NONE);
   
   for(i=4; i i++)
      SetIndexStyle(i, DRAW_NONE);
   
   //--
   简称= Sto( +K周期+ , +D周期+ , +慢周期+ )
   IndicatorShortName(简称);
   SetIndexLabel(0, 简称);
   SetIndexLabel(1, 80%
   SetIndexLabel(2, 50%
   SetIndexLabel(3, 20%
   //--
   始绘处1= K周期+慢周期;
   始绘处2= 始绘处1+D周期;
   SetIndexDrawBegin(0, 始绘处1);
   SetIndexDrawBegin(1, 始绘处1);
   SetIndexDrawBegin(2, 始绘处1);
   SetIndexDrawBegin(3, 始绘处1);
   //--
   ArraySetAsSeries(KD信组, true);
   return(0);
 }

//--------------反初始化--------------+

void deinit()
 {
   string 箭头名;
   for(int n=0; n n++){
     箭头名= KD信号 +K周期+ _ +n;
     ObjectDelete(箭头名);
   }
 }

//---------------主函数----------------+

int start()
 {
   int    i, n;
   int    已计= IndicatorCounted();

   if(Bars =始绘处2)
   return(0);

   if(ArraySize(KD信组)!=Bars)
     ArrayResize(KD信组, Bars);

   //--初始归0
   if(已计 1)
     for(i=1;i =始绘处2;i++){
       信率Ma[Bars-i]= 0;
       黄下轨[Bars-i]= 0;
       黄上轨[Bars-i]= 0;
       黄中轨[Bars-i]= 0;
       KD信组[Bars-i]= 0;
     }

   //--缓组赋值
   double kk= Point*Scale/100;
   int limit= Bars-已计;
   for(i=0; i limit; i++){
     KD信组[i]= iStochastic(Symbol(), 0, K周期, D周期, 慢周期, MODE_SMA, 0, MODE_SIGNAL, i);
     信率Ma[i]= iMA(Symbol(), 0, MA, 0, MODE_EMA, PRICE_MEDIAN, i)+(KD信组[i]-50)*kk;
     if(使用通道显示==1){
       黄上轨[i]= iMA(Symbol(), 0, MA, 0, MODE_EMA, PRICE_MEDIAN, i)+30*kk;
       黄中轨[i]= iMA(Symbol(), 0, MA, 0, MODE_EMA, PRICE_MEDIAN, i);
       黄下轨[i]= iMA(Symbol(), 0, MA, 0, MODE_EMA, PRICE_MEDIAN, i)-30*kk;
     }
   }
   
   //--物件箭头
   if(使用箭头显示==1){
     int 标志;
     double 值D0, 值D1, 值D2, 值D3;
     i= 0;
     n= 0;
     while(n 绘箭数 i Bars){
       标志= 0;
       while(i Bars 标志==0){
         值D0= iStochastic(Symbol(), 0, K周期, D周期, 慢周期, MODE_SMA, 0, MODE_SIGNAL, i+0);
         值D1= iStochastic(Symbol(), 0, K周期, D周期, 慢周期, MODE_SMA, 0, MODE_SIGNAL, i+1);
         值D2= iStochastic(Symbol(), 0, K周期, D周期, 慢周期, MODE_SMA, 0, MODE_SIGNAL, i+2);
         值D3= iStochastic(Symbol(), 0, K周期, D周期, 慢周期, MODE_SMA, 0, MODE_SIGNAL, i+3);

         if(值D0 值D1 值D2 值D1 值D3 值D2)
           标志= +1;
         if(值D0 值D1 值D2 值D1 值D3 值D2)
           标志= -1;
         if(标志!=0)
           break;
         i++;
       }

       string 箭头名= KD信号 +K周期+ _ +n;
       ObjectDelete(箭头名);
       if(标志==+1){
         ObjectCreate(箭头名, OBJ_ARROW, 0, Time[i], Low[i]);
         ObjectSet(箭头名, OBJPROP_ARROWCODE, 108);
         ObjectSet(箭头名, OBJPROP_COLOR, Blue);
         n++;
       }
       if(标志==-1){
         ObjectCreate(箭头名, OBJ_ARROW, 0, Time[i], High[i]+(WindowPriceMax()-WindowPriceMin())/10);
         ObjectSet(箭头名, OBJPROP_ARROWCODE, 108);
         ObjectSet(箭头名, OBJPROP_COLOR, Red);
         n++;
       }
       i+=1;
     }
   }
   return(0);
 }

//---------------CheckDonate----------------+

void CheckDonate()
 {
   int 手柄= 0;
   string pay= 0
   datetime dt= 0;
   string 文件名= StochOC.txt

   手柄= FileOpen(文件名, FILE_READ|FILE_CSV,
   if(手柄 =1){
     pay= FileReadString(手柄);
     if(pay!= 0 pay!= 1 )
       pay= 0
     dt= StrToTime(FileReadString(手柄));
   }
   else{
     dt= TimeCurrent();
     手柄= FileOpen(文件名, FILE_WRITE|FILE_CSV,
     FileWrite(手柄, 0 , TimeToStr(dt, TIME_DATE));
   }
   FileClose(手柄);
   
   if(pay== 0 (TimeCurrent()-dt) 10*24*60*60){ // 5 ?í?é
     if(MessageBoxA(0, ???è ?àì ??í?à?è??? èí?èêàò?? On Chart Stochastic, n ??òèò? ??ì?÷ü à?ò??ó ìàò??èà?üí?? , ?????? , 4)==6){
       ShellExecuteA(0, Open , iexplore.exe , wmk:payto?Purse=R865705290089 Amount=100 Desc=Indicator BringToFront=Y ExecEvenKeeperIsOffline=Y , , 7);
       pay= 1
     }
     dt= TimeCurrent();
     
     手柄= FileOpen(文件名, FILE_WRITE|FILE_CSV,
     FileWrite(手柄, pay, TimeToStr(dt, TIME_DATE));
     FileClose(手柄);
   }
   FileClose(手柄);
 }

//--------------------------------------+复制代码
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!


特别提示:本信息由相关企业自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


0相关评论
相关行情快递
推荐行情快递
点击排行