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
185f92b8
Commit
185f92b8
authored
May 09, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
444384e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
ai.js
ai.js
+15
-10
No files found.
ai.js
View file @
185f92b8
...
...
@@ -166,7 +166,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
let
avgRunup
=
0
let
avgDrawdown
=
0
let
avgProfit
=
0
let
tempAlldonePer
=
0
let
tempAlldonePer
=
0
// console.log(data)
...
...
@@ -575,9 +575,6 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
baseCompund
=
baseCompund
+
percentage2
(
baseCompund
,
data
[
i
].
profit
-
0.1
)
if
(
data
[
i
].
side
===
'
LONG
'
)
{
allLongDone
++
...
...
@@ -765,9 +762,8 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
lossDonePer
=
lossDonePer
+
data
[
i
].
profit
-
0.1
}
allDonePer
=
allDonePer
+
data
[
i
].
profit
-
0.1
if
(
allDonePer
>
0
&&
tempAlldonePer
<
allDonePer
)
{
tempAlldonePer
=
allDonePer
if
(
allDonePer
>
0
&&
tempAlldonePer
<
allDonePer
)
{
tempAlldonePer
=
allDonePer
allDoneCount
++
}
...
...
@@ -932,6 +928,14 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
sum
=
sum
-
Math
.
abs
(
maxAllocatedMoney
)
let
newCompund
=
sum
/
dur
let
newBasePerComp
=
allDonePer
/
allDoneCount
let
lastSumCompound
=
100
for
(
let
z
=
0
;
z
<
allDoneCount
;
z
++
)
{
lastSumCompound
=
lastSumCompound
+
percentage2
(
lastSumCompound
,
newBasePerComp
)
}
let
compoundPerMonth
=
(
newCompund
*
30
*
100
)
/
Math
.
abs
(
maxAllocatedMoney
)
let
drawDown
=
Math
.
abs
(((
maxReserve
*
100
)
/
maxAllocatedMoney
))
...
...
@@ -947,7 +951,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
maxReseve
:
baseDrawDown
,
maxMeta
:
baseMeta
,
dur
:
dur
,
upperCount
:
allDoneCount
,
upperCount
:
allDoneCount
,
allLongDone
:
allLongDone
,
allLongDonePer
:
allLongDonePer
,
allShortDone
:
allShortDone
,
...
...
@@ -972,7 +976,7 @@ upperCount:allDoneCount,
allLoss
:
allLoss
,
totalFinal
:
oldTotalFinal
,
totalPlus
:
totalPlus
,
totalCompound
:
baseCompund
/
1000
,
totalCompound
:
lastSumCompound
,
compoundPerMonth
:
(
baseCompund
/
dur
)
*
30
,
profitPerMonth
:
Math
.
abs
(
profitPerMonth
),
...
...
@@ -1193,13 +1197,14 @@ function percentage(base, per) {
let
temp
=
base
*
percentager
return
base
+
temp
}
function
percentage2
(
base
,
per
)
{
base
=
parseFloat
(
base
)
per
=
parseFloat
(
per
)
let
percentager
=
per
/
100
let
temp
=
base
*
percentager
return
temp
return
temp
}
function
percentageMinus
(
base
,
per
)
{
...
...
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