繪製趨勢線
Results 1 to 7 of 7

Thread: 繪製趨勢線

  1. #1
    有人可以幫助我這個代碼。它並沒有完全正確地繪製趨勢線。或者如果有人有更好的方法,請告訴我。
    插入代碼#property indior_chart_window #property indior_buffers 2 extern int varExtDepth = 12; extern int varExtDeviation = 5; extern int varExtBackstep = 3;雙層天花板#91;#93 ;;雙層#91;#93 ;; int init(){//---- indiors IndiorBuffers(2); IndiorDigits(位);/----繪圖設置//---- indior buffers映射SetIndexBuffer(0,ceiling); SetIndexBuffer(1,地板); SetIndexLabel(0,Upper band); SetIndexLabel(1,Lower band); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); ArraySetAsSeries(天花板,TRUE); ArraySetAsSeries(地板,真正的);/---- return(0); } int deinit(){//---- ObjectDelete(Ceiling); ObjectDelete(地板);/---- return(0); } int start(){//int counted_bars = IndiorCounted();/---- int shift; bool varNewBar = funcIsNewBar(Period()); if(varNewBar){ObjectDelete(Ceiling); ObjectDelete(地板); procDrawTrends(); for(shift = Bars-1; shiftgt; = 0; shift--){ceiling#91; shift#93; = ObjectGetValueByShift(Ceiling,shift);樓層#91;移#93; = ObjectGetValueByShift(地板,移);返回(0); }/ ---------------------------------------------- -------------------- void procDrawTrends(){int ZigZagHighCount = 0,ZigZagLowCount = 0,ZigZagCount = 0; int ZigZagShift = 0;雙ZZHigh#91; 2#93 ;, ZZLow#91; 2#93 ;; datetime ZZHTime#91; 2#93 ;, ZZLTime#91; 2#93 ;; while(ZigZagHighCount lt; 3 ZigZagLowCount lt; 3){double ZigZag = iCustom(NULL,0,ZigZag,varExtDepth,varExtDeviation,varExtBackstep,0,ZigZagShift); if((ZigZag == High#91; ZigZagShift#93; || ZigZag == Low#91; ZigZagShift#93;)ZigZagCount == 0){ZigZagCount ; ZigZagShift ;} else {if(ZigZag == High#91; ZigZagShift#93;){ZZHigh#91; ZigZagHighCount#93; = ZigZag; ZZHTime#91;#ZigZagHighCount 93; = ITIME(NULL,0,ZigZagShift); ZigZagHighCount ; ZigZagCount ; }/如果(ZigZag == Low#91; ZigZagShift#93;){ZZLow#91; ZigZagLowCount#93; = ZigZag; ZZLTime#91;#ZigZagHighCount 93; = ITIME(NULL,0,ZigZagShift); ZigZagLowCount ; ZigZagCount ; ZigZagShift ; } ObjectCreate(Ceiling,OBJ_TREND,0,ZZHTime#91; 1#93;,ZZHigh#91; 1#93;,ZZHTime#91; 0#93;,ZZHigh#91; 0#93;); ObjectCreate(樓OBJ_TREND,0,#ZZLTime 91; 1#93;,ZZLow#91; 1#93;,ZZLTime#91; 0#93;,ZZLow#91; 0#93);對象集(天花板,OBJPROP_STYLE,STYLE_SOLID);對象集(樓OBJPROP_STYLE,STYLE_SOLID);對象集(天花板,OBJPROP_WIDTH,2);對象集(樓OBJPROP_WIDTH,2);對象集(天花板,OBJPROP_COLOR,藍色);對象集(樓OBJPROP_COLOR,紅色);對象集(天花板,OBJPROP_RAY,真正的);對象集(樓OBJPROP_RAY,真正的);/---- string varMessage,n = \ n; varMessage = StringConenate(ZigZagCount:,ZigZagCount,n,ZigZagHighCount :, ZigZagHighCount,n,ZigZagLowCount:,ZigZagLowCount,n,ZZHTime#91; 0#93;:,funcSetDateTime(ZZHTime#91; 0#93;),n,ZZHigh#91; 0#93;:,ZZHigh#91; 0#93;,n, ZZHTime#91; 1#93;:,funcSetDateTime(ZZHTime#91; 1#93;),n,ZZHigh#91; 1#93;:,ZZHigh#91; 1#93;,n,ZZLTime#91; 0 #93;:,funcSetDateTime(ZZLTime#91; 0#93;),n,ZZLow#91; 0#93;:,ZZLow#91; 0#93;,n,ZZLTime#91; 1#93;:, funcSetDateTime(ZZLTime#91; 1#93;),n,ZZLow#91; 1#93;:,ZZLow#91; 1#93;);評論(varMessage);返回(0); } string funcSetDateTime(datetime varTime){datetime curtime = varTime; int theday = TimeDay(curtime); int themonth = TimeMonth(curtime); int theyear = TimeYear(curtime); int thehour = TimeHour(curtime); int theminute = TimeMinute(curtime); string thedate = StringConenate(themonth,/,theday,/,theyear,thehour,:,theminute);返回(thedate); }/ ----------------------支持funcion(s)------------------- ----- bool funcIsNewBar(int timeFrame){bool res = false;/數組包含當前(零)條的開放時間//對於7(七)個時間幀靜態日期時間_sTime#91; 7#93 ;; int i = 6;/注意:下面我將是6或時間框架將是一天。 switch(timeFrame){case 1:i = 0;打破;案例5:i = 2;打破;案例15:i = 3;打破;案例30:i = 4;打破;案例60:i = 5;打破;案例240:休息;案例1440:休息;默認值:timeFrame = 1440; }/----如果(_sTime#91;我#93; == 0 || _sTime#91;我#93;!= iTime(符號(),timeFrame,0)){_ sTime#91;我# 93; = iTime(符號(),timeFrame,0); RES = TRUE; }/---- return(res); }

  2. #2
    2附件這裡是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...
    https://www.forex-pedia.com/cryptocu...rogrammer.html
    https://www.forex-pedia.com/attachme...1743879648.mq4

  3. #3
    謝謝。這比我想出的更有意義。我只需要添加一些東西,我會很好。再次感謝!
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...

  4. #4
    有沒有辦法跟踪哪個趨勢基於峰值,哪個趨勢基於“山谷”?他們交叉時我需要知道這一點。
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...

  5. #5

  6. #6

    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...
    Sangmane,快速問題。如果我想要一個簡單的趨勢線從曲折的底部/頂部但基於手動變量參數怎麼辦?那麼,我有頂級之字形,然後趨勢線x小時未來和x點?或多個趨勢線,但僅限於最後一個主要頂部或底部。謝謝!

  7. #7
    Sangmane,你能看看我剛發布的印象嗎?我似乎無法從行中提取正確的值(在代碼中)。
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...
    Quote Originally Posted by ;
    這是我剛剛創建的基於zigzsag的趨勢線。使用一點點不同的算法,試圖讓它成為Zuper Zimple ...

發布權限

  • 您不可發布新主題
  • 您不可回复
  • 您不可發布附件
  • 您不可編輯您的帖子
  •  
  • BB代碼是打開的
  • 表情符號是打開的
  • [IMG]代碼是打開的
  • [視頻]代碼是打開的
  • HTML代碼是關閉的
forex-pedia網站使用cookie 文字跟蹤
forex-pedia.com網站使用cookie 文字跟蹤,某些設定已經固定。您可以點擊此處閱讀我們的Cookie使用說明。 請點擊右鍵接受我們的cookies。如果您選擇繼續使用forex-pedia.com網站,我們將認為您接受我們的cookies。