[警告关闭!]任何新手问题,为了不给论坛添乱。专业人士,不要走过。没有你,哪里都不能去。 - 页 28

 
利润取决于地段的大小...地段的大小取决于杠杆的大小...
 

面临着一个问题。

我写了一个BBP MA振荡器指标

它在图表上运行良好。

但当我从EA调用它时,数据并不匹配。

设定的参数分别是相同的。

BBP_0=iCustom("EURUSD",60, "BBP MA Oscillator",BBPPeriod9,MODE_SMA,SignalBBPPeriod9,MODE_SMMA,0,0)。

问题是,这怎么可能呢?

 
//+------------------------------------------------------------------+
//|                                            BBP MA Oscillator.mq4 |
//|                                                   vasbsm@mail.ru |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "vasbsm@mail.ru"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property  indicator_width1  2
//---- input parameters
extern int       BBPeriod=155;
extern int       TypeMA=MODE_SMA;
extern int       SignalMA=172;
extern int       Type_MA_Signal=MODE_SMMA;
//-----------------------------
double BBBuffer[];
double TempBuffer[];
double OsmaBuffer[];
double SignalBuffer[];

int init()
  {
   string short_name;
   IndicatorBuffers(4);
   IndicatorDigits(Digits);
   
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexDrawBegin(0, SignalMA);
   IndicatorDigits(Digits+2);
   
   SetIndexBuffer(0, OsmaBuffer);
   SetIndexBuffer(1, SignalBuffer);  
   SetIndexBuffer(2, BBBuffer);
   SetIndexBuffer(3, TempBuffer); 
   
   short_name="Bulls Bears Power MA("+ BBPeriod+","+ SignalMA+")";     
   IndicatorShortName( short_name);
   SetIndexLabel(0, short_name);   
   return(0);
  }
int deinit()
  {

   return(0);
  }
int start()
  {
   int counted_bars=IndicatorCounted();
   if(Bars<= BBPeriod) return(0);
//----------------------------------------------------------------
   int limit=Bars- counted_bars;
   if( counted_bars>0) limit++;
   for(int i=0; i< limit; i++)
      TempBuffer[ i]=iMA(NULL,0, BBPeriod,0, TypeMA,PRICE_CLOSE, i);
//----------------------------------------------------------------
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      BBBuffer[ i]=High[ i]+Low[ i]-2* TempBuffer[ i];
      i--;
     }
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      SignalBuffer[ i]=iMAOnArray( BBBuffer,Bars, SignalMA,0, Type_MA_Signal, i);
      i--;
     }
   i=Bars- counted_bars-1;
   while( i>=0)
     {
      OsmaBuffer[ i]= BBBuffer[ i]- SignalBuffer[ i];
      i--;
     }         
   return(0);
  }
 

我现在发现了一个有趣的功能...

(可能已经在某个地方描述过了,但我尽量先用脑子,然后再用教科书;))。

这使得我可以使用多一个IF类型的选择标准(过滤器)。

orders += OrderProfit()<1;

除了一个常见的、传统的IF过滤器,选择必要的订单。

引入上述代码中的条件已经选择了利润小于1的订单。

我甚至不知道这是否正确,但它似乎是有效的......

 
zfs >> :

面临着一个问题。

我写了一个BBP MA振荡器指标

它在图表上运行良好。

但当我从EA调用它时,数据并不匹配。

设定的参数分别是相同的。

BBP_0=iCustom("EURUSD",60, "BBP MA Oscillator",BBPPeriod9,MODE_SMA,SignalBBPPeriod9,MODE_SMMA,0,0)。

问题是,这怎么可能呢?

而如果在默认情况下

BBP_0=iCustom(NULL,0, "BBP MA Oscillator",0,0)。

而这显然是错误的

if( counted_bars>0) limit++

它应该是

if( counted_bars>0) limit--;
 

JavaDev,Granit77谢谢你的回答.....,虽然我还是没有得到我主要问题的答案,但我决定进一步阅读该教程。也许在这个过程中,我的问题的答案会变得更加清晰。

 
GGeoZ >> :

...虽然我的基本问题仍然没有得到答案,但我决定进一步阅读课本。也许在这个过程中,我的问题的答案会变得更加清晰。

我希望SK.没有在看这个主题,所以我将在教程中 "分享我读到的东西"。作为一个普通的哑巴用户,我只是跳过那些难以理解的部分,希望 "它能自己解决"。你的问题我甚至没有想到(年龄,你知道......)。在内部使用时,人们认为int是指可以用手指计算的一切,而double是指其他一切。:))

 
人们谁能回答我的问题......有趣的是,分歧的顺序是不重要的,但关键是......。我很乐意分享一个基于这个和另一个指标的盈利策略。计算中可能存在一些错误...
 
granit77 писал(а)>>

我希望SK. 没有在看这个主题,所以我将在一本教科书中 "分享我所读到的东西"。作为一个普通的傻瓜用户,我只是跳过那些晦涩难懂的部分,希望 "它会自己解决"。你的问题我甚至没有想到(年龄,你知道......)。在内部使用时,人们认为int是指可以用手指计算的一切,而double是指其他一切。:))

好样的!!!。

傻笑是一种乐趣。我也不明白这些问题。

为了以防万一,我还会加上我邻居的手指。

 
先生们,请告知如何计算用所有可用资金开仓的最大手数。
原因: