Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
forex
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
forex
Commits
44f4eef4
Commit
44f4eef4
authored
Dec 04, 2021
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
7973eb90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
42 deletions
+36
-42
ai.js
ai.js
+1
-1
run.js
run.js
+35
-41
No files found.
ai.js
View file @
44f4eef4
...
...
@@ -23,7 +23,7 @@ function run(data, config,risk,pfTrade) {
let
levels
=
[]
let
dur
=
getMinDiff
(
data
[
0
].
openDate
,
data
[
data
.
length
-
1
].
closeDate
)
let
newP
=
dur
/
data
.
length
console
.
log
(
newP
)
//
console.log(newP)
if
(
pfTrade
>
newP
)
return
null
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
...
run.js
View file @
44f4eef4
...
...
@@ -19,7 +19,7 @@ async function run() {
for
(
let
i
=
0
;
i
<
files
.
length
;
i
++
)
if
(
files
[
i
].
includes
(
'
.csv
'
))
{
csvFile
=
files
[
i
]
arr
.
push
(
csv
.
parse
(
directory
,
files
[
i
],
configs
.
data
,
configs
.
risk
,
configs
.
pfTrade
))
arr
.
push
(
csv
.
parse
(
directory
,
files
[
i
],
configs
.
data
,
configs
.
risk
,
configs
.
pfTrade
))
}
arr
=
await
Promise
.
all
(
arr
)
...
...
@@ -35,7 +35,7 @@ async function run() {
}
}
// console.log(arr2)
arr2
=
_
.
without
(
arr2
,
undefined
,
null
);
arr2
=
_
.
without
(
arr2
,
undefined
,
null
);
arr2
=
_
.
orderBy
(
arr2
,
[
'
profitPerMonthDrawDown
'
],
[
'
desc
'
]);
let
arr20Max
=
[]
let
arr1000Compound
=
[]
...
...
@@ -45,30 +45,26 @@ async function run() {
let
arrResrv200
=
[]
let
arrReservCompound
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
typeof
arr2
[
i
]
!==
"
undefined
"
)
arr3
.
push
(
arr2
[
i
])
if
(
typeof
arrResrv200
[
i
]
!==
"
undefined
"
)
arrResrv200
.
push
(
arrReserv
[
i
])
if
(
typeof
arr1000Compound
[
i
]
!==
"
undefined
"
)
arr1000Compound
.
push
(
arrCompound
[
i
])
}
for
(
let
i
=
0
;
i
<
arr2
.
length
;
i
++
)
{
if
(
arr2
[
i
].
allocatedReserve
<
3
)
arr20Max
.
push
(
arr2
[
i
])
}
for
(
let
i
=
0
;
i
<
arrCompound
.
length
;
i
++
)
{
if
(
arrCompound
[
i
].
allocatedReserve
<
3
)
arrReservCompound
.
push
(
arrCompound
[
i
])
}
let
arr20MaxNew
=
[]
let
arrReservCompoundNew
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
typeof
arr20Max
[
i
]
!==
"
undefined
"
)
if
(
i
<
arr20Max
.
length
)
arr20MaxNew
.
push
(
arr20Max
[
i
])
if
(
typeof
arrReservCompound
[
i
]
!==
"
undefined
"
)
if
(
i
<
arrReservCompound
.
length
)
arrReservCompoundNew
.
push
(
arrReservCompound
[
i
])
...
...
@@ -115,7 +111,7 @@ async function run() {
// createfileADV('allocatedReservePerMonthUnder2', JSON.stringify(arr20MaxNew, null, 2))
// createfileADV('allocatedReserveCompoundUnder2' , JSON.stringify(arrReservCompoundNew, null, 2))
startAgain
(
arr
,
configs
.
start
)
startAgain
(
arr
,
configs
.
start
)
console
.
log
(
'
Done
'
)
await
makeStatus
(
directory
,
'
0
'
)
// process.exit(0)
...
...
@@ -123,13 +119,13 @@ startAgain(arr,configs.start)
}
async
function
startAgain
(
arr
,
start
){
async
function
startAgain
(
arr
,
start
)
{
let
count
=
0
let
arr2
=
[]
let
arr3
=
[]
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
let
inline
=
arr
[
i
]
inline
=
_
.
without
(
inline
,
undefined
,
null
);
for
(
let
j
=
0
;
j
<
inline
.
length
;
j
++
)
{
if
(
inline
[
j
].
maxAllocatedMoney
<
start
)
arr2
.
push
(
inline
[
j
])
...
...
@@ -138,7 +134,7 @@ async function startAgain(arr,start){
}
}
// console.log(arr2)
arr2
=
_
.
without
(
arr2
,
undefined
,
null
);
arr2
=
_
.
without
(
arr2
,
undefined
,
null
);
arr2
=
_
.
orderBy
(
arr2
,
[
'
profitPerMonthDrawDown
'
],
[
'
desc
'
]);
let
arr20Max
=
[]
let
arr1000Compound
=
[]
...
...
@@ -148,42 +144,41 @@ async function startAgain(arr,start){
let
arrResrv200
=
[]
let
arrReservCompound
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
typeof
arr2
[
i
]
!==
"
undefined
"
)
if
(
typeof
arr2
[
i
]
!==
"
undefined
"
)
arr3
.
push
(
arr2
[
i
])
if
(
typeof
arrReserv
[
i
]
!==
"
undefined
"
)
if
(
typeof
arrReserv
[
i
]
!==
"
undefined
"
)
arrResrv200
.
push
(
arrReserv
[
i
])
if
(
typeof
arrCompound
[
i
]
!==
"
undefined
"
)
if
(
typeof
arrCompound
[
i
]
!==
"
undefined
"
)
arr1000Compound
.
push
(
arrCompound
[
i
])
}
for
(
let
i
=
0
;
i
<
arr2
.
length
;
i
++
)
{
if
(
arr2
[
i
].
allocatedReserve
<
3
)
arr20Max
.
push
(
arr2
[
i
])
}
// for (let i = 0; i < arr2.length; i++) {
//
// if (arr2[i].allocatedReserve < 3)
// arr20Max.push(arr2[i])
// }
for
(
let
i
=
0
;
i
<
arrCompound
.
length
;
i
++
)
{
if
(
arrCompound
[
i
].
allocatedReserve
<
3
)
arrReservCompound
.
push
(
arrCompound
[
i
])
}
// for (let i = 0; i < arrCompound.length; i++) {
//
// if (arrCompound[i].allocatedReserve < 3)
// arrReservCompound.push(arrCompound[i])
// }
let
arr20MaxNew
=
[]
let
arrReservCompoundNew
=
[]
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
if
(
typeof
arr20Max
!==
"
undefined
"
)
if
(
i
<
arr20Max
.
length
)
arr20MaxNew
.
push
(
arr20Max
[
i
])
if
(
typeof
arrReservCompound
!==
"
undefined
"
)
if
(
i
<
arrReservCompound
.
length
)
arrReservCompoundNew
.
push
(
arrReservCompound
[
i
])
}
// await fs.unlinkSync(directory + '/' + csvFile)
// createfileADV('allDataSortedByProfit', JSON.stringify(arr2, null, 2))
createfileADV
(
'
profitPerMonth1000Start
'
,
JSON
.
stringify
(
arr3
,
null
,
2
))
...
...
@@ -193,7 +188,6 @@ async function startAgain(arr,start){
// createfileADV('allocatedReserveCompoundUnder3' , JSON.stringify(arrReservCompoundNew, null, 2))
}
function
createfile
(
data
)
{
...
...
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