Czy ktoś może mi pomóc wtym kodzie? Nie całkiem narysuje linii trendu. Lub jeśli ktoś ma lepszy sposób, proszę dać mi znać.
Wstawiony kod #property indior_chart_window #property indior_buffers 2 zewnętrzne int varExtDepth = 12; extern int varExtDeviation = 5; extern int varExtBackstep = 3; podwójny sufit # 91; # 93 ;; podwójna podłoga # 91; # 93 ;; int init () {//---- indiors IndiorBuffers (2); IndiorDigits (cyfry);/---- ustawienia rysunków/---- odwzorowanie buforów indioralnych SetIndexBuffer (0, pułap); SetIndexBuffer (1, piętro); SetIndexLabel (0, górny zakres); SetIndexLabel (1, Lower band); SetIndexEmptyValue (0,0.0); SetIndexEmptyValue (1,0.0); ArraySetAsSeries (pułap, prawda); ArraySetAsSeries (floor, true);/---- return (0); } int deinit () {//---- ObjectDelete (Ceiling); ObjectDelete (piętro);/---- return (0); } int start () {//int counted_bars = IndiorCounted ();/---- int shift; bool varNewBar = funcIsNewBar (Period ()); if (varNewBar) {ObjectDelete (pułap); ObjectDelete (piętro); procDrawTrends (); for (shift = Bars-1; shiftgt; = 0; shift-) {ceiling # 91; shift # 93; = ObjectGetValueByShift (Ceiling, shift); floor # 91; shift # 93; = ObjectGetValueByShift (piętro, przesunięcie); }} return (0); }/ ---------------------------------------------- -------------------- void procDrawTrends () {int ZigZagHighCount = 0, ZigZagLowCount = 0, ZigZagCount = 0; int ZigZagShift = 0; podwójne 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 ; }/wykonaj odwrotnie, jeśli: (ZigZag == Low # 91; ZigZagShift # 93;) {ZZLow # 91; ZigZagLowCount # 93; = ZigZag; ZZLTime # 91; ZigZagHighCount # 93; = iTime (NULL, 0, ZigZagShift); ZigZagLowCount ; ZigZagCount ; }} ZigZagShift ; } ObjectCreate (Pułap, OBJ_TREND, 0, ZZHTime # 91; 1 # 93;, ZZHigh # 91; 1 # 93;, ZZHTime # 91; 0 # 93;, ZZHigh # 91; 0 # 93;); ObjectCreate (Floor, OBJ_TREND, 0, ZZLTime # 91; 1 # 93;, ZZLow # 91; 1 # 93;, ZZLTime # 91; 0 # 93;, ZZLow # 91; 0 # 93;); ObjectSet (sufit, OBJPROP_STYLE, STYLE_SOLID); ObjectSet (Floor, OBJPROP_STYLE, STYLE_SOLID); ObjectSet (Ceiling, OBJPROP_WIDTH, 2); ObjectSet (Floor, OBJPROP_WIDTH, 2); ObjectSet (Ceiling, OBJPROP_COLOR, Blue); ObjectSet (Floor, OBJPROP_COLOR, Red); ObjectSet (Ceiling, OBJPROP_RAY, true); ObjectSet (Floor, OBJPROP_RAY, true);/---- 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;); Komentarz (varMessage); return (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); return (thedate); }/ ---------------------- Funkcje wsparcia ------------------- ----- bool funcIsNewBar (int timeFrame) {bool res = false;/tablica zawiera czas otwarty bieżącego (zerowego) paska/dla 7 (siedmiu) ram czasowych statycznych datetime _sTime # 91; 7 # 93 ;; int i = 6;/Uwaga: poniżej przedstawiam 6, a przedział czasowy to dzień. switch (timeFrame) {case 1: i = 0; złamać; przypadek 5: i = 2; złamać; przypadek 15: i = 3; złamać; przypadek 30: i = 4; złamać; obudowa 60: i = 5; złamać; obudowa 240: przerwa; obudowa 1440: przerwa; default: timeFrame = 1440; }/---- if (_sTime # 91; i # 93; == 0 || _sTime # 91; i # 93;! = iTime (Symbol (), timeFrame, 0)) {_sTime # 91; i # 93; = iTime (Symbol (), timeFrame, 0); res = true; }/---- return (res); }