Commit 3e2f506b authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent efb286d8
let fs=require('fs')
let pair='BTCUSDT'
let nDigits_Sym1_Tgt1=5
let dTickValue_Sym1_Tgt1=0.002
let szOhlcCsvFpn_Sym1_Tgt1="C:\\yMTa - 2\\Set\\AltTest\\ETHUSDT-5M.csv"
let st='yFt1_AlgName, yFt1_LbPvtPtSuperTrend1b\n' +
'; Note: See TradingView "Pivot Point Supertrend, Pine.txt"\n' +
'; Symbol ==============================================================\n' +
'nQtSymNo_Tgt1, 1 ; #, In both TkSim and LiveRun\n' +
'\n' +
'Sym1_Tgt1, BNC_tempPair\n' +
'nDigits_Sym1_Tgt1, tempParam2 ; #\n' +
'dTickValue_Sym1_Tgt1, tempParam3 ; $\n' +
'dMarginValReqPerLot_Sym1_Tgt1, 10000 ; $\n' +
'\n' +
'szOhlcCsvFpn_Sym1_Tgt1, "tempPath"\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' +
'; 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, 2021.12.20 00:00:00 ; YYYY.MM.DD HH:mm:ss\n' +
'dtTkSimReadStTime, 1993.10.01 00:00:00 ; YYYY.MM.DD HH:mm:ss\n' +
'dtTkSimReadEnTime, 2023.12.01 00:00:00 ; YYYY.MM.DD HH:mm:ss\n' +
'; First quote is 2020.01.03 00:00:00 in BINANCE_BTCUSD, 1D (3).csv\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' +
'; PvtPtSuperTrend Ind. 1 ----------------------------------------------\n' +
'PPST1_stMnBarAge_List, 0d 00:05:00.000, 0d 00:10:00.000, 0d 00:15:00.000, 0d 00:20:00.000, 0d 00:25:00.000, 0d 00:30:00.000 ; Nd HH:mm:ss.fff, Typ. 0d 00:00:19.000\n' +
'PPST1_nPivotPointPeriod_List, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 ; #, Def. 2\n' +
'PPST1_dAtrFactor_List, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8, 5.0, 5.2, 5.4, 5.6, 5.8, 6.0 ; FpNum, Def. 3.0\n' +
'PPST1_nAtrPeriod_List, tempRand ; #, Def. 10\n' +
'\n' +
'; PvtPtSuperTrend Ind. 2 ----------------------------------------------\n' +
'PPST2_stMnBarAge_List, 0d 00:00:00.000\n' +
'PPST2_nPivotPointPeriod_List, 2 ; #, Def. 2\n' +
'PPST2_dAtrFactor_List, 3.0 ; FpNum, Def. 3.0\n' +
'PPST2_nAtrPeriod_List, 10 ; #, Def. 10\n' +
'\n' +
'\n' +
'PPST1_bOxyDisp_PivotPoints, 0 ; 0 or 1, Def. 0\n' +
'PPST1_bOxyDisp_PvtPtCenterLine, 0 ; 0 or 1, Def. 0\n' +
'PPST1_bOxyDisp_LbstTrailLines, 1 ; 0 or 1, Def. 0\n' +
'PPST2_bOxyDisp_PivotPoints, 0 ; 0 or 1, Def. 0\n' +
'PPST2_bOxyDisp_PvtPtCenterLine, 0 ; 0 or 1, Def. 0\n' +
'PPST2_bOxyDisp_LbstTrailLines, 1 ; 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' +
'\n' +
'; nEntSignalCodeNum ---------------------------------------------------\n' +
'; 1: Enter: PPST1, Exit: PPST1 trend changes once\n' +
'; 2: Enter: PPST1 && InvPPST2, Exit: PPST2 trend changes once\n' +
'; 3: Enter: PPST1 && InvPPST2, Exit: PPST2 trend changes twice\n' +
'; 4: Enter: PPST1 && InvPPST2, Exit: PPST1 trend changes once\n' +
'nEntSignalCodeNum_List, 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' +
';dRiskPercentForLot, 1 ; %\n' +
'\n' +
';nMaxOneDirOrdNo, 100 ; #\n' +
'\n' +
'bInverseEntSig, 0 ; 0 or 1, Def. 0\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' +
';nMinSpreadPips_Sym1_Tgt1, 0 ; pip\n' +
';nInitTpPip_Sym1_Tgt1, 200 ; pip\n' +
';nInitSlPip_Sym1_Tgt1, 100 ; pip\n' +
'\n' +
'; Trading Fail Safe Ctrl Pm. ------------------------------------------\n' +
'; nClOpOrdPerDayFailSafeThr, 4 ; #, Def. 4000\n' +
'; nClOpOrdPer10MinFailSafeThr, 50 ; #, Def. 50\n' +
'; nOpOrdNoPer10MinFailSafeThr, 203 ; #, Def. 203\n' +
'\n' +
'; stFailSafeByClOpOrdNoPerBar_Age1, 1d 00:00:00.000 ; Nd HH:mm:ss.fff, Typ. 30d 00:00:00.000\n' +
'; nClOpOrdPerGvAge1FailSafeThr, 24 ; #, Def. 200\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' +
'; Display Parameters ==================================================\n' +
'nOxyDispQtsQueLen, 0 ; #, Typ.: 1/5 of screen width\n' +
'\n' +
'bOxypDisp_ForceOhlcCsvFileBarsAge, 0 ; 0 or 1, Def. 1\n' +
'OxypDispBarsAgeSym1, 1d 00:00:00.000 ; Nd HH:mm:ss.fff\n' +
'\n' +
';bOxyDisp_Equity, 1 ; 0 or 1, Def. 0\n' +
';bOxyDisp_Balance, 1 ; 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'
st=st.replace('tempPair',pair)
st=st.replace('tempParam2',nDigits_Sym1_Tgt1)
st=st.replace('tempParam3',dTickValue_Sym1_Tgt1)
st=st.replace('tempPath',szOhlcCsvFpn_Sym1_Tgt1)
run()
async function run()
{
try {
await fs.mkdirSync('ymta')
} catch (e) {
}
try {
await fs.mkdirSync('ymta/' + pair)
} catch (e) {
}
for (let i=1;i<14;i++)
{
let f=i.toString()
let st2=st.replace('tempRand',f)
createfileADV(f,st2)
}
}
async function sleep(millis) {
return new Promise(resolve => setTimeout(resolve, millis));
}
function createfileADV(count,data) {
// console.log(data)
return new Promise(function (resolve, reject) {
fs.writeFile('ymta/'+pair+'/'+count+'.csv', data, 'utf8', function (err) {
if (err) reject(err);
else resolve(data);
});
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment