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