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
cb990d8c
Commit
cb990d8c
authored
Dec 30, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
68fac1fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
ai.js
ai.js
+13
-3
No files found.
ai.js
View file @
cb990d8c
...
...
@@ -17,12 +17,14 @@ function run(data, config, risk, pfTrade, riskFreeLevel,detail) {
let
total
=
0
let
allTotal
=
0
let
maxReserve
=
0
let
maxMeta
=
0
let
maxAllocatedMoney
=
0
let
maxLevel
=
0
// console.log(data)
let
step
=
0
let
reserv
=
0
let
meta
=
0
let
profit
=
0
let
lastCom
=
0
let
lastMoney
=
0
...
...
@@ -67,6 +69,10 @@ let obj
if
(
d
.
reserve
<
0
&&
Math
.
abs
(
d
.
reserve
)
>
Math
.
abs
(
maxReserve
))
maxReserve
=
d
.
reserve
if
(
d
.
meta
<
0
&&
Math
.
abs
(
d
.
meta
)
>
Math
.
abs
(
maxMeta
))
maxMeta
=
d
.
meta
// console.log(maxAllocatedMoney)
if
(
money
>
maxAllocatedMoney
)
maxAllocatedMoney
=
money
...
...
@@ -114,7 +120,7 @@ let obj
if
(
needPrintData
)
{
obj
.
profit
=
profit
obj
.
profit
All
=
profit
obj
.
lastMoney
=
lastMoney
...
...
@@ -209,6 +215,7 @@ let obj
CompoundPerMonthDrawDown
:
compoundPerMonth
/
drawDown
,
profitPerMonthDrawDown
:
Math
.
abs
(
profitPerMonth
)
/
drawDown
,
maxReseve
:
maxReserve
,
maxMeta
:
maxMeta
,
avgReserve
:
maxReserve
/
total
,
percentage
:
percentage
,
avgProfitPerDay
:
newT
,
...
...
@@ -217,6 +224,7 @@ let obj
risk
:
risk
,
levels
:
newLevelText
,
pftrade
:
newP
,
countOfTrade
:
data
.
length
...
...
@@ -280,13 +288,15 @@ let targetDetail='('+money+')' +'+'+'('+minProf+')+('+com +')+('+lastCom+')'
let
diff
=
reserve
-
money
diff
=
diff
-
com
-
lastCom
+
profit
let
meta
=
profitMoney
+
profit
-
com
-
lastCom
// console.log('reserve->'+reserve + ' money->'+money +' com->'+com +' lastCom->'+lastCom + 'profit->'+profit +' diff->'+diff)
if
(
percentage
(
money
,
data
.
runUp
)
>
target
)
return
{
done
:
true
,
money
:
money
,
reserve
:
diff
,
riskFree
,
profitLastSteps
:
profit
,
profit
:
profitMoney
,
lastCom
:
lastCom
,
com
:
com
,
target
:
target
,
targetDetail
:
targetDetail
}
return
{
done
:
true
,
money
:
money
,
meta
:
meta
,
reserve
:
diff
,
riskFree
,
profitLastSteps
:
profit
,
profit
:
profitMoney
,
lastCom
:
lastCom
,
com
:
com
,
target
:
target
,
targetDetail
:
targetDetail
}
else
return
{
done
:
false
,
money
:
money
,
reserve
:
diff
,
profitLastSteps
:
profit
,
profit
:
profitMoney
,
lastMoney
:
money
,
com
:
com
,
target
:
target
,
targetDetail
:
targetDetail
}
return
{
done
:
false
,
money
:
money
,
meta
:
meta
,
reserve
:
diff
,
profitLastSteps
:
profit
,
profit
:
profitMoney
,
lastMoney
:
money
,
com
:
com
,
target
:
target
,
targetDetail
:
targetDetail
}
}
...
...
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