Commit cdd88bd1 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 4f721bd1
......@@ -20,6 +20,7 @@ function run(data, config,risk) {
let profit = 0
let lastCom = 0
let lastMoney = 0
let levels=[]
for (let i = 0; i < data.length; i++) {
if (step === 0)
......@@ -50,6 +51,7 @@ function run(data, config,risk) {
if (step > maxLevel)
maxLevel = step
if (d.done === true) {
levels.push(step)
step = 0
reserv = 0
profit = 0
......@@ -72,6 +74,13 @@ function run(data, config,risk) {
maxAllocatedMoney=maxAllocatedMoney*config.param
}
let newLevel=[]
for (let i=0;i<maxLevel;i++)
{
let count=counter(i,levels)
newLevel.push({level:i,count:count})
}
let dur = getMinDiff(data[0].openDate, data[data.length - 1].closeDate)
......@@ -134,7 +143,8 @@ function run(data, config,risk) {
avgProfitPerDay: newT,
allocatedReserve: (maxAllocatedMoney) / Math.abs(maxReserve),
minus: minus,
risk:risk
risk:risk,
levels:newLevel
}
......@@ -146,6 +156,18 @@ function run(data, config,risk) {
// console.log(data)
}
function counter(count,array)
{
let sum=0
for (let i=0;i<array;i++)
if (array[i] === count)
sum++
return sum
}
function percentage2(base, per) {
base = parseFloat(base)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment