以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  跪求将帖子源码改写成金字塔源码  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=6813)

--  作者:mylass
--  发布时间:2011/6/9 15:09:52
--  跪求将帖子源码改写成金字塔源码

请老师帮把下列代码改成金字塔的。

int start()  {

   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-20-counted_bars;
   double spread=Ask-Bid;
   for(i=limit; i>=0; i--) {
    Range=0;
    AvgRange=0;
    for (Counter=i; Counter<=i+9; Counter++) {
      AvgRange=AvgRange+MathAbs(spread+High[Counter]-Low[Counter]);
    }
    Range=AvgRange/10.0;
      if (i==Bars-20)  {
            value2=1; value3=18; value10=10000; value10_1=0;
        value19=MONYRISK*Range*Point;
        value2=Risk;
        value3=18+3*value2;
        value9=0;
      }
    Counter=i;
    AvgRange=0;
    for (Counter=i; Counter<=i+9-1; Counter++) {
     AvgRange=AvgRange+Close[Counter];
  }
    value11=AvgRange/9.0;
    // -----
    //value12=UserFunction("AverageClose",value3,i);
    Counter=i;
    AvgRange=0;
    for (Counter=i; Counter<=i+value3-1; Counter++) {
     AvgRange=AvgRange+Close[Counter];
  }
    value12=AvgRange/value3;
    // -----
    value13=Range;
    // -----
    //value4=UserFunction("JESSD",High[i],Low[i],High[i+value2],Low[i+value2],Close[i+value2]);
    AvgRange=(spread+High[i]+Low[i])/2.0;
    if (Close[i+value2]<AvgRange) {
      value4=2*AvgRange-Low[i+value2];
    } else {
     value4=2*AvgRange-spread+High[i+value2];
  }
    // -----
    Counter=i;
    TrueCount=0;
    while (Counter<i+2 && TrueCount<1) {
     //value4=UserFunction("JESSD",High[Counter],Low[Counter],High[Counter+value2],Low[Counter+value2],Close[Counter+value2]);
      AvgRange=(spread+High[Counter]+Low[Counter])/2.0;
      if (Close[Counter+value2]<AvgRange) {
       value4=2*AvgRange-Low[Counter+value2];
     } else {
       value4=2*AvgRange-spread+High[Counter+value2];
     }
      value4=NormalizeDouble(value4,2);
      //value4_1=UserFunction("JESSD",High[Counter+1],Low[Counter+1],High[Counter+value2],Low[Counter+value2],Close[Counter+value2]);
      AvgRange_1=(spread+High[Counter+1]+Low[Counter+1])/2.0;
      if (Close[Counter+1+value2]<AvgRange_1) {
       value4_1=2*AvgRange_1-Low[Counter+1+value2];
     } else {
       value4_1=2*AvgRange_1-spread+High[Counter+1+value2];
     }
      value4_1=NormalizeDouble(value4_1,2);
      //value4_2=UserFunction("JESSD",High[Counter+2],Low[Counter+2],High[Counter+value2],Low


--  作者:jinzhe
--  发布时间:2011/6/9 15:12:21
--  
nani?what\'s this?
--  作者:jinzhe
--  发布时间:2011/6/9 15:15:07
--  

能把大意说一遍吗?


--  作者:阿火
--  发布时间:2011/6/9 21:54:37
--  
有用户函数。用户函数的算法是什么又不知道。让人如何改成金字塔。