[
{
"id": "95283eaf.abcaf",
"type": "inject",
"z": "3e144ca1.3f13a4",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 570,
"y": 240,
"wires": [
[
"2674a71b.6a8ca8"
]
]
},
{
"id": "2674a71b.6a8ca8",
"type": "function",
"z": "3e144ca1.3f13a4",
"name": "",
"func": "msg.payload =\n{\n \"c\": [\n 206,\n 205.4,\n 204.8,\n 204.5,\n 203.5,\n ],\n \"h\": [\n 206,\n 205.6,\n 204.8,\n 204.5,\n 203.5,\n ],\n \"l\": [\n 206,\n 205.4,\n 204.8,\n 204.5,\n 203.5,\n ],\n \"o\": [\n 206,\n 205.6,\n 204.8,\n 204.5,\n 203.5,\n ],\n \"s\": \"ok\",\n \"sma\": [\n 0,\n 0,\n 0,\n 0,\n 0,\n ],\n \"t\": [\n 1616151720,\n 1616151780,\n 1616151840,\n 1616151900,\n 1616151960,\n ],\n \"v\": [\n 255,\n 1700,\n 810,\n 537,\n 430,\n ]\n};\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 750,
"y": 240,
"wires": [
[
"1437a94f.c29b07",
"89d665a6.48fff8"
]
]
},
{
"id": "1437a94f.c29b07",
"type": "change",
"z": "3e144ca1.3f13a4",
"name": "",
"rules": [
{
"t": "set",
"p": "mainArray",
"pt": "global",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 970,
"y": 240,
"wires": [
[]
]
},
{
"id": "fff9179b.7408b8",
"type": "function",
"z": "3e144ca1.3f13a4",
"name": "SMA21",
"func": "BT = global.get(\"BackTestSMA21\")\nTest = msg.payload;\nc = Test.c.slice(0,BT);\nh = Test.h.slice(0,BT);\nl = Test.l.slice(0,BT);\no = Test.o.slice(0,BT);\nsma = Test.sma.slice(0,BT);\nt = Test.t.slice(0,BT);\nv = Test.v.slice(0,BT);\nmsg.payload.c = c;\nmsg.payload.h = h;\nmsg.payload.l = l;\nmsg.payload.o = o;\nmsg.payload.sma = sma;\nmsg.payload.t = t;\nmsg.payload.v = v;\n//msg.payload = Test;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 910,
"y": 380,
"wires": [
[
"39e521af.58e7be"
]
]
},
{
"id": "6860c307.f3af4c",
"type": "function",
"z": "3e144ca1.3f13a4",
"name": "Array Step through",
"func": "BackTestOld = global.get(\"BackTestSMA21\");\nif (BackTestOld <= 1){\nBackTestNew = BackTestOld+1;\nglobal.set(\"BackTestSMA21\",BackTestNew);\nmsg.payload = BackTestNew;\nreturn msg;\n}\nif (BackTestOld >= 0){\nmsg.payload = \"close\";\nmsg.topic = \"control\";\nreturn msg;\n}",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 820,
"y": 320,
"wires": [
[
"2d8b5d74.f7f912"
]
]
},
{
"id": "2d8b5d74.f7f912",
"type": "change",
"z": "3e144ca1.3f13a4",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "mainArray",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1030,
"y": 320,
"wires": [
[
"fff9179b.7408b8"
]
]
},
{
"id": "76b47e67.48d15",
"type": "inject",
"z": "3e144ca1.3f13a4",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "1",
"crontab": "",
"once": true,
"onceDelay": "5",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 540,
"y": 320,
"wires": [
[
"6860c307.f3af4c"
]
]
},
{
"id": "89d665a6.48fff8",
"type": "function",
"z": "3e144ca1.3f13a4",
"name": "BackTest global",
"func": "BackTest = msg.payload.sma.length;\nMinus = -BackTest+1;\nglobal.set(\"BackTestSMA21\", Minus);\nmsg.payload = BackTest;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 970,
"y": 180,
"wires": [
[]
]
},
{
"id": "677a5530.c8e86c",
"type": "debug",
"z": "3e144ca1.3f13a4",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1290,
"y": 180,
"wires": []
},
{
"id": "39e521af.58e7be",
"type": "change",
"z": "3e144ca1.3f13a4",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "mainArray",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1100,
"y": 380,
"wires": [
[
"677a5530.c8e86c"
]
]
}
]