Commit 16a1e113 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 99af0f80
......@@ -23,7 +23,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
type = type + ' ' + usage + ' ' + fftDiffDrawDownProfit
}
else if (usage ==='fftPercentRunup') {
type = type + ' ' + usage + ' ' + fftPercentRunup
type = type + ' ' + usage + ' Count:' + fftPercentRunup.count +' Percent:'+fftPercentRunup.percent
}
let saveData = []
......
......@@ -38,43 +38,88 @@ async function format(name) {
let newCon = 0
let newCounter = 0
let diffCount = 0
// console.log(res)
let maxRed = 0
let maxGreen=0
let redCounter = 0
let allGreeeCon=0
let greenCounter=0
let maxGreenArray=[]
let maxRedArray=[]
for (let i = 1; i < (res.length - 1); i++) {
let d = res[i].split(',')
try {
let profit = parseFloat(d[8])
con++
allProfit=allProfit+profit
if (profit>=3.4065813474551385)
newCon++
if (profit <= 3.4065813474551385) {
diffCount++
let d = res[i].split(',')
let open = parseFloat(d[1])
let close = parseFloat(d[4])
if (close < open) {
if (greenCounter !==0)
maxGreenArray.push(greenCounter)
if (greenCounter>maxGreen)
maxGreen=greenCounter
greenCounter=0
redCounter++
con++
} else {
if (diffCount >= 38)
newCounter++
diffCount = 0
if (redCounter !==0)
maxRedArray.push(redCounter)
if (redCounter > maxRed)
maxRed = redCounter
redCounter = 0
greenCounter++
allGreeeCon++
}
} catch (e) {
}
}
allProfit=allProfit+(con*0.1)
let avg = (allProfit / con)
avg = avg + 0.1
let newTemp = newCon / con
console.log(newCounter)
let twoCounter=0
// for (let i=0;i<maxRedArray.length;i++)
// if (maxRedArray[i] ===1)
// twoCounter++
console.log('from ' + res.length + ' red ' + con, ' max red:'+maxRed ,' green:'+allGreeeCon +' max green:'+maxGreen)
// console.log('total '+con +' avg runup:'+(allProfit/con))
maxRedArray=_.orderBy(maxRedArray)
maxRedArray=_.reverse(maxRedArray)
// console.log('Max Red Candle Array:')
// console.log(maxRedArray)
maxGreenArray=_.orderBy(maxGreenArray)
maxGreenArray=_.reverse(maxGreenArray)
// console.log('Max Green Candle Array:')
// console.log(maxGreenArray)
let newxGreenArray=[]
for (let i=0;i<maxGreenArray.length;i++)
{
let counter=1
for (let j=0;j<maxGreenArray.length;j++)
if (maxGreenArray[i] ===maxRedArray[j])
counter ++
newxGreenArray.push({item:maxGreenArray[i],count:counter})
}
let newxRedArray=[]
for (let i=0;i<maxRedArray.length;i++)
{
let counter=1
for (let j=0;j<maxRedArray.length;j++)
if (maxRedArray[i] ===maxRedArray[j])
counter ++
newxRedArray.push({item:maxRedArray[i],count:counter})
}
newxGreenArray=_.uniqBy(newxGreenArray, 'item');
newxRedArray=_.uniqBy(newxRedArray, 'item');
console.log('Max Red Candle Array:')
console.log(newxRedArray)
console.log('Max Green Candle Array:')
console.log(newxGreenArray)
}
......
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