6号病房 - 页 35

 
停止--不要申请,出现了一个错误。我会解决这个问题。
 
Dr.Drain:
看来是时候装上一个冷凝器了?:-)))

不,迟到的医生,是时候进行诊断了。
 
//+------------------------------------------------------------------+
//|                                                _2_DoidsSheme.mq4 |
//|           Copyright © 2012. XrustSolution. mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012. XrustSolution. mail:xrustx@gmail.com"
#property link      "https://www.youtube.com/user/opmlv http://forexrust.info"
//+------------------------------------------------------------------+
//| Super Global Variables                                           |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//+------------------------------------------------------------------+
//| Extern Variables                                                 |
//+------------------------------------------------------------------+
extern string  ЕмкостьКонденсатора          = "= Начальный период МА";
extern    int  Capacity                                     = 50      ;
extern string  СопротивлениеУтечки                  = " конденсатора";
extern double  Resistance_C1                                = 100    ;
extern string  Резистор_В_Цепи_Заряда               = " конденсатора";
extern double  Resistance_R1                                = 0.13     ;
extern string  Резистор_В_Цепи_Разряда              = " конденсатора";
extern double  Resistance_R2                                = 0.1     ;
extern string  Порог_пробоя_Варистора               = "Максимальный период";
extern double  SafePerid                                    = 100    ;
extern string  МетодСбросаЗаряда                    = "true=Ограничение/false=Сброс на 0";
extern   bool  ResetMetod                                   = true   ;
extern    int  MoovingMetod                                 = 0      ;
extern    int  MoovingPrice                                 = 0      ;
//+------------------------------------------------------------------+
//|   Includes                                                                  |
//+------------------------------------------------------------------+
//#include <OBJECTS_CLASSES.mqh>
//#include <AlertsAndSounds.mqh>//GetInfo("");          
//+------------------------------------------------------------------+
//|   Defines & Global variavles                                     |
//+------------------------------------------------------------------+
#define empty  EMPTY_VALUE

//+------------------------------------------------------------------+
//--- buffers
double diods[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init(){
        //---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,diods);
        //----
return;}
//+------------------------------------------------------------------+
void deinit(){return;}
//+------------------------------------------------------------------+
void start(){
        //----
                
        //----
        static int preLimit=0;
        static double prerp = 0;         
   int i, ii, x, y, counted = IndicatorCounted();
   if (counted > 0) counted--;
   int limit = Bars - counted;
   int per   = Period();
   string sy = Symbol();
   string txt="";
   double res=0,pres=0,diff=0,pdiff=0,koff=0;
   if(limit<=preLimit){limit=preLimit+1;}
        //----
   for(i=5000;i>=0;i--){
        res = iMA(sy,per,1,0,MoovingMetod,MoovingPrice,i);
        diff =  MathAbs(res-iMA(sy,per,1,0,MoovingMetod,MoovingPrice,i+1));
        if(diff > pdiff){
          koff-=MathAbs(diff-pdiff)/Resistance_R1;
        }else
        if(diff < pdiff){
          koff+=MathAbs(diff-pdiff)/Resistance_R2;
        }
        koff-=1/Resistance_C1;          
        
        pdiff=diff;
        if(koff>SafePerid){
          if(ResetMetod){
             koff = koff-SafePerid;
          }else{
             koff = 0;
          }   
        }
        if(koff<-(Capacity-1)){koff=-Capacity+1;}
        if(Capacity+koff>preLimit){preLimit = Capacity+koff;}
        diods[i] = iMA(sy,per,Capacity+koff,0,MoovingMetod,MoovingPrice,i+1);
   }
   
        //----
return;}
//+------------------------------------------------------------------+
 
C-4:

不,太晚了,医生,是时候进行诊断了。

不要阻止我们的乐趣 : )
[删除]  
FAQ:
你的指标很不稳定。
 
//+------------------------------------------------------------------+
//|                                                _2_DoidsSheme.mq4 |
//|           Copyright © 2012. XrustSolution. mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012. XrustSolution. mail:xrustx@gmail.com"
#property link      "https://www.youtube.com/user/opmlv http://forexrust.info"
//+------------------------------------------------------------------+
//| Super Global Variables                                           |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue
//+------------------------------------------------------------------+
//| Extern Variables                                                 |
//+------------------------------------------------------------------+
extern string  ЕмкостьКонденсатора          = "= Начальный период МА";
extern    int  Capacity                                     = 50      ;
extern string  СопротивлениеУтечки                  = " конденсатора";
extern double  Resistance_C1                                = 100    ;
extern string  Резистор_В_Цепи_Заряда               = " конденсатора";
extern double  Resistance_R1                                = 0.3     ;
extern string  Резистор_В_Цепи_Разряда              = " конденсатора";
extern double  Resistance_R2                                = 0.1     ;
extern string  Порог_пробоя_Варистора               = "Максимальный период";
extern double  SafePerid                                    = 100    ;
extern string  МетодСбросаЗаряда                    = "true=Ограничение/false=Сброс на 0";
extern   bool  ResetMetod                                   = true   ;
extern    int  MoovingMetod                                 = 0      ;
extern    int  MoovingPrice                                 = 0      ;
//+------------------------------------------------------------------+
//|   Includes                                                                  |
//+------------------------------------------------------------------+
//#include <OBJECTS_CLASSES.mqh>
//#include <AlertsAndSounds.mqh>//GetInfo("");          
//+------------------------------------------------------------------+
//|   Defines & Global variavles                                     |
//+------------------------------------------------------------------+
#define empty  EMPTY_VALUE

//+------------------------------------------------------------------+
//--- buffers
double diods[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init(){
        //---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,diods);
        //----
return;}
//+------------------------------------------------------------------+
void deinit(){return;}
//+------------------------------------------------------------------+
void start(){
        //----
                
        //----
        static int preLimit=0;
        static double prerp = 0;         
   int i, ii, x, y, counted = IndicatorCounted();
   if (counted > 0) counted--;
   int limit = Bars - counted;
   int per   = Period();
   string sy = Symbol();
   string txt="";
   double res=0,pres=0,diff=0,pdiff=0,koff=0;
   if(limit<=preLimit){limit=preLimit+1;}
        //----
   for(i=5000;i>=0;i--){
        res = iMA(sy,per,Capacity+koff,0,MoovingMetod,MoovingPrice,i);
        diff =  MathAbs(res-iMA(sy,per,Capacity+koff,0,MoovingMetod,MoovingPrice,i+1));
        if(diff > pdiff){
          koff-=MathAbs(diff-pdiff)/Resistance_R1;
        }else
        if(diff < pdiff){
          koff+=MathAbs(diff-pdiff)/Resistance_R2;
        }
        koff-=1/Resistance_C1;          
        
        pdiff=diff;
        if(koff>SafePerid){
          if(ResetMetod){
             koff = koff-SafePerid;
          }else{
             koff = 0;
          }   
        }
        if(koff<-(Capacity-1)){koff=-Capacity+1;}
        if(Capacity+koff>preLimit){preLimit = Capacity+koff;}
        diods[i] = iMA(sy,per,Capacity+koff,0,MoovingMetod,MoovingPrice,i+1);
   }
   
        //----
return;}
//+------------------------------------------------------------------+

有反馈

 
DmitriyN:
你的指标很不稳定。

你对它的期望是什么?
[删除]  
FAQ:
听着,Rustam,你能把任何方案变成MQL代码吗?我不是在幽默,我是在认真地问。
 

MQL => Scheme : 没有问题

Scheme =>MQL : 在语言的矩阵允许的范围内。

只是在第一种情况下,不要要求用铁做,我很懒:))

 
...嗯。第一个变体需要再挖掘一下(根据市场实际情况进行调整),可以送到基地去。对于一个适应性的MA来说,这并不坏。