Commit efb286d8 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent bcf12783
......@@ -40,6 +40,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let lastMoney = 0
let maxMetaStep = 0
let levels = []
let targets=[]
let detailLevel = []
let durDetail = []
......@@ -173,6 +174,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
listDays.push(endDays)
realProfit = realProfit + d.realProfit
targets.push(d.realProfit)
// console.log(maxDays)
levels.push(step)
step = 0
......@@ -308,13 +310,12 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
// percentage2 = null
// }
let perp = (config.target * 100) / Math.abs(maxAllocatedMoney)
perp = perp / 100
let sum = Math.abs(maxAllocatedMoney)
for (let i = 0; i < total; i++)
sum = sum + (sum * perp)
sum = sum + (sum * getperp(targets[i],maxAllocatedMoney))
sum = sum - Math.abs(maxAllocatedMoney)
let newCompund = sum / dur
......@@ -376,6 +377,13 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
// console.log(data)
}
function getperp(target,maxAllocatedMoney)
{
let perp = (target * 100) / Math.abs(maxAllocatedMoney)
perp = perp / 100
return perp
}
function counter(count, array) {
let sum = 0
......
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