Commit d8e09c54 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 21c1432d
......@@ -61,6 +61,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let detailLevel = []
let durDetail = []
let runBefore = false
let canCreateRunupPercent=false
let countDrop = 0
let allLossProfit = 0
......@@ -111,6 +112,26 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
countDropRunup = 0
}
if (usage ==='fftPercentRunup')
{
let temp = 0
for (let z = i + 1; z <= (i + fftPercentRunup.count); z++) {
try {
let runup = data[z].runUp
temp = temp + runup
}
catch (e)
{
}
}
if (temp <= fftPercentRunup.percent) {
canCreateRunupPercent=true
}
}
if (runBefore === false) {
......@@ -127,10 +148,14 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
if (diffDrawdownProfitAll > fftDiffDrawDownProfit)
continue
}
else if (usage ==='fftPercentRunup') {
if (canCreateRunupPercent ===false)
continue
}
}
canCreateRunupPercent=false
runBefore = true
let obj
if (step === 0) {
......
const fs = require('fs')
let moment = require('moment-timezone')
const _ = require('lodash')
init()
async function init() {
try {
await fs.mkdirSync('analyse')
} catch (e) {
}
let files = await fs.readdirSync('analyse')
let prom = []
for (let i = 0; i < files.length; i++) {
if (files[i].includes('.csv')) {
prom.push(format(files[i]))
}
}
await Promise.all(prom)
}
async function format(name) {
let res = await fs.readFileSync('./analyse/' + name, 'utf8');
res = res.match(/.+/g)
// console.log(res.length)
let counter = 0
for (let i = 1; i < (res.length - 1); i++) {
// let d = res[i].split(',')
// try {
//
// let runup = parseFloat(d[8])
// if (runup>=15) {
//
// let temp=0
// for (let z=i-5;z<i;z++)
// {
// let d2 = res[z].split(',')
// let inlineRunup=parseFloat(d2[8])
// temp=temp+inlineRunup
//
// }
// if (temp<15) {
// counter++
// console.log('run up:' + runup + ' with 5 inline runup:' + temp)
// }
//
// }
//
//
//
//
//
// } catch (e) {
//
// }
let temp = 0
for (let z = i + 1; z <= (i + 7); z++) {
try {
let d = res[z].split(',')
let runup = parseFloat(d[8])
temp = temp + runup
}
catch (e)
{
}
}
if (temp <= 10) {
counter++
console.log('run 15 up:'+temp )
}
}
console.log(counter)
}
function createFile(name, body) {
return new Promise(function (resolve, reject) {
fs.writeFile('analyse/' + name, body, 'utf8', function (err) {
if (err) reject(err);
else resolve(true);
});
});
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ run()
async function run()
{
let obj={sort:'profitPerMonthDrawDown',alocatedReserve:3,alocatedReserveCompound:3,risk:0,start:10000,pfTrade:2,side:'both',riskFreeLevel:100,onlyShortLong:false,loss:0,level:200,dur:1500,maxTradeDays:40,targetPercentage:{enable:true},fft:1,fftPercent:-2,fftRunup:2,fftPercentRunup:2,fftDiffDrawDownProfit:-0.5,usage:'fft'}
let obj={sort:'profitPerMonthDrawDown',alocatedReserve:3,alocatedReserveCompound:3,risk:0,start:10000,pfTrade:2,side:'both',riskFreeLevel:100,onlyShortLong:false,loss:0,level:200,dur:1500,maxTradeDays:40,targetPercentage:{enable:true},fft:1,fftPercent:-2,fftRunup:2,fftPercentRunup:{count:7,percent:15},fftDiffDrawDownProfit:-0.5,usage:'fft'}
let detail=['configs2.json-211021092159_O1_BNC_BTCUSD_Lp1_Y211020a - Copy_Mn.csv&zarib param:1.1 base:200 target:1']
obj.detail=detail
let all=[]
......
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