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
3b6dd61d
Commit
3b6dd61d
authored
May 09, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pu
parent
899551d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
25 deletions
+24
-25
ai.js
ai.js
+24
-25
No files found.
ai.js
View file @
3b6dd61d
...
@@ -13,11 +13,11 @@ let avgRunup = 0
...
@@ -13,11 +13,11 @@ let avgRunup = 0
let
avgDrawdown
=
0
let
avgDrawdown
=
0
let
avgProfit
=
0
let
avgProfit
=
0
let
startt
=
30
let
startt
=
30
let
baseCompund
=
100
let
baseCompund
=
100
let
baseMeta
=
0
let
baseMeta
=
0
let
baseDrawDown
=
0
let
baseDrawDown
=
0
let
tempMeta
=
0
let
tempMeta
=
0
let
tempDrawDown
=
0
let
tempDrawDown
=
0
//
//
function
run
(
data
,
config
,
risk
,
pfTrade
,
riskFreeLevel
,
detail
,
loss
,
durs
,
maxTradeDays
,
targetPercentage
,
candlesData
,
fft
,
ProfitZeroProfit
,
fftRunup
,
ProfitZeroProfitRunup
,
ProfitZeroDrawDownProfit
,
ProfitZeroDrawDown
,
ddPlusRunCount
,
RunupDrawDownZeroRunupDrawDown
,
ProfitZeroRunupProfit
,
ProfitZeroRunupDrawDown
,
RunUpDrawDownZeroProfit
,
RunUpDrawDownZeroDrawDownProfit
,
RunUpDrawDownZeroDrawdown
,
RunUpDrawDownZeroRunupProfit
,
RunupZeroRunupDrawDown
,
RunupZeroProfit
,
RunupZeroProfitDrawDown
,
RunupZeroDrawDown
,
RunupZeroProfitRunup
,
DrawDownZeroDrawDown
,
DrawDownnZeroProfit
,
DrawDownZeroProfitDrawDown
,
DrawDownZeroProfitRunup
,
DrawDownZeroRunupDrawDown
,
ProfitDrawDownZeroDrawDown
,
ProfitDrawDownZeroProfit
,
ProfitDrawDownZeroProfitDrawDown
,
ProfitDrawDownZeroProfitRunup
,
ProfitDrawDownZeroRunupDrawDown
function
run
(
data
,
config
,
risk
,
pfTrade
,
riskFreeLevel
,
detail
,
loss
,
durs
,
maxTradeDays
,
targetPercentage
,
candlesData
,
fft
,
ProfitZeroProfit
,
fftRunup
,
ProfitZeroProfitRunup
,
ProfitZeroDrawDownProfit
,
ProfitZeroDrawDown
,
ddPlusRunCount
,
RunupDrawDownZeroRunupDrawDown
,
ProfitZeroRunupProfit
,
ProfitZeroRunupDrawDown
,
RunUpDrawDownZeroProfit
,
RunUpDrawDownZeroDrawDownProfit
,
RunUpDrawDownZeroDrawdown
,
RunUpDrawDownZeroRunupProfit
,
RunupZeroRunupDrawDown
,
RunupZeroProfit
,
RunupZeroProfitDrawDown
,
RunupZeroDrawDown
,
RunupZeroProfitRunup
,
DrawDownZeroDrawDown
,
DrawDownnZeroProfit
,
DrawDownZeroProfitDrawDown
,
DrawDownZeroProfitRunup
,
DrawDownZeroRunupDrawDown
,
ProfitDrawDownZeroDrawDown
,
ProfitDrawDownZeroProfit
,
ProfitDrawDownZeroProfitDrawDown
,
ProfitDrawDownZeroProfitRunup
,
ProfitDrawDownZeroRunupDrawDown
...
@@ -255,7 +255,6 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -255,7 +255,6 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
allDonePer
<
-
70
)
if
(
allDonePer
<
-
70
)
return
null
return
null
if
(
maxDays
>
maxTradeDays
)
if
(
maxDays
>
maxTradeDays
)
...
@@ -568,24 +567,21 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -568,24 +567,21 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
if
(
runBefore
===
false
)
if
(
runBefore
===
false
)
continue
continue
allDone
++
allDone
++
if
(
data
[
i
].
profit
>
0.1
)
if
(
data
[
i
].
profit
>
0.1
)
baseCompund
=
baseCompund
+
(
data
[
i
].
profit
-
0.1
)
baseCompund
=
baseCompund
+
(
data
[
i
].
profit
-
0.1
)
if
(
data
[
i
].
profit
>
0.1
)
if
(
data
[
i
].
profit
>
0.1
)
{
{
tempMeta
=
0
tempMeta
=
0
tempDrawDown
=
0
tempDrawDown
=
0
}
}
else
{
else
tempMeta
=
tempMeta
+
data
[
i
].
profit
+
0.1
{
tempDrawDown
=
tempDrawDown
+
data
[
i
].
drawDown
tempMeta
=
tempMeta
+
data
[
i
].
profit
+
0.1
tempDrawDown
=
tempDrawDown
+
data
[
i
].
drawDown
if
(
tempMeta
<
baseMeta
)
if
(
tempMeta
<
baseMeta
)
baseMeta
=
tempMeta
baseMeta
=
tempMeta
if
(
tempDrawDown
<
baseDrawDown
)
if
(
tempDrawDown
<
baseDrawDown
)
baseDrawDown
=
tempDrawDown
baseDrawDown
=
tempDrawDown
}
}
if
(
data
[
i
].
side
===
'
LONG
'
)
{
if
(
data
[
i
].
side
===
'
LONG
'
)
{
...
@@ -768,8 +764,11 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -768,8 +764,11 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
runBefore
=
false
runBefore
=
false
profitLossString
=
profitLossString
+
data
[
i
].
profit
+
'
_
'
profitLossString
=
profitLossString
+
data
[
i
].
profit
+
'
_
'
lossDone
++
lossDonePer
=
lossDonePer
+
data
[
i
].
profit
-
0.1
if
(
data
[
i
].
profit
<=
0.1
)
{
lossDone
++
lossDonePer
=
lossDonePer
+
data
[
i
].
profit
-
0.1
}
allDonePer
=
allDonePer
+
data
[
i
].
profit
-
0.1
allDonePer
=
allDonePer
+
data
[
i
].
profit
-
0.1
if
(
data
[
i
].
side
===
'
LONG
'
)
{
if
(
data
[
i
].
side
===
'
LONG
'
)
{
allLongDonePer
=
allLongDonePer
+
data
[
i
].
profit
-
0.1
allLongDonePer
=
allLongDonePer
+
data
[
i
].
profit
-
0.1
...
@@ -913,7 +912,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -913,7 +912,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
percentage
=
null
percentage
=
null
}
}
let
profitPerMonth
=
(
allDonePer
/
dur
)
*
30
let
profitPerMonth
=
(
allDonePer
/
dur
)
*
30
// let percentage2 = maxReserve + newT
// let percentage2 = maxReserve + newT
...
@@ -967,7 +966,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -967,7 +966,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
totalPlus
:
totalPlus
,
totalPlus
:
totalPlus
,
totalCompound
:
baseCompund
,
totalCompound
:
baseCompund
,
profitPerMonth
:
Math
.
abs
(
profitPerMonth
),
profitPerMonth
:
Math
.
abs
(
profitPerMonth
),
compoundPerMonth
:
(
baseCompund
/
dur
)
*
30
,
compoundPerMonth
:
(
baseCompund
/
dur
)
*
30
,
dateString
:
dateString
,
dateString
:
dateString
,
runupString
:
runupString
,
runupString
:
runupString
,
sideString
:
sideString
,
sideString
:
sideString
,
...
@@ -1031,7 +1030,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
...
@@ -1031,7 +1030,7 @@ function run(data, config, risk, pfTrade, riskFreeLevel, detail, loss, durs, max
delete
opt
.
risk
delete
opt
.
risk
delete
opt
.
levels
delete
opt
.
levels
delete
opt
.
durDetailText
delete
opt
.
durDetailText
delete
opt
.
metaDetailText
delete
opt
.
metaDetailText
delete
opt
.
CompoundPerMonthDrawDown
delete
opt
.
CompoundPerMonthDrawDown
delete
opt
.
profitPerMonthDrawDown
delete
opt
.
profitPerMonthDrawDown
...
...
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