Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
ai
Commits
69cb2954
Commit
69cb2954
authored
Apr 22, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
e39ae4fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
15 deletions
+34
-15
ai.js
ai.js
+30
-12
combiner.js
combiner.js
+2
-1
csv.js
csv.js
+1
-1
generate.js
generate.js
+1
-1
No files found.
ai.js
View file @
69cb2954
...
@@ -14,7 +14,7 @@ let avgDrawdown = 0
...
@@ -14,7 +14,7 @@ let avgDrawdown = 0
let
avgProfit
=
0
let
avgProfit
=
0
function
run
(
data
,
config
,
risk
,
pfTrade
,
riskFreeLevel
,
detail
,
loss
,
durs
,
maxTradeDays
,
targetPercentage
,
candlesData
,
fft
,
ProfitZeroProfit
,
fftRunup
,
ProfitZeroProfitRunup
,
ProfitZeroDrawDownProfit
,
ProfitZeroDrawDown
,
ddPlusRunCount
,
ddPlusRunPercent
,
ProfitZeroRunupProfit
,
ProfitZeroRunupDrawDown
,
usage
)
{
function
run
(
data
,
config
,
risk
,
pfTrade
,
riskFreeLevel
,
detail
,
loss
,
durs
,
maxTradeDays
,
targetPercentage
,
candlesData
,
fft
,
ProfitZeroProfit
,
fftRunup
,
ProfitZeroProfitRunup
,
ProfitZeroDrawDownProfit
,
ProfitZeroDrawDown
,
ddPlusRunCount
,
RunupDrawDownZeroRunupDrawDown
,
ProfitZeroRunupProfit
,
ProfitZeroRunupDrawDown
,
RunUpDrawDownZeroProfit
,
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
...
@@ -30,8 +30,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -30,8 +30,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroDrawDown
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroDrawDown
}
else
if
(
usage
===
'
ddPlusRunCount
'
)
{
}
else
if
(
usage
===
'
ddPlusRunCount
'
)
{
type
=
type
+
'
'
+
usage
+
'
'
+
ddPlusRunCount
type
=
type
+
'
'
+
usage
+
'
'
+
ddPlusRunCount
}
else
if
(
usage
===
'
ddPlusRunPercent
'
)
{
}
else
if
(
usage
===
'
RunupDrawDownZeroRunupDrawDown
'
)
{
type
=
type
+
'
'
+
usage
+
'
'
+
ddPlusRunPercent
type
=
type
+
'
'
+
usage
+
'
'
+
RunupDrawDownZeroRunupDrawDown
}
}
else
if
(
usage
===
'
ProfitZeroRunupProfit
'
)
{
else
if
(
usage
===
'
ProfitZeroRunupProfit
'
)
{
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroRunupProfit
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroRunupProfit
...
@@ -39,6 +39,9 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -39,6 +39,9 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
else
if
(
usage
===
'
ProfitZeroRunupDrawDown
'
)
{
else
if
(
usage
===
'
ProfitZeroRunupDrawDown
'
)
{
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroRunupDrawDown
type
=
type
+
'
'
+
usage
+
'
'
+
ProfitZeroRunupDrawDown
}
}
else
if
(
usage
===
'
RunUpDrawDownZeroProfit
'
)
{
type
=
type
+
'
'
+
usage
+
'
'
+
RunUpDrawDownZeroProfit
}
let
saveData
=
[]
let
saveData
=
[]
...
@@ -86,6 +89,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -86,6 +89,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let
canCreateRunupPercent
=
false
let
canCreateRunupPercent
=
false
let
countDrop
=
0
let
countDrop
=
0
let
allLossProfit
=
0
let
allLossProfit
=
0
let
RunUpDrawDownAllLossProfit
=
0
let
drawDownPlusRunUpCount
=
0
let
drawDownPlusRunUpCount
=
0
let
drawDownPlusRunUpPercent
=
0
let
drawDownPlusRunUpPercent
=
0
let
VarProfitZeroRunupProfit
=
0
let
VarProfitZeroRunupProfit
=
0
...
@@ -145,8 +149,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -145,8 +149,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
runBefore
=
false
runBefore
=
false
else
else
runBefore
=
true
runBefore
=
true
}
else
if
(
usage
===
'
ddPlusRunPercent
'
)
{
}
else
if
(
usage
===
'
RunupDrawDownZeroRunupDrawDown
'
)
{
if
(
drawDownPlusRunUpPercent
>
ddPlusRunPercent
)
if
(
drawDownPlusRunUpPercent
>
RunupDrawDownZeroRunupDrawDown
)
runBefore
=
false
runBefore
=
false
else
else
runBefore
=
true
runBefore
=
true
...
@@ -186,18 +190,19 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -186,18 +190,19 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
runBefore
=
true
runBefore
=
true
}
}
else
if
(
usage
===
'
RunUpDrawDownZeroProfit
'
)
{
if
(
RunUpDrawDownAllLossProfit
>
RunUpDrawDownZeroProfit
)
runBefore
=
false
else
runBefore
=
true
}
}
if
((
data
[
i
].
runUp
+
data
[
i
].
drawDown
)
<
0
)
{
drawDownPlusRunUpCount
++
drawDownPlusRunUpPercent
=
drawDownPlusRunUpPercent
+
(
data
[
i
].
runUp
+
data
[
i
].
drawDown
)
}
else
{
drawDownPlusRunUpCount
=
0
drawDownPlusRunUpPercent
=
0
}
}
if
((
data
[
i
].
profit
+
data
[
i
].
runUp
)
<
0
)
{
if
((
data
[
i
].
profit
+
data
[
i
].
runUp
)
<
0
)
{
...
@@ -229,6 +234,19 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -229,6 +234,19 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
//zero
//zero
}
}
if
((
data
[
i
].
runUp
+
data
[
i
].
drawDown
)
<
0
)
{
drawDownPlusRunUpCount
++
drawDownPlusRunUpPercent
=
drawDownPlusRunUpPercent
+
(
data
[
i
].
runUp
+
data
[
i
].
drawDown
)
RunUpDrawDownAllLossProfit
=
RunUpDrawDownAllLossProfit
+
data
[
i
].
profit
// diffDrawdownProfitAll = diffDrawdownProfitAll + (data[i].drawDown - data[i].profit)
// ProfitZeroDrawDownPercent = ProfitZeroDrawDownPercent + data[i].drawDown
// VarProfitZeroRunupProfit=VarProfitZeroRunupProfit+(data[i].runUp + data[i].profit)
}
else
{
drawDownPlusRunUpCount
=
0
drawDownPlusRunUpPercent
=
0
RunUpDrawDownAllLossProfit
=
0
}
if
(
data
[
i
].
profit
<
0
)
{
if
(
data
[
i
].
profit
<
0
)
{
allLossProfit
=
allLossProfit
+
data
[
i
].
profit
allLossProfit
=
allLossProfit
+
data
[
i
].
profit
...
...
combiner.js
View file @
69cb2954
...
@@ -65,10 +65,11 @@ async function run() {
...
@@ -65,10 +65,11 @@ async function run() {
i
.
ProfitZeroDrawDownProfit
=
config
.
ProfitZeroDrawDownProfit
i
.
ProfitZeroDrawDownProfit
=
config
.
ProfitZeroDrawDownProfit
i
.
ProfitZeroDrawDown
=
config
.
ProfitZeroDrawDown
i
.
ProfitZeroDrawDown
=
config
.
ProfitZeroDrawDown
i
.
ddPlusRunCount
=
config
.
ddPlusRunCount
i
.
ddPlusRunCount
=
config
.
ddPlusRunCount
i
.
ddPlusRunPercent
=
config
.
ddPlusRunPercent
i
.
RunupDrawDownZeroRunupDrawDown
=
config
.
RunupDrawDownZeroRunupDrawDown
i
.
ProfitZeroRunupProfit
=
config
.
ProfitZeroRunupProfit
i
.
ProfitZeroRunupProfit
=
config
.
ProfitZeroRunupProfit
i
.
ProfitZeroRunupDrawDown
=
config
.
ProfitZeroRunupDrawDown
i
.
ProfitZeroRunupDrawDown
=
config
.
ProfitZeroRunupDrawDown
i
.
RunUpDrawDownZeroProfit
=
config
.
RunUpDrawDownZeroProfit
i
.
usage
=
config
.
usage
i
.
usage
=
config
.
usage
i
.
detail
=
config
.
detail
i
.
detail
=
config
.
detail
...
...
csv.js
View file @
69cb2954
...
@@ -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
,
detail
,
config
[
i
].
loss
,
config
[
i
].
dur
,
config
[
i
].
maxTradeDays
,
config
[
i
].
targetPercentage
,
candles
,
config
[
i
].
fft
,
config
[
i
].
ProfitZeroProfit
,
config
[
i
].
fftRunup
,
config
[
i
].
ProfitZeroProfitRunup
,
config
[
i
].
ProfitZeroDrawDownProfit
,
config
[
i
].
ProfitZeroDrawDown
,
config
[
i
].
ddPlusRunCount
,
config
[
i
].
ddPlusRunPercent
,
config
[
i
].
ProfitZeroRunupProfit
,
config
[
i
].
ProfitZeroRunupDrawDown
,
config
[
i
].
usage
)
let
d
=
ai
.
run
(
arr
,
config
[
i
],
config
[
i
].
risk
,
config
[
i
].
pfTrade
,
config
[
i
].
riskFreeLevel
,
detail
,
config
[
i
].
loss
,
config
[
i
].
dur
,
config
[
i
].
maxTradeDays
,
config
[
i
].
targetPercentage
,
candles
,
config
[
i
].
fft
,
config
[
i
].
ProfitZeroProfit
,
config
[
i
].
fftRunup
,
config
[
i
].
ProfitZeroProfitRunup
,
config
[
i
].
ProfitZeroDrawDownProfit
,
config
[
i
].
ProfitZeroDrawDown
,
config
[
i
].
ddPlusRunCount
,
config
[
i
].
RunupDrawDownZeroRunupDrawDown
,
config
[
i
].
ProfitZeroRunupProfit
,
config
[
i
].
ProfitZeroRunupDrawDown
,
config
[
i
].
RunUpDrawDownZeroProfit
,
config
[
i
].
usage
)
if
(
d
!==
null
)
if
(
d
!==
null
)
cz
.
push
(
d
)
cz
.
push
(
d
)
}
}
...
...
generate.js
View file @
69cb2954
...
@@ -22,7 +22,7 @@ async function run()
...
@@ -22,7 +22,7 @@ async function run()
{
{
for
(
let
n
=
1
;
n
<
40
;
n
++
)
for
(
let
n
=
1
;
n
<
40
;
n
++
)
{
{
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
:
false
},
fft
:
1
,
ProfitZeroProfit
:(
n
*-
1
),
fftRunup
:
2
,
ProfitZeroProfitRunup
:{
count
:
7
,
percent
:
15
},
ProfitZeroDrawDownProfit
:(
n
*-
1
),
ProfitZeroDrawDown
:(
n
*-
1
),
ddPlusRunCount
:
4
,
ddPlusRunPercent
:
-
2
,
ProfitZeroRunupProfit
:(
n
*-
1
),
ProfitZeroRunupDrawDown
:(
n
*-
1
),
usage
:
'
ProfitZeroRunupProfit
'
}
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
:
false
},
fft
:
1
,
ProfitZeroProfit
:(
n
*-
1
),
fftRunup
:
2
,
ProfitZeroProfitRunup
:{
count
:
7
,
percent
:
15
},
ProfitZeroDrawDownProfit
:(
n
*-
1
),
ProfitZeroDrawDown
:(
n
*-
1
),
ddPlusRunCount
:
4
,
RunupDrawDownZeroRunupDrawDown
:
-
2
,
ProfitZeroRunupProfit
:(
n
*-
1
),
ProfitZeroRunupDrawDown
:(
n
*-
1
),
RunUpDrawDownZeroProfit
:(
n
*-
1
),
usage
:
'
ProfitZeroRunupProfit
'
}
// 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
=
[]
obj
.
detail
=
[]
// let all=[]
// let all=[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment