Commit fc9d4c70 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 68b1afef
......@@ -34,7 +34,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let curDrawDown = 0
let maxAllocatedMoney = 0
let maxLevel = 0
let maxRuntime=0
let maxRuntime = 0
let realProfit = 0
// console.log(data)
......@@ -190,11 +190,11 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
if (step !== 0)
runnigTime = runnigTime + (unixMid - unixStart)
runnigTime=runnigTime/3600
runnigTime = runnigTime / 3600
if (needPrintData)
obj.runnigTime = runnigTime
maxRuntime=maxRuntime+runnigTime
maxRuntime = maxRuntime + runnigTime
listDays.push(endDays)
......@@ -358,7 +358,7 @@ runnigTime=runnigTime/3600
dur: dur,
maxDays: maxDays,
avgDays: s,
maxRuntime:(maxRuntime)/60,
maxRuntime: (maxRuntime) / 60,
allLoss: allLoss,
totalFinal: oldTotalFinal,
totalPlus: totalPlus,
......@@ -518,7 +518,6 @@ function inlineCheck(money, com, data, profit, lastCom, tar, riskFree, targetPer
}
function percentageAdv(base, per) {
base = parseFloat(base)
......@@ -592,7 +591,8 @@ function calculateRunnigTime(side, startTime, endTime, targetPrice) {
let arr = grabData(startTime, endTime)
for (let i = 0; i < arr.length; i++) {
if (arr[i].h === 0)
continue
if (side === 'LONG') {
if (targetPrice <= arr[i].h)
return timeFrame * (i + 1)
......@@ -611,10 +611,10 @@ function calculateRunnigTime(side, startTime, endTime, targetPrice) {
function grabData(start, end) {
let arr = []
let indexStart = false
let startIndex=(start -candles[0].t)/timeFrame
let endIndex=(end -candles[0].t)/timeFrame
console.log(startIndex)
console.log('line:'+endIndex +' with end'+end)
let startIndex = (start - candles[0].t) / timeFrame
let endIndex = (end - candles[0].t) / timeFrame
// console.log(startIndex)
// console.log('line:'+endIndex +' with end'+end)
for (let i = startIndex; i <= endIndex; i++) {
if (indexStart && candles[i].t <= end)
arr.push(candles[i])
......
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