From e0faaa6ca8c515c502fe7e823867e5944875104f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sun, 29 Apr 2018 17:18:48 +0200 Subject: [PATCH] Bugs fixed with Line --- .vs/Plotters-Trading/v15/.suo | Bin 26112 -> 26112 bytes History.js | 110 +++++++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 2 deletions(-) diff --git a/.vs/Plotters-Trading/v15/.suo b/.vs/Plotters-Trading/v15/.suo index ef729813fbb889af55e3dfe4f4f21100ff784d26..8b64b92127ef6e7b616acade86705e4a8f114ec2 100644 GIT binary patch delta 1311 zcmd5*Ur19?7(eIirgwL{HJzE}bWUf8e_+#!l3GI-q$QJV-px&LsbmyUwuwp5pqC)Y zx$ij`vxlIF>h##d4TBz17WC3vy_ZllA$w?j$A(Bm&9@Hs$N8P#cfUX9JLe>pX=0fs zUA2r9hJ_FbDMkFq=kr1}z>6{KlhIF<)`NrDRafxie*OJhx*Kg?xW@Wm$>63DSYtQY z6$-PZeNqXUV0o;qB!J`*h3|%j_FYI71V+v8#94$F!-Tv7As1{yQ+cmsV1;~-N4~DS z-e$hi7S+5Zo)z43qgt~?F+x<SwqY^m$LcfCak)=P&veGe(15e z!Nny0%_h@7`PBJj1O6|XD|X9cb$)83;=bXv+mIk<&x#a0*SwPgtLz4!)kRw%UO6c4 z6XYrrv>xJn{IWP5wcxeGj)cK_&B?#jbc+5fJI^&`St0#^v8dG4&eu9k($lVaiLDS= z@H~Xe9y_ca3zS94I5|%)k#i(MVq_9G=sw$u7Ax2LrkQe>93baT7Oyd<|8J=gS-wdXaVpJ>c8h(^!Ar*dZn>-zeagQZbLXaCWl_*W2Y%dh@A-f3xi|a_!p~sD zg*la`!W=;`2!a5F$wVSSOOhYmbO$g2Es%xRN^IhWc*U{t7ciHkVLZ%y_(XKW08X$I zj4?c-Yr-eYZRjNND~4Zn4%tj>Hi29wvS>A?cpgI{K0meR@;PdgUdKR(c2+9&<<$6U zDAasXm^GA7q?83)${wFv7f#2`TqfnE&beO`x{YNL=h7r%zp=woNjfVudMnjO`f7-n z59OEAsf}PK@Ju=IoY|VQj1DRY&XfS}nMX{UY12k%N4q&s-b&myLKmT%u$|CD=q2mxO7KSnm z+5JBaNrr>;7=E$%B;XNrTC-rTf9jM!g>-y1o-67iRu7I@T^O|b`G}*7>DAAUW=LKO zcR8&cEcQcEC0-Jna#p4l#}|n3OK054tj^TUa8989qb?2dtmwCfumHEz+V{?@V$4{ z-8uz+W4^i0rS4yA0JFQw+MrYibkoEcsZ@4${kfep9vpWJ`PFRjn_)^aIB~* zn;&!PjPcJ*z|-Y5k*zNNsR`={{6`~F6TQGxrNjPjJmLFV=XCokG6f-nV(i25u11V@ z=SJG|vA(hZM~deCa8nfvtCyC)yFWU-T7IZ}zEfO&h9}48N=rCg;W} zFKOkYT3`}{2lPrm(2w(p`oZYI87(tTNF_-ZVrO=-L$LVhm5;@>SI2H*Yx_y(!OMf= ur(VO;9l=0zOXC|#e8w=H!IU|5@?u~ 0) { + + lastSellRate = newHistoryRecord.lastSellRate; + lastSellDate = newHistoryRecord.date; + + } + + if (newHistoryRecord.sellExecRate > 0) { + + let newLine = { + type: "sell", + x1: lastSellDate, + y1: lastSellRate, + x2: newHistoryRecord.date, + y2: newHistoryRecord.sellExecRate + }; + + lines.push(newLine); + + } + + if (newHistoryRecord.lastBuyRate > 0) { + + lastBuyRate = newHistoryRecord.lastBuyRate; + lastBuyDate = newHistoryRecord.date; + + } + + if (newHistoryRecord.buyExecRate > 0) { + + let newLine = { + type: "buy", + x1: lastBuyDate, + y1: lastBuyRate, + x2: newHistoryRecord.date, + y2: newHistoryRecord.buyExecRate + }; + + lines.push(newLine); + + } + } } plotElements.push(history); + plotLines.push(lines); } thisObject.container.eventHandler.raiseEvent("History Changed", history); @@ -258,7 +317,6 @@ browserCanvasContext.stroke(); - /* Draw a red inverted triangle on exec sell */ if (record.sellExecRate > 0) { @@ -497,6 +555,54 @@ thisObject.profile.visible = true; } + /* Draw the lines connecting plot elements. */ + + let lines = plotLines[j]; + + for (let i = 0; i < lines.length; i++) { + + let line = lines[i]; + + opacity = '0.5'; + + let point1 = { + x: line.x1, + y: line.y1 + }; + + let point2 = { + x: line.x2, + y: line.y2 + }; + + point1 = timeLineCoordinateSystem.transformThisPoint(point1); + point1 = transformThisPoint(point1, thisObject.container); + point1 = viewPort.fitIntoVisibleArea(point1); + + point2 = timeLineCoordinateSystem.transformThisPoint(point2); + point2 = transformThisPoint(point2, thisObject.container); + point2 = viewPort.fitIntoVisibleArea(point2); + + browserCanvasContext.beginPath(); + + browserCanvasContext.moveTo(point1.x, point1.y); + browserCanvasContext.lineTo(point2.x, point2.y); + + browserCanvasContext.closePath(); + + if (line.type === "sell") { + + browserCanvasContext.strokeStyle = 'rgba(130, 9, 9, ' + opacity + ')'; + + } else { + + browserCanvasContext.strokeStyle = 'rgba(27, 105, 7, ' + opacity + ')'; + + } + + browserCanvasContext.stroke(); + + } } /*