Commit 185f92b8 authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent 444384e8
...@@ -166,7 +166,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -166,7 +166,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let avgRunup = 0 let avgRunup = 0
let avgDrawdown = 0 let avgDrawdown = 0
let avgProfit = 0 let avgProfit = 0
let tempAlldonePer=0 let tempAlldonePer = 0
// console.log(data) // console.log(data)
...@@ -575,9 +575,6 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -575,9 +575,6 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
baseCompund = baseCompund + percentage2(baseCompund, data[i].profit - 0.1) baseCompund = baseCompund + percentage2(baseCompund, data[i].profit - 0.1)
if (data[i].side === 'LONG') { if (data[i].side === 'LONG') {
allLongDone++ allLongDone++
...@@ -765,9 +762,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -765,9 +762,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
lossDonePer = lossDonePer + data[i].profit - 0.1 lossDonePer = lossDonePer + data[i].profit - 0.1
} }
allDonePer = allDonePer + data[i].profit - 0.1 allDonePer = allDonePer + data[i].profit - 0.1
if (allDonePer >0 && tempAlldonePer<allDonePer) if (allDonePer > 0 && tempAlldonePer < allDonePer) {
{ tempAlldonePer = allDonePer
tempAlldonePer=allDonePer
allDoneCount++ allDoneCount++
} }
...@@ -932,6 +928,14 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -932,6 +928,14 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
sum = sum - Math.abs(maxAllocatedMoney) sum = sum - Math.abs(maxAllocatedMoney)
let newCompund = sum / dur let newCompund = sum / dur
let newBasePerComp=allDonePer/allDoneCount
let lastSumCompound=100
for (let z=0;z<allDoneCount;z++)
{
lastSumCompound=lastSumCompound+percentage2(lastSumCompound,newBasePerComp)
}
let compoundPerMonth = (newCompund * 30 * 100) / Math.abs(maxAllocatedMoney) let compoundPerMonth = (newCompund * 30 * 100) / Math.abs(maxAllocatedMoney)
let drawDown = Math.abs(((maxReserve * 100) / maxAllocatedMoney)) let drawDown = Math.abs(((maxReserve * 100) / maxAllocatedMoney))
...@@ -947,7 +951,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -947,7 +951,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
maxReseve: baseDrawDown, maxReseve: baseDrawDown,
maxMeta: baseMeta, maxMeta: baseMeta,
dur: dur, dur: dur,
upperCount:allDoneCount, upperCount: allDoneCount,
allLongDone: allLongDone, allLongDone: allLongDone,
allLongDonePer: allLongDonePer, allLongDonePer: allLongDonePer,
allShortDone: allShortDone, allShortDone: allShortDone,
...@@ -972,7 +976,7 @@ upperCount:allDoneCount, ...@@ -972,7 +976,7 @@ upperCount:allDoneCount,
allLoss: allLoss, allLoss: allLoss,
totalFinal: oldTotalFinal, totalFinal: oldTotalFinal,
totalPlus: totalPlus, totalPlus: totalPlus,
totalCompound: baseCompund/1000, totalCompound: lastSumCompound,
compoundPerMonth: (baseCompund / dur) * 30, compoundPerMonth: (baseCompund / dur) * 30,
profitPerMonth: Math.abs(profitPerMonth), profitPerMonth: Math.abs(profitPerMonth),
...@@ -1193,6 +1197,7 @@ function percentage(base, per) { ...@@ -1193,6 +1197,7 @@ function percentage(base, per) {
let temp = base * percentager let temp = base * percentager
return base + temp return base + temp
} }
function percentage2(base, per) { function percentage2(base, per) {
base = parseFloat(base) 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