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
227cec08
Commit
227cec08
authored
Sep 06, 2022
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git pull
parent
a0abd222
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
582 additions
and
3 deletions
+582
-3
grab0.js
grab0.js
+575
-0
test_text.js
test_text.js
+7
-3
No files found.
grab0.js
0 → 100644
View file @
227cec08
const
fs
=
require
(
'
fs
'
)
let
moment
=
require
(
'
moment-timezone
'
)
let
_
=
require
(
'
lodash
'
)
const
uuid
=
require
(
'
uniqid
'
)
let
pairs
=
''
let
res2
let
res3
let
res4
init
()
async
function
init
()
{
// res = await fs.readFileSync('run.csv', 'utf8');
// res = res.split('\n')
res2
=
await
fs
.
readFileSync
(
'
Run2.csv
'
,
'
utf8
'
);
res2
=
res2
.
split
(
'
\n
'
)
res3
=
await
fs
.
readFileSync
(
'
Run3.csv
'
,
'
utf8
'
);
res3
=
res3
.
split
(
'
\n
'
)
res4
=
await
fs
.
readFileSync
(
'
Run4.csv
'
,
'
utf8
'
);
res4
=
res4
.
split
(
'
\n
'
)
let
arr
=
[]
// console.log(found('ETH', 'Lp2'))
let
com
=
await
fs
.
readFileSync
(
'
com.json
'
,
'
utf8
'
);
com
=
JSON
.
parse
(
com
)
for
(
let
i
=
0
;
i
<
com
.
length
;
i
++
)
{
com
[
i
].
platform
=
com
[
i
].
platform
.
toLowerCase
()
let
t
=
com
[
i
].
platform
t
=
t
.
split
(
'
_
'
)
console
.
log
(
t
)
let
pair
=
'
BTC
'
let
lp
=
t
[
0
].
split
(
'
-
'
)[
1
].
replace
(
'
lp
'
,
'
Lp
'
)
com
[
i
].
lp
=
lp
let
p
=
t
[
t
.
length
-
1
].
split
(
'
.
'
)
p
=
p
[
0
].
split
(
pair
)[
0
]
console
.
log
(
p
)
let
uniq
=
pair
+
lp
+
p
+
capital
(
com
[
i
].
type
.
split
(
'
'
)[
5
])
+
parseFloat
(
com
[
i
].
type
.
split
(
'
'
)[
6
])
*
-
10
com
[
i
].
uniq
=
uniq
+
'
_
'
+
com
[
i
].
avgRunup
+
'
_
'
+
com
[
i
].
avgDrawdown
+
'
_
'
+
com
[
i
].
type
.
split
(
'
'
)[
5
]
+
'
_
'
+
(
parseFloat
(
com
[
i
].
type
.
split
(
'
'
)[
6
])
*
-
1
)
}
com
=
_
.
uniqBy
(
com
,
'
lp
'
);
let
newCom
=
[]
for
(
let
i
=
0
;
i
<
com
.
length
;
i
++
)
{
newCom
.
push
(
com
[
i
])
}
com
=
newCom
// createComResfileADV(JSON.stringify(com, null, 2))
for
(
let
i
=
0
;
i
<
com
.
length
;
i
++
)
{
let
t
=
com
[
i
].
platform
t
=
t
.
split
(
'
_
'
)
let
indicator
=
parseInt
(
t
[
t
.
length
-
1
])
indicator
=
2
let
pair
=
t
[
3
].
replace
(
'
usdt
'
,
''
).
replace
(
'
usd
'
,
''
)
pairs
=
pair
let
p
=
t
[
t
.
length
-
1
].
split
(
'
.
'
)
p
=
p
[
0
].
split
(
pairs
)[
1
]
let
lp
=
t
[
4
].
replace
(
'
lp
'
,
'
Lp
'
)
let
f
=
found
(
indicator
,
pair
,
lp
)
let
struc
=
''
f
.
lp
=
p
f
.
name
=
com
[
i
].
platform
if
(
indicator
===
2
)
{
struc
=
indicator2Temp
struc
=
struc
.
replace
(
'
ahmadTimeframe
'
,
f
.
timeframe
).
replace
(
'
ahmadnAtrPeriod
'
,
f
.
nAtrPeriod
).
replace
(
'
ahmaddAtrMultiplier
'
,
f
.
dAtrMultiplier
).
replace
(
'
ahmadlp
'
,
f
.
lp
)
createConfigYashilADV
(
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nAtrPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dAtrMultiplier
)
+
'
&
'
+
f
.
lp
,
struc
)
com
[
i
].
config
=
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nAtrPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dAtrMultiplier
)
+
'
&
'
+
f
.
lp
}
if
(
indicator
===
3
)
{
struc
=
indicator3Temp
struc
=
struc
.
replace
(
'
ahmadTimeframe
'
,
f
.
timeframe
).
replace
(
'
ahmadnStochPeriod
'
,
f
.
nStochPeriod
).
replace
(
'
ahmadnStochSmoothingPeriod
'
,
f
.
nStochSmoothingPeriod
).
replace
(
'
ahmaddOttPercent
'
,
f
.
dOttPercent
).
replace
(
'
ahmadnOttPeriod
'
,
f
.
lp
)
createConfigYashilADV
(
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nStochPeriod
)
+
'
&
'
+
parseFloat
(
f
.
nStochSmoothingPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dOttPercent
)
+
'
&
'
+
f
.
lp
,
struc
)
com
[
i
].
config
=
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nStochPeriod
)
+
'
&
'
+
parseFloat
(
f
.
nStochSmoothingPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dOttPercent
)
+
'
&
'
+
f
.
lp
}
if
(
indicator
===
4
)
{
struc
=
indicator4
struc
=
struc
.
replace
(
'
ahmadstMnMaBarAge
'
,
f
.
timeframe
).
replace
(
'
ahmadMnKeltner_nMidLnMaPeriod
'
,
f
.
nMidLnMaPeriod
).
replace
(
'
ahmadMnKeltner_dMultiplier
'
,
f
.
dMultiplier
).
replace
(
'
ahmadMnKeltner_nBandsAtrPeriod
'
,
f
.
lp
)
createConfigYashilADV
(
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nMidLnMaPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dMultiplier
)
+
'
&
'
+
f
.
lp
,
struc
)
com
[
i
].
config
=
'
btc
'
+
indicator
+
'
&
'
+
parseFloat
(
f
.
nMidLnMaPeriod
)
+
'
&
'
+
parseFloat
(
f
.
dMultiplier
)
+
'
&
'
+
f
.
lp
}
if
(
indicator
===
9
)
{
// struc=indicator4
// struc=struc.replace('ahmadstMnMaBarAge',f.timeframe).replace('ahmadMnKeltner_nMidLnMaPeriod',f.nMidLnMaPeriod).replace('ahmadMnKeltner_dMultiplier',f.dMultiplier).replace('ahmadMnKeltner_nBandsAtrPeriod',f.lp)
// createConfigYashilADV('btc'+indicator+'&'+parseFloat(f.nMidLnMaPeriod)+'&'+parseFloat(f.dMultiplier)+'&'+f.lp,struc)
com
[
i
].
config
=
'
btc1&7&5.8&9
'
}
console
.
log
(
f
)
arr
.
push
(
f
)
}
arr
=
_
.
uniqBy
(
arr
,
'
name
'
);
createfinalADV
(
JSON
.
stringify
(
arr
,
null
,
2
))
createComResfileADV
(
JSON
.
stringify
(
com
,
null
,
2
))
// console.log(arr)
// let header='RowNum,PPST1_stMnBarAge,PPST1_PvtPtPeriod,PPST1_AtrFactor,PPST1_AtrPeriod,szOmIdName\n'
// for (let i=0;i<arr.length;i++)
// {
// let qty=(i+5)*0.001
// let inline=(i+1)+','+arr[i].timeframe+','+arr[i].pvt+','+arr[i].factor+','+arr[i].period+','+arr[i].uniq+'_'+qty
// header=header+inline
// if (i !== arr.length-1)
// header= header+'\n'
//
// }
// createRunResfileADV(header)
}
function
isUpper
(
str
)
{
return
!
/
[
a-z
]
/
.
test
(
str
)
&&
/
[
A-Z
]
/
.
test
(
str
);
}
function
capital
(
t
)
{
let
f
=
''
for
(
let
j
=
0
;
j
<
t
.
length
;
j
++
)
if
(
isUpper
(
t
[
j
]))
f
=
f
+
t
[
j
]
return
f
}
function
createRunResfileADV
(
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
pairs
+
'
_TOP.csv
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
function
createComResfileADV
(
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
newCom.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
function
createfinalADV
(
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
final.json
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
function
found
(
indicator
,
pair
,
lp
)
{
// console.log(indicator,lp)
let
res
=
[]
if
(
indicator
===
2
)
res
=
res2
else
if
(
indicator
===
3
)
res
=
res3
else
if
(
indicator
===
4
)
res
=
res4
if
(
res
.
length
===
0
)
return
{
timeframe
:
0
}
for
(
let
i
=
0
;
i
<
res
.
length
;
i
++
)
{
if
(
!
res
[
i
].
includes
(
lp
+
'
_
'
))
continue
let
d
=
res
[
i
].
split
(
'
,
'
)
let
timeframe
=
d
[
13
]
timeframe
=
timeframe
.
split
(
'
'
)
let
newTimeframe
=
'
0d
'
for
(
let
z
=
1
;
z
<
timeframe
.
length
;
z
++
)
{
newTimeframe
=
newTimeframe
+
timeframe
[
z
]
if
(
z
!==
timeframe
.
length
-
1
)
newTimeframe
=
newTimeframe
+
'
'
}
if
(
indicator
===
2
)
return
{
timeframe
:
newTimeframe
,
nAtrPeriod
:
d
[
15
],
dAtrMultiplier
:
d
[
17
]}
if
(
indicator
===
3
)
return
{
timeframe
:
newTimeframe
,
nStochPeriod
:
d
[
15
],
nStochSmoothingPeriod
:
d
[
16
],
dOttPercent
:
d
[
18
]}
if
(
indicator
===
4
)
return
{
timeframe
:
newTimeframe
,
nMidLnMaPeriod
:
d
[
14
],
dMultiplier
:
d
[
15
]}
// timeframe=newTimeframe
// let nStochPeriod=parseFloat(d[15])
// let nStochSmoothingPeriod=parseFloat(d[16])
// let dOttPercent=parseFloat(d[18])
//
// let name = d[92]
// return {name, timeframe, nStochPeriod, nStochSmoothingPeriod, dOttPercent}
return
{
timeframe
}
}
}
function
createConfigYashilADV
(
name
,
data
)
{
// console.log(data)
return
new
Promise
(
function
(
resolve
,
reject
)
{
fs
.
writeFile
(
'
YConfig/
'
+
name
+
'
.txt
'
,
data
,
'
utf8
'
,
function
(
err
)
{
if
(
err
)
reject
(
err
);
else
resolve
(
data
);
});
});
}
let
indicator2Temp
=
'
yFt1_AlgName, yFt1_KivOzbPrfMaxi1a
\n
'
+
'
\n
'
+
'
; Note: See TradingView "Profit Maximizer PMax, Pine.txt"
\n
'
+
'
\n
'
+
'
; Symbol ==============================================================
\n
'
+
'
nQtSymNo_Tgt1, 1 ; #, In both TkSim and LiveRun
\n
'
+
'
\n
'
+
'
Sym1_Tgt1, BNC_BTCUSDT
\n
'
+
'
nDigits_Sym1_Tgt1, 3 ; #
\n
'
+
'
dTickValue_Sym1_Tgt1, 0.001 ; $
\n
'
+
'
dMarginValReqPerLot_Sym1_Tgt1, 10000 ; $
\n
'
+
'
\n
'
+
'
szOhlcCsvFpn_Sym1_Tgt1, "E:
\\
BTC.csv"
\n
'
+
'
stOhlcCsvFileBarAge_Sym1_Tgt1, 0d 00:05:00.000 ; Nd HH:mm:ss.fff, Typ. 28d 00:00:00.000
\n
'
+
'
enumOhlcCsvFileType_Sym1_Tgt1, TradingViewEpochSecondsOHLC
\n
'
+
'
bOhlcCsvFileHasHeader_Sym1_Tgt1, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
dOhlcCsvFileFromCandleTickExtractorFact_Sym1_Tgt1, 1.0 ; FpValue, Def. 1.0, Higher means extracting more ticks from each candle
\n
'
+
'
\n
'
+
'
; Tick Simulator Run Time =============================================
\n
'
+
'
dtTkSimLookBackStTime, 2022.03.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadStTime, 2022.03.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadEnTime, 2050.08.26 12:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
\n
'
+
'
; First quote is 2017.08.24 02:59:00
\n
'
+
'
\n
'
+
'
; StatInfo Parameters =================================================
\n
'
+
'
stMnRefHopAge, 0d 00:00:19.000 ; Nd HH:mm:ss.fff, Typ. 0d 00:00:19.000
\n
'
+
'
\n
'
+
'
; Signal Parameters ===================================================
\n
'
+
'
; Note: If use szOhlcCsvFpn_Sym1_Tgt1 then stMnMaBarAge will be adjusted based on CSV lines
\n
'
+
'
bForMnBarAge_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; ParamLoop -----------------------------------------------------------
\n
'
+
'
stMnBarAge_List, ahmadTimeframe
\n
'
+
'
nAtrPeriod_List, ahmadnAtrPeriod ; #, Def. 10 (ATR Length)
\n
'
+
'
dAtrMultiplier_List, ahmaddAtrMultiplier ; FpNum, Def. 3.0
\n
'
+
'
nMnMaPeriod_List, ahmadlp ; #, Def. 10
\n
'
+
'
\n
'
+
'
bNormalizeAtr_List, 0 ; 0 or 1, Def. 0
\n
'
+
'
nEntSignalCodeNum_List, 1 ; #, 1: MaPmaxCx, 2: SrcPmaxCx, Def. 1
\n
'
+
'
enumMnMaType_List, EMA
\n
'
+
'
enumSrcType_List, HL2 ; "Open", "High", "Low", "Close", "HL2", "HLC3", "OHLC4"
\n
'
+
'
nAtrCalcMethodNum_List, 1 ; #, 1: use atr(period), 2: use sma(tr, period), Def. 1
\n
'
+
'
; bInverseEntSig_List, 0
\n
'
+
'
\n
'
+
'
; bOxyDisp_SrcVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnMaVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnTrailLines, 0 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
; Trading Parameters ==================================================
\n
'
+
'
; Trading simulation start equity
\n
'
+
'
dTkSimStEquityUsd, 10000 ; $, Def. is $10,000 (Initial Capital)
\n
'
+
'
\n
'
+
'
nMnTrdMethodNum, 1 ; #, 0 to disable
\n
'
+
'
;nEntSignalCodeNum, 1 ; #, 1: MaPmaxCx, 2: SrcPmaxCx, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Enter Param. ------------------------------------------------
\n
'
+
'
dFixedOrdLot_Sym1_Tgt1, 0.1 ; lot, Note: 0.1 lot here is equal to 10000 order size in trading view
\n
'
+
'
\n
'
+
'
;nMaxOneDirOrdNo, 1 ; #
\n
'
+
'
\n
'
+
'
;bInverseEntSig, 1
\n
'
+
'
\n
'
+
'
bWaitToPassFirstCrossToEnableEnt, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Exit Param. -------------------------------------------------
\n
'
+
'
bClOppDirOrds, 1 ; 0 or 1, Def. is 0
\n
'
+
'
\n
'
+
'
bOkToOpenAndCloseChkAtSameQt, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;nInitTpPip_Sym1_Tgt1, 200 ; pip
\n
'
+
'
;nInitSlPip_Sym1_Tgt1, 100 ; pip
\n
'
+
'
\n
'
+
'
; Log Parameters ======================================================
\n
'
+
'
bSaveOrdMgmResults, 1 ; 0 or 1, Def. 0, Save list of orders in a .csv file(s)
\n
'
+
'
bKeepPosHistOfTradeSim, 0 ; 0 or 1, Def. 1, Note: Set to 0 for ParamLoop runs
\n
'
+
'
\n
'
+
'
bWriteMktOrdsWhileRunning, 1 ; Write closed orders in a .csv file during yFt run and do not save them in system memory
\n
'
+
'
\n
'
+
'
bEnableBestTpSlFinderForPosHist, 0 ; 0 or 1, Def. 1, Set to 0 for fast output in ParamLoop runs
\n
'
+
'
\n
'
+
'
bSaveParamLoopRunResultsInCsv, 1 ; 0 or 1, Def. 0, Save ParamLoop run results in a .csv file
\n
'
+
'
\n
'
+
'
; Help: Full column list will be like as follows:
\n
'
+
'
;enumOrdSaveCsvColumn_List, RowNu,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
; Help: Here is list of colums:
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP
\n
'
+
'
; ,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec
\n
'
+
'
; ,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips
\n
'
+
'
; ,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap
\n
'
+
'
; ,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd
\n
'
+
'
; ,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
;enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Lots,Symbol,Open_Price,Close_Price,Close_Time, ProfitPips,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Symbol,Open_Price,Close_Price,Close_Time, dPrfPipWrtOpPrPc,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\t\t\t\t\n
'
+
'
; Display Parameters ==================================================
\n
'
+
'
; nOxyDispQtsQueLen, 0 ; #, Typ.: 1/5 of screen width
\n
'
+
'
\n
'
+
'
; bOxypDisp_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
;OxypDispBarsAgeSym1, 0d 01:00:00.000 ; Nd HH:mm:ss.fff
\n
'
+
'
\n
'
+
'
; bOxyDisp_Equity, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_Balance, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_EffLot, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;adOxyDisp_FirstYaxisSplitPos, 0.3, 0.4 ; CSV List of #
\n
'
+
'
;bOxyDisp_AutoSplitPosInFirstYaxis, 1 ; 0 or 1, Def. is 1
\n
'
let
indicator3Temp
=
'
yFt1_AlgName, yFt1_KivOzbStochOtt1a
\n
'
+
'
\n
'
+
'
; Note: See TradingView "Stochastic OTT, Pine.txt"
\n
'
+
'
\n
'
+
'
; Symbol ==============================================================
\n
'
+
'
nQtSymNo_Tgt1, 1 ; #, In both TkSim and LiveRun
\n
'
+
'
\n
'
+
'
Sym1_Tgt1, BNC_BTCUSDT
\n
'
+
'
nDigits_Sym1_Tgt1, 3 ; #
\n
'
+
'
dTickValue_Sym1_Tgt1, 0.001 ; $
\n
'
+
'
dMarginValReqPerLot_Sym1_Tgt1, 10000 ; $
\n
'
+
'
\n
'
+
'
szOhlcCsvFpn_Sym1_Tgt1, "E:
\\
BTC.csv"
\n
'
+
'
stOhlcCsvFileBarAge_Sym1_Tgt1, 0d 00:05:00.000 ; Nd HH:mm:ss.fff, Typ. 28d 00:00:00.000
\n
'
+
'
enumOhlcCsvFileType_Sym1_Tgt1, TradingViewEpochSecondsOHLC
\n
'
+
'
bOhlcCsvFileHasHeader_Sym1_Tgt1, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
dOhlcCsvFileFromCandleTickExtractorFact_Sym1_Tgt1, 1.0 ; FpValue, Def. 1.0, Higher means extracting more ticks from each candle
\n
'
+
'
\n
'
+
'
; Tick Simulator Run Time =============================================
\n
'
+
'
dtTkSimLookBackStTime, 2022.03.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadStTime, 2022.03.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadEnTime, 2050.08.26 12:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
\n
'
+
'
; First quote is 2017.08.24 02:59:00
\n
'
+
'
\n
'
+
'
; StatInfo Parameters =================================================
\n
'
+
'
stMnRefHopAge, 0d 00:00:19.000 ; Nd HH:mm:ss.fff, Typ. 0d 00:00:19.000
\n
'
+
'
\n
'
+
'
; Signal Parameters ===================================================
\n
'
+
'
; Note: If use szOhlcCsvFpn_Sym1_Tgt1 then stMnMaBarAge will be adjusted based on CSV lines
\n
'
+
'
bForMnBarAge_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; ParamLoop -----------------------------------------------------------
\n
'
+
'
stMnBarAge_List, ahmadTimeframe
\n
'
+
'
nStochPeriod_List, ahmadnStochPeriod ; #, Def. 500 (%K Length)
\n
'
+
'
nStochSmoothingPeriod_List, ahmadnStochSmoothingPeriod ; #, , Def. 200 (%K Smoothing)
\n
'
+
'
dOttPercent_List, ahmaddOttPercent ; FpNum, Def. 0.5 (OTT Percent)
\n
'
+
'
nOttPeriod_List, ahmadnOttPeriod ; #, Def. 2 (OTT Period)
\n
'
+
'
\n
'
+
'
\n
'
+
'
enumSrcType_List, Close ; "Open", "High", "Low", "Close", "HL2", "HLC3", "OHLC4"
\n
'
+
'
; bInverseEntSig_List, 0, 1
\n
'
+
'
\n
'
+
'
; bOxyDisp_SrcVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnMaVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnTrailLines, 0 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
; Trading Parameters ==================================================
\n
'
+
'
; Trading simulation start equity
\n
'
+
'
dTkSimStEquityUsd, 10000 ; $, Def. is $10,000 (Initial Capital)
\n
'
+
'
\n
'
+
'
nMnTrdMethodNum, 1 ; #, 0 to disable
\n
'
+
'
;nEntSignalCodeNum, 1 ; #, 1: MaPmaxCx, 2: SrcPmaxCx, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Enter Param. ------------------------------------------------
\n
'
+
'
dFixedOrdLot_Sym1_Tgt1, 0.1 ; lot, Note: 0.1 lot here is equal to 10000 order size in trading view
\n
'
+
'
\n
'
+
'
;nMaxOneDirOrdNo, 1 ; #
\n
'
+
'
\n
'
+
'
;bInverseEntSig, 1
\n
'
+
'
\n
'
+
'
bWaitToPassFirstCrossToEnableEnt, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Exit Param. -------------------------------------------------
\n
'
+
'
bClOppDirOrds, 1 ; 0 or 1, Def. is 0
\n
'
+
'
\n
'
+
'
bOkToOpenAndCloseChkAtSameQt, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;nInitTpPip_Sym1_Tgt1, 200 ; pip
\n
'
+
'
;nInitSlPip_Sym1_Tgt1, 100 ; pip
\n
'
+
'
\n
'
+
'
; Log Parameters ======================================================
\n
'
+
'
bSaveOrdMgmResults, 1 ; 0 or 1, Def. 0, Save list of orders in a .csv file(s)
\n
'
+
'
bKeepPosHistOfTradeSim, 0 ; 0 or 1, Def. 1, Note: Set to 0 for ParamLoop runs
\n
'
+
'
\n
'
+
'
bWriteMktOrdsWhileRunning, 1 ; Write closed orders in a .csv file during yFt run and do not save them in system memory
\n
'
+
'
\n
'
+
'
bEnableBestTpSlFinderForPosHist, 0 ; 0 or 1, Def. 1, Set to 0 for fast output in ParamLoop runs
\n
'
+
'
\n
'
+
'
bSaveParamLoopRunResultsInCsv, 1 ; 0 or 1, Def. 0, Save ParamLoop run results in a .csv file
\n
'
+
'
\n
'
+
'
; Help: Full column list will be like as follows:
\n
'
+
'
;enumOrdSaveCsvColumn_List, RowNu,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
; Help: Here is list of colums:
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP
\n
'
+
'
; ,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec
\n
'
+
'
; ,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips
\n
'
+
'
; ,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap
\n
'
+
'
; ,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd
\n
'
+
'
; ,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
;enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Lots,Symbol,Open_Price,Close_Price,Close_Time, ProfitPips,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Symbol,Open_Price,Close_Price,Close_Time, dPrfPipWrtOpPrPc,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\t\t\t\t\n
'
+
'
; Display Parameters ==================================================
\n
'
+
'
; nOxyDispQtsQueLen, 0 ; #, Typ.: 1/5 of screen width
\n
'
+
'
\n
'
+
'
; bOxypDisp_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
;OxypDispBarsAgeSym1, 0d 01:00:00.000 ; Nd HH:mm:ss.fff
\n
'
+
'
\n
'
+
'
; bOxyDisp_Equity, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_Balance, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_EffLot, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;adOxyDisp_FirstYaxisSplitPos, 0.3, 0.4 ; CSV List of #
\n
'
+
'
;bOxyDisp_AutoSplitPosInFirstYaxis, 1 ; 0 or 1, Def. is 1
\n
'
let
indicator4
=
'
yFt1_AlgName, yFt1_KeltnerChnlBrk1a
\n
'
+
'
\n
'
+
'
; Note: See "Keltner Channels Strategy, Pine.txt"
\n
'
+
'
\n
'
+
'
; Symbol ==============================================================
\n
'
+
'
nQtSymNo_Tgt1, 1 ; #, In both TkSim and LiveRun
\n
'
+
'
\n
'
+
'
Sym1_Tgt1, BNC_BTCUSDT
\n
'
+
'
nDigits_Sym1_Tgt1, 3 ; #
\n
'
+
'
dTickValue_Sym1_Tgt1, 0.001 ; $
\n
'
+
'
dMarginValReqPerLot_Sym1_Tgt1, 10000 ; $
\n
'
+
'
\n
'
+
'
szOhlcCsvFpn_Sym1_Tgt1, "E:
\\
BTC.csv"
\n
'
+
'
stOhlcCsvFileBarAge_Sym1_Tgt1, 0d 00:05:00.000 ; Nd HH:mm:ss.fff, Typ. 28d 00:00:00.000
\n
'
+
'
enumOhlcCsvFileType_Sym1_Tgt1, TradingViewEpochSecondsOHLC
\n
'
+
'
bOhlcCsvFileHasHeader_Sym1_Tgt1, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
dOhlcCsvFileFromCandleTickExtractorFact_Sym1_Tgt1, 1.0 ; FpValue, Def. 1.0, Higher means extracting more ticks from each candle
\n
'
+
'
\n
'
+
'
; Tick Simulator Run Time =============================================
\n
'
+
'
dtTkSimLookBackStTime, 1993.01.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadStTime, 1993.01.01 00:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
dtTkSimReadEnTime, 2050.08.26 12:00:00 ; YYYY.MM.DD HH:mm:ss
\n
'
+
'
\n
'
+
'
; First quote is 2017.08.24 02:59:00
\n
'
+
'
\n
'
+
'
; StatInfo Parameters =================================================
\n
'
+
'
stMnRefHopAge, 0d 00:00:19.000 ; Nd HH:mm:ss.fff, Typ. 0d 00:00:19.000
\n
'
+
'
\n
'
+
'
; Signal Parameters ===================================================
\n
'
+
'
; Note: If use szOhlcCsvFpn_Sym1_Tgt1 then stMnMaBarAge will be adjusted based on CSV lines
\n
'
+
'
bForMnMaBarAge_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; ParamLoop -----------------------------------------------------------
\n
'
+
'
stMnMaBarAge_List, ahmadstMnMaBarAge
\n
'
+
'
MnKeltner_nMidLnMaPeriod_List, ahmadMnKeltner_nMidLnMaPeriod ; #, 0 to disable, Typ. 20
\n
'
+
'
MnKeltner_dMultiplier_List, ahmadMnKeltner_dMultiplier ; FpNum, Def. 2.0
\n
'
+
'
MnKeltner_nBandsAtrPeriod_List, ahmadMnKeltner_nBandsAtrPeriod ; #, Def. 10
\n
'
+
'
\n
'
+
'
MnKeltner_enumMidLnSrcType_List, Close ; "Open", "High", "Low", "Close", "HL2", "HLC3", "OHLC4", "ATR", Def. Close
\n
'
+
'
MnKeltner_enumMidLnMaType_List, EMA ; "SMA", "EMA", Def. EMA
\n
'
+
'
MnKeltner_enumBandsStyle_List, ATR ; "ATR", "TR", "Range", Def. ATR
\n
'
+
'
\n
'
+
'
;bInverseEntSig_List, 0, 1
\n
'
+
'
\n
'
+
'
; bOxyDisp_SrcVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnMaVal, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_MnTrailLines, 0 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
; Trading Parameters ==================================================
\n
'
+
'
; Trading simulation start equity
\n
'
+
'
dTkSimStEquityUsd, 10000 ; $, Def. is $10,000 (Initial Capital)
\n
'
+
'
\n
'
+
'
nMnTrdMethodNum, 1 ; #, 0 to disable
\n
'
+
'
;nEntSignalCodeNum, 1 ; #, 1: MaPmaxCx, 2: SrcPmaxCx, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Enter Param. ------------------------------------------------
\n
'
+
'
dFixedOrdLot_Sym1_Tgt1, 0.1 ; lot, Note: 0.1 lot here is equal to 10000 order size in trading view
\n
'
+
'
\n
'
+
'
nAddToStopOrderBlankPip, 1 ; pip, e.g. BuyStop open price will be (High + This)
\n
'
+
'
\n
'
+
'
bAlterCurQtToOpPrAtStopOrdHit, 1 ; 0 or 1, Set to 1 to make open price of stop orders similar to trading view
\n
'
+
'
nMaxOneDirOrdNo, 1 ; #
\n
'
+
'
\n
'
+
'
;bInverseEntSig, 1
\n
'
+
'
\n
'
+
'
bWaitToPassFirstCrossToEnableEnt, 1 ; 0 or 1, Def. 1
\n
'
+
'
\n
'
+
'
; Trading Exit Param. -------------------------------------------------
\n
'
+
'
bClOppDirOrds, 1 ; 0 or 1, Def. is 0
\n
'
+
'
\n
'
+
'
bOkToOpenAndCloseChkAtSameQt, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;nInitTpPip_Sym1_Tgt1, 200 ; pip
\n
'
+
'
;nInitSlPip_Sym1_Tgt1, 100 ; pip
\n
'
+
'
\n
'
+
'
; Log Parameters ======================================================
\n
'
+
'
bSaveOrdMgmResults, 1 ; 0 or 1, Def. 0, Save list of orders in a .csv file(s)
\n
'
+
'
bKeepPosHistOfTradeSim, 0 ; 0 or 1, Def. 1, Note: Set to 0 for ParamLoop runs
\n
'
+
'
\n
'
+
'
bWriteMktOrdsWhileRunning, 1 ; Write closed orders in a .csv file during yFt run and do not save them in system memory
\n
'
+
'
\n
'
+
'
bEnableBestTpSlFinderForPosHist, 0 ; 0 or 1, Def. 1, Set to 0 for fast output in ParamLoop runs
\n
'
+
'
\n
'
+
'
bSaveParamLoopRunResultsInCsv, 1 ; 0 or 1, Def. 0, Save ParamLoop run results in a .csv file
\n
'
+
'
\n
'
+
'
; Help: Full column list will be like as follows:
\n
'
+
'
;enumOrdSaveCsvColumn_List, RowNu,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
; Help: Here is list of colums:
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
; RowNum,Open_Time,Type,Lots,Symbol,Open_Price,SL,TP
\n
'
+
'
; ,Close_Price,Close_Time,ProfitPips,ProfitUsd,Comment,MagicNum,Age_Dhhmmssfff,AgeMsec
\n
'
+
'
; ,TotPrfPips,TotPrfUsd,Open_Time_Ticks,Close_Time_Ticks,nAgeHiPrfPips,nAgeLoPrfPips
\n
'
+
'
; ,InvOpPrice,InvClPrice,Ticket,Expiration_Time,Expiration_Time_Ticks,Commission,Swap
\n
'
+
'
; ,nOmNum,nMyMagCode1,dPrfPipWrtOpPrPc,dAgeHiPrfUsd,dAgeLoPrfUsd
\n
'
+
'
; ,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\n
'
+
'
;enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Lots,Symbol,Open_Price,Close_Price,Close_Time, ProfitPips,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
enumOrdSaveCsvColumn_List, Ticket,Open_Time,Type,Symbol,Open_Price,Close_Price,Close_Time, dPrfPipWrtOpPrPc,dAgeHiPrfInPrPc_RunUpPc,dAgeLoPrfInPrPc_DrawDownPc
\n
'
+
'
\t\t\t\t\n
'
+
'
; Display Parameters ==================================================
\n
'
+
'
; nOxyDispQtsQueLen, 0 ; #, Typ.: 1/5 of screen width
\n
'
+
'
\n
'
+
'
; bOxypDisp_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1
\n
'
+
'
;OxypDispBarsAgeSym1, 0d 01:00:00.000 ; Nd HH:mm:ss.fff
\n
'
+
'
\n
'
+
'
; bOxyDisp_Equity, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_Balance, 0 ; 0 or 1, Def. 0
\n
'
+
'
; bOxyDisp_EffLot, 1 ; 0 or 1, Def. 0
\n
'
+
'
\n
'
+
'
;adOxyDisp_FirstYaxisSplitPos, 0.3, 0.4 ; CSV List of #
\n
'
+
'
;bOxyDisp_AutoSplitPosInFirstYaxis, 1 ; 0 or 1, Def. is 1
\n
'
test_text.js
View file @
227cec08
let
t
=
'
12,2019.10.22 12:00:00.000,Buy,BNC_BTCUSDT,8276.170,7425.960,2019.10.23 16:00:00.000,-10.27,0.26,-10.59
'
let
t
=
'
last.json-220818084032_O1_BNC_BTCUSDT_Lp302_33BTC2.csv
'
t
=
t
.
split
(
'
,
'
)
t
=
t
.
split
(
'
_
'
)
console
.
log
(
t
)
let
pair
=
t
[
3
].
replace
(
'
usdt
'
,
''
).
replace
(
'
usd
'
,
''
)
let
lp
=
t
[
4
].
replace
(
'
lp
'
,
'
Lp
'
)
let
p
=
t
[
t
.
length
-
1
].
split
(
'
.
'
)
p
=
p
[
0
].
split
(
pair
)[
0
]
console
.
log
(
pair
,
lp
,
p
)
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