Commit a085766f authored by Ahmad Nemati's avatar Ahmad Nemati

git pu

parent 4cc8fe4e
...@@ -11,7 +11,7 @@ let candles = [] ...@@ -11,7 +11,7 @@ let candles = []
let timeFrame = 0 let timeFrame = 0
function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, maxTradeDays, targetPercentage, candlesData, fft, fftPercent, fftRunup, fftPercentRunup, fftDiffDrawDownProfit, usage) { function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, maxTradeDays, targetPercentage, candlesData, fft, fftPercent, fftRunup, fftPercentRunup, fftDiffDrawDownProfit,fftDrawDown, usage) {
let type = config.type + ' param:' + config.param + ' base:' + config.base + ' target:' + config.target + ' targetPercentage:' + targetPercentage.enable let type = config.type + ' param:' + config.param + ' base:' + config.base + ' target:' + config.target + ' targetPercentage:' + targetPercentage.enable
if (usage === 'fft') { if (usage === 'fft') {
type = type + ' ' + usage + ' ' + fft type = type + ' ' + usage + ' ' + fft
...@@ -25,6 +25,10 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -25,6 +25,10 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
else if (usage ==='fftPercentRunup') { else if (usage ==='fftPercentRunup') {
type = type + ' ' + usage + ' Count:' + fftPercentRunup.count +' Percent:'+fftPercentRunup.percent type = type + ' ' + usage + ' Count:' + fftPercentRunup.count +' Percent:'+fftPercentRunup.percent
} }
else if (usage ==='fftDrawDown') {
type = type + ' ' + usage + ' ' + fftDrawDown
}
let saveData = [] let saveData = []
candles = candlesData candles = candlesData
...@@ -71,6 +75,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -71,6 +75,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let countDropRunup = 0 let countDropRunup = 0
let fftDrawDownPercent=0
let allLossProfitRunup = 0 let allLossProfitRunup = 0
let diffDrawdownProfitAll = 0 let diffDrawdownProfitAll = 0
...@@ -109,7 +114,13 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -109,7 +114,13 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
runBefore=false runBefore=false
else else
runBefore=true runBefore=true
} else if (usage === 'fftRunup') { }else if (usage === 'fftDrawDown') {
if (fftDrawDownPercent > fftDrawDown)
runBefore=false
else
runBefore=true
}
else if (usage === 'fftRunup') {
if (countDropRunup < fftRunup) if (countDropRunup < fftRunup)
runBefore=false runBefore=false
else else
...@@ -133,11 +144,13 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max ...@@ -133,11 +144,13 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
if (data[i].profit < 0) { if (data[i].profit < 0) {
allLossProfit = allLossProfit + data[i].profit allLossProfit = allLossProfit + data[i].profit
diffDrawdownProfitAll = diffDrawdownProfitAll + (data[i].drawDown - data[i].profit) diffDrawdownProfitAll = diffDrawdownProfitAll + (data[i].drawDown - data[i].profit)
fftDrawDownPercent=fftDrawDownPercent+data[i].drawDown
countDrop++ countDrop++
} else { } else {
allLossProfit = 0 allLossProfit = 0
diffDrawdownProfitAll = 0 diffDrawdownProfitAll = 0
countDrop = 0 countDrop = 0
fftDrawDownPercent=0
} }
if (data[i].runUp < config.target) { if (data[i].runUp < config.target) {
allLossProfitRunup = allLossProfitRunup + data[i].runUp allLossProfitRunup = allLossProfitRunup + data[i].runUp
......
...@@ -14,7 +14,7 @@ async function run() { ...@@ -14,7 +14,7 @@ async function run() {
"riskFreeLevel": 100, "riskFreeLevel": 100,
"onlyShortLong": false, "onlyShortLong": false,
"loss": 0, "loss": 0,
"level": 1000, "level": 10,
"dur": 365, "dur": 365,
"maxTradeDays": 100, "maxTradeDays": 100,
"targetPercentage": { "targetPercentage": {
...@@ -63,6 +63,7 @@ async function run() { ...@@ -63,6 +63,7 @@ async function run() {
i.fftRunup= config.fftRunup i.fftRunup= config.fftRunup
i.fftPercentRunup= config.fftPercentRunup i.fftPercentRunup= config.fftPercentRunup
i.fftDiffDrawDownProfit=config.fftDiffDrawDownProfit i.fftDiffDrawDownProfit=config.fftDiffDrawDownProfit
i.fftDrawDown=config.fftDrawDown
i.usage= config.usage i.usage= config.usage
i.detail=config.detail i.detail=config.detail
......
...@@ -140,7 +140,7 @@ function initData(data, config, name, risk, pfTrade, side, riskFreeLevel,detail, ...@@ -140,7 +140,7 @@ function initData(data, config, name, risk, pfTrade, side, riskFreeLevel,detail,
let cz = [] let cz = []
for (let i = 0; i < config.length; i++) { for (let i = 0; i < config.length; i++) {
let d = ai.run(arr, config[i], config[i].risk, config[i].pfTrade, config[i].riskFreeLevel,config[i].detail,config[i].loss,config[i].dur,config[i].maxTradeDays,config[i].targetPercentage,candles,config[i].fft,config[i].fftPercent,config[i].fftRunup,config[i].fftPercentRunup,config[i].fftDiffDrawDownProfit,config[i].usage) let d = ai.run(arr, config[i], config[i].risk, config[i].pfTrade, config[i].riskFreeLevel,config[i].detail,config[i].loss,config[i].dur,config[i].maxTradeDays,config[i].targetPercentage,candles,config[i].fft,config[i].fftPercent,config[i].fftRunup,config[i].fftPercentRunup,config[i].fftDiffDrawDownProfit,config[i].fftDrawDown,config[i].usage)
if (d !== null) if (d !== null)
cz.push(d) cz.push(d)
} }
......
...@@ -20,7 +20,7 @@ run() ...@@ -20,7 +20,7 @@ run()
async function 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:{count:7,percent:15},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,fftDrawDown:-1,usage:'fft'}
let detail=['configs2.json-211021092159_O1_BNC_BTCUSD_Lp1_Y211020a - Copy_Mn.csv&zarib param:1.1 base:200 target:1'] let detail=['configs2.json-211021092159_O1_BNC_BTCUSD_Lp1_Y211020a - Copy_Mn.csv&zarib param:1.1 base:200 target:1']
obj.detail=detail obj.detail=detail
let all=[] 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