Equilibrium reached
This commit is contained in:
1 parent
69cce193bb
commit
4e579df61e
7 files changed
+195
-41
No files matched your search
@@ -64,7 +64,7 @@ function newFloatingObject () {
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize (pType, callBackFunction) {
|
||||
function initialize (pType, floatingLayer, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
|
||||
|
||||
@@ -92,7 +92,7 @@ function newFloatingObject () {
|
||||
|
||||
case 'Strategy Part': {
|
||||
underlayingObject = newStrategyPart()
|
||||
underlayingObject.initialize(onInitialized)
|
||||
underlayingObject.initialize(floatingLayer, onInitialized)
|
||||
|
||||
function onInitialized (err) {
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ function newNoteSets () {
|
||||
*/
|
||||
|
||||
let floatingObject = newFloatingObject()
|
||||
floatingObject.initialize('Note', onInitialized)
|
||||
floatingObject.initialize('Note', floatingLayer, onInitialized)
|
||||
|
||||
function onInitialized (err) {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] createNoteSet -> onNotesChanged -> Add new Notes -> onInitialized -> Entering function.') }
|
||||
|
||||
@@ -41,7 +41,7 @@ function newProfileBalls () {
|
||||
|
||||
function createNewProfileBall (pPayload, callBackFunction) {
|
||||
let floatingObject = newFloatingObject()
|
||||
floatingObject.initialize('Profile Ball', onInitialized)
|
||||
floatingObject.initialize('Profile Ball', floatingLayer, onInitialized)
|
||||
|
||||
function onInitialized (err) {
|
||||
floatingObject.payload = pPayload
|
||||
|
||||
@@ -51,9 +51,13 @@ function newStrategyPart () {
|
||||
}
|
||||
]
|
||||
|
||||
let floatingLayer
|
||||
|
||||
return thisObject
|
||||
|
||||
function initialize (callBackFunction) {
|
||||
function initialize (pFloatingLayer, callBackFunction) {
|
||||
floatingLayer = pFloatingLayer
|
||||
|
||||
for (let i = 0; i < ballStringMenu.length; i++) {
|
||||
let menuItem = ballStringMenu[i]
|
||||
|
||||
@@ -168,6 +172,17 @@ function newStrategyPart () {
|
||||
}
|
||||
|
||||
function drawBackground (pFloatingObject) {
|
||||
/* Here we do the trick of recalculation the position of the anchor by setting it to the position of its parent */
|
||||
|
||||
if (pFloatingObject.payload.parentNode !== undefined) {
|
||||
let parentFloatingObject = floatingLayer.getFloatingObject(pFloatingObject.payload.parentNode.handle)
|
||||
|
||||
pFloatingObject.payload.profile.position.x = parentFloatingObject.currentPosition.x
|
||||
pFloatingObject.payload.profile.position.y = parentFloatingObject.currentPosition.y
|
||||
}
|
||||
|
||||
/* Here I continue painting the background */
|
||||
|
||||
let point = {
|
||||
x: pFloatingObject.payload.profile.position.x,
|
||||
y: pFloatingObject.payload.profile.position.y
|
||||
|
||||
@@ -32,19 +32,73 @@ function newStrategyParts () {
|
||||
floatingLayer = pFloatingLayer
|
||||
}
|
||||
|
||||
function createNewStrategyPart (pPayload, callBackFunction) {
|
||||
function createNewStrategyPart (type, pPayload, callBackFunction) {
|
||||
let floatingObject = newFloatingObject()
|
||||
floatingObject.initialize('Strategy Part', onInitialized)
|
||||
floatingObject.initialize('Strategy Part', floatingLayer, onInitialized)
|
||||
|
||||
function onInitialized (err) {
|
||||
floatingObject.payload = pPayload
|
||||
|
||||
floatingObject.friction = 0.995
|
||||
switch (type) {
|
||||
case 'Strategy': {
|
||||
level_1()
|
||||
break
|
||||
}
|
||||
case 'Strategy Entry': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Strategy Exit': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Trade Entry': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Trade Exit': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Stop': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
case 'Take Profit': {
|
||||
level_2()
|
||||
break
|
||||
}
|
||||
default: {
|
||||
level_3()
|
||||
}
|
||||
}
|
||||
|
||||
floatingObject.initializeMass(50)
|
||||
floatingObject.initializeRadius(15)
|
||||
floatingObject.initializeImageSize(25)
|
||||
floatingObject.initializeFontSize(10)
|
||||
function level_1 () {
|
||||
floatingObject.friction = 0.9
|
||||
|
||||
floatingObject.initializeMass(100)
|
||||
floatingObject.initializeRadius(50)
|
||||
floatingObject.initializeImageSize(60)
|
||||
floatingObject.initializeFontSize(10)
|
||||
}
|
||||
|
||||
function level_2 () {
|
||||
floatingObject.friction = 0.85
|
||||
|
||||
floatingObject.initializeMass(50)
|
||||
floatingObject.initializeRadius(30)
|
||||
floatingObject.initializeImageSize(50)
|
||||
floatingObject.initializeFontSize(10)
|
||||
}
|
||||
|
||||
function level_3 () {
|
||||
floatingObject.friction = 0.8
|
||||
|
||||
floatingObject.initializeMass(10)
|
||||
floatingObject.initializeRadius(10)
|
||||
floatingObject.initializeImageSize(50)
|
||||
floatingObject.initializeFontSize(10)
|
||||
}
|
||||
|
||||
floatingObject.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 0.5)'
|
||||
floatingObject.labelStrokeStyle = 'rgba(60, 60, 60, 0.50)'
|
||||
@@ -59,4 +113,3 @@ function newStrategyParts () {
|
||||
floatingLayer.killFloatingObject(pFloatingObjectHandle)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user