請(qǐng)老師改寫一個(gè)指標(biāo) [文華財(cái)經(jīng)]

  • 咨詢內(nèi)容: 請(qǐng)老師把這段代碼改成文華版本的

    //+------------------------------------------------------------------+  

    //|?????????????????????????????????????????????? ?????Parabolic.mq4 |  

    //|?????????????????? Copyright 2005-2014, MetaQuotes Software Corp. |  

    //|????????????????????????????????????????????? http://www.mql4.com |  

    //+------------------------------------------------------------------+  

    #property copyright?? "2005-2014, MetaQuotes Software Corp."  

    #property link??????? "http://www.mql4.com"  

    #property description "Parabolic Stop-And-Reversal system"  

    #property strict  

    ?

    //--- indicator settings  

    #property indicator_chart_window  

    #property indicator_buffers 1  

    #property indicator_color1? Lime  

    //--- input parameters  

    input double InpSARStep=0.02;??? // Step  

    input double InpSARMaximum=0.2;? // Maximum  

    //---- buffers  

    double?????? ExtSARBuffer[];  

    //--- global variables  

    double?????? ExtSarStep;  

    double?????? ExtSarMaximum;  

    int????????? ExtLastReverse;  

    bool???????? ExtDirectionLong;  

    double?????? ExtLastStep,ExtLastEP,ExtLastSAR;  

    double?????? ExtLastHigh,ExtLastLow;  

    //+------------------------------------------------------------------+  

    //| Custom indicator initialization function???????????????????????? |  

    //+------------------------------------------------------------------+  

    void OnInit()  

    ? {  

    //--- checking input data  

    ?? if(InpSARStep<0.0)  

    ???? {  

    ????? ExtSarStep=0.02;  

    ????? Print("Input parametr InpSARStep has incorrect value. Indicator will use value ",  

    ??????????? ExtSarStep," for calculations.");  

    ???? }  

    ?? else  

    ????? ExtSarStep=InpSARStep;  

    ?? if(InpSARMaximum<0.0)  

    ???? {  

    ????? ExtSarMaximum=0.2;  

    ????? Print("Input parametr InpSARMaximum has incorrect value. Indicator will use value ",  

    ??????????? ExtSarMaximum," for calculations.");  

    ???? }  

    ?? else  

    ????? ExtSarMaximum=InpSARMaximum;  

    //--- drawing settings  

    ?? IndicatorDigits(Digits);  

    ?? SetIndexStyle(0,DRAW_ARROW);  

    ?? SetIndexArrow(0,159);  

    //---- indicator buffers  

    ?? SetIndexBuffer(0,ExtSARBuffer);  

    //--- set short name  

    ?? IndicatorShortName("SAR("+DoubleToString(ExtSarStep,2)+","+DoubleToString(ExtSarMaximum,2)+")");  

    //--- set global variables  

    ?? ExtLastReverse=0;  

    ?? ExtDirectionLong=false;  

    ?? ExtLastStep=ExtLastEP=ExtLastSAR=0.0;  

    ?? ExtLastHigh=ExtLastLow=0.0;  

    //----  

    ? }  

    //+------------------------------------------------------------------+  

    //| Parabolic SAR??????????????????????????????????????????????????? |  

    //+------------------------------------------------------------------+  

    int OnCalculate(const int rates_total,  

    ??????????????? const int prev_calculated,  

    ??????????????? const datetime &time[],  

    ??????????????? const double &open[],  

    ??????????????? const double &high[],  

    ??????????????? const double &low[],  

    ??????????????? const double &close[],  

    ??????????????? const long& tick_volume[],  

    ??????????????? const long& volume[],  

    ??????????????? const int& spread[])  

    ? {  

    ?? bool?? dir_long;  

    ?? double last_high,last_low,ep,sar,step;  

    ?? int??? i;  

    //--- check for minimum rates count  

    ?? if(rates_total<3)  

    ????? return(0);  

    //--- counting from 0 to rates_total  

    ?? ArraySetAsSeries(ExtSARBuffer,false);  

    ?? ArraySetAsSeries(high,false);  

    ?? ArraySetAsSeries(low,false);  

    //--- detect current position for calculations   

    ?? i=prev_calculated-1;  

    //--- calculations from start?  

    ?? if(i<1)  

    ???? {  

    ????? ExtLastReverse=0;  

    ????? dir_long=true;  

    ????? step=ExtSarStep;  

    ????? last_high=-10000000.0;  

    ????? last_low=10000000.0;  

    ????? sar=0;  

    ????? i=1;  

    ????? while(i<rates_total-1)  

    ??????? {  

    ???????? ExtLastReverse=i;  

    ? ???????if(last_low>low[i])  

    ??????????? last_low=low[i];  

    ???????? if(last_high<high[i])  

    ??????????? last_high=high[i];  

    ???????? if(high[i]>high[i-1] && low[i]>low[i-1])  

    ??????????? break;  

    ???????? if(high[i]<high[i-1] && low[i]<low[i-1])  

    ?????????? {  

    ????? ??????dir_long=false;  

    ??????????? break;  

    ?????????? }  

    ???????? i++;  

    ??????? }  

    ????? //--- initialize with zero  

    ????? ArrayInitialize(ExtSARBuffer,0.0);  

    ????? //--- go check  

    ????? if(dir_long)  

    ??????? {  

    ???????? ExtSARBuffer[i]=low[i-1];  

    ???????? ep=high[i];  

    ??????? }  

    ????? else  

    ??????? {  

    ???????? ExtSARBuffer[i]=high[i-1];  

    ???????? ep=low[i];  

    ??????? }  

    ????? i++;  

    ???? }  

    ?? else  

    ???? {  

    ????? //--- calculations to be continued. restore last values  

    ????? i=ExtLastReverse;  

    ????? step=ExtLastStep;  

    ????? dir_long=ExtDirectionLong;  

    ????? last_high=ExtLastHigh;  

    ????? last_low=ExtLastLow;  

    ????? ep=ExtLastEP;  

    ????? sar=ExtLastSAR;  

    ???? }  

    //---main cycle  

    ?? while(i<rates_total)  

    ???? {  

    ????? //--- check for reverse  

    ????? if(dir_long && low[i]<ExtSARBuffer[i-1])  

    ??????? {  

    ???????? SaveLastReverse(i,true,step,low[i],last_high,ep,sar);  

    ???????? step=ExtSarStep;  

    ???????? dir_long=false;  

    ???????? ep=low[i];  

    ???????? last_low=low[i];  

    ???????? ExtSARBuffer[i++]=last_high;  

    ???????? continue;  

    ??????? }  

    ????? if(!dir_long && high[i]>ExtSARBuffer[i-1])  

    ??????? {  

    ???????? SaveLastReverse(i,false,step,last_low,high[i],ep,sar);  

    ???????? step=ExtSarStep;  

    ???????? dir_long=true;  

    ???????? ep=high[i];  

    ???????? last_high=high[i];  

    ???????? ExtSARBuffer[i++]=last_low;  

    ???????? continue;  

    ???? ???}  

    ????? //---  

    ????? sar=ExtSARBuffer[i-1]+step*(ep-ExtSARBuffer[i-1]);  

    ????? //--- LONG?  

    ????? if(dir_long)  

    ??????? {  

    ???????? if(ep<high[i])  

    ?????????? {  

    ??????????? if((step+ExtSarStep)<=ExtSarMaximum)  

    ?????????????? step+=ExtSarStep;  

    ?????????? }  

    ?? ??????if(high[i]<high[i-1] && i==2)  

    ??????????? sar=ExtSARBuffer[i-1];  

    ???????? if(sar>low[i-1])  

    ??????????? sar=low[i-1];  

    ???????? if(sar>low[i-2])  

    ??????????? sar=low[i-2];  

    ???????? if(sar>low[i])  

    ?????????? {  

    ??????????? SaveLastReverse(i,true,step,low[i],last_high,ep,sar);  

    ??????????? step=ExtSarStep; dir_long=false; ep=low[i];  

    ??????????? last_low=low[i];  

    ??????????? ExtSARBuffer[i++]=last_high;  

    ??????????? continue;  

    ?????????? }  

    ???????? if(ep<high[i])  

    ??????????? ep=last_high=high[i];  

    ??????? }  

    ???? ?else // SHORT  

    ??????? {  

    ???????? if(ep>low[i])  

    ?????????? {  

    ??????????? if((step+ExtSarStep)<=ExtSarMaximum)  

    ?????????????? step+=ExtSarStep;  

    ?????????? }  

    ???????? if(low[i]<low[i-1] && i==2)  

    ??????????? sar=ExtSARBuffer[i-1];  

    ???????? if(sar<high[i-1])  

    ??????????? sar=high[i-1];  

    ???????? if(sar<high[i-2])  

    ??????????? sar=high[i-2];  

    ???????? if(sar<high[i])  

    ?????????? {  

    ??????????? SaveLastReverse(i,false,step,last_low,high[i],ep,sar);  

    ??????????? step=ExtSarStep;  

    ??????????? dir_long=true;  

    ??????????? ep=high[i];  

    ??????????? last_high=high[i];  

    ??????????? ExtSARBuffer[i++]=last_low;  

    ??????????? continue;  

    ?????????? }  

    ???????? if(ep>low[i])  

    ??????????? ep=last_low=low[i];  

    ??????? }  

    ????? ExtSARBuffer[i++]=sar;  

    ???? }  

    //---- OnCalculate done. Return new prev_calculated.  

    ?? return(rates_total);  

    ? }  

    //+------------------------------------------------------------------+  

    //|? save last values to continue further calculations?????????????? |  

    //+------------------------------------------------------------------+  

    void SaveLastReverse(int reverse,bool dir,double step,double last_low,double last_high,double ep,double sar)  

    ? {  

    ?? ExtLastReverse=reverse;  

    ?? if(ExtLastReverse<2)  

    ????? ExtLastReverse=2;  

    ?? ExtDirectionLong=dir;  

    ?? ExtLastStep=step;  

    ?? ExtLastLow=last_low;  

    ?? ExtLastHigh=last_high;  

    ?? ExtLastEP=ep;  

    ?? ExtLastSAR=sar;  

    ? }  

    //+------------------------------------------------------------------+  

    ?

    ?

    ?來(lái)源:程序化99

  • 文華技術(shù)人員: ?語(yǔ)言差異過(guò)大,我們分析一下是否可以修改,預(yù)計(jì)周五前回復(fù)

    ?

    ?來(lái)源: www.tumamayizhan.com

  • 文華客服: 好的,謝謝

    ?

  • 網(wǎng)友回復(fù): ?我們分析了一下就是sar指標(biāo)的
    您在k線界面右鍵》技術(shù)指標(biāo)》趨勢(shì)分析》sar止損點(diǎn)就可以了

 

有思路,想編寫各種指標(biāo)公式,程序化交易模型,選股公式,預(yù)警公式的朋友

可聯(lián)系技術(shù)人員 QQ: 511411198  點(diǎn)擊這里給我發(fā)消息進(jìn)行 有償 編寫!不貴!點(diǎn)擊查看價(jià)格!


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 91免费国产在线观看| 久精品在线观看| 老司机午夜福利视频| 国产精品国产三级国产普通话| 亚洲另类欧美日韩| 精品一区二区三区av天堂| 国产影片中文字幕| 91久久香蕉国产线看| 毛片网在线观看| 天堂资源最新在线| 久久久精品波多野结衣AV| 欧美无人区码卡二三卡四卡| 全彩本子acg里番本子| 都市激情第一页| 国产精品久久久久电影| bt天堂在线最新版在线| 我被丝袜长腿美女夹得好爽| 九九久久精品国产AV片国产| 欧美精品亚洲精品日韩专区va| 四虎精品1515hh| 黄毛片一级毛片| 国产精品亚洲二区在线播放 | 亚洲伊人久久大香线蕉结合| 男人精品网站一区二区三区| 国产AV无码专区亚洲AV| 成人爽爽激情在线观看| 国产精品综合色区在线观看| jizz免费在线观看| 成人性生交大片免费看好| 久久国产精品亚洲一区二区| 欧美与黑人午夜性猛交久久久| 人人妻人人做人人爽精品| 美女叉开腿让男人捅| 国产午夜片无码区在线播放| 亚洲精品视频在线观看你懂的| 在线观看亚洲一区二区| 一级一黄在线观看视频免费| 日本一区中文字幕日本一二三区视频| 亚洲字幕在线观看| 波多野结衣办公室33分钟| 六月婷婷综合激情|