コード例 #1
0
    entryPrice[:] = []
    entryQuant[:] = []
    exitQuant[:] = []
    trueRanges[:] = []
    myBPV, myComName, myMinMove = getDataAtribs(dataClassList[marketCnt])
    myDate, myOpen, myHigh, myLow, myClose = getDataLists(
        dataClassList[marketCnt])
    for i in range(0, len(myDate)):
        marketPosition.append(0)
        ranges.append(myHigh[i] - myLow[i])
        if i == 0:
            trueRanges.append(ranges[i])
        if i > 0:
            trueRanges.append(
                max(myClose[i - 1], myHigh[i]) - min(myClose[i - 1], myLow[i]))
    systemMarket = systemMarketClass()
    equity = equityClass()
    equItm = 0
    totProfit = 0
    maxPositionL = 0
    maxPositionS = 0
    cumuProfit = 0
    curShares = 0
    numShares = 0
    marketPosition.append(0)
    if len(myDate) < numBarsToGoBack: numBarsToGoBack = len(myDate)
    if numBarsToGoBack < rampUp: break
    #////////  DO NOT CHANGE ABOVE /////////////////////////////////////////////////

    #---------------------------------------------------------------------------------
    #Instantiate Indicator Classes if you need them
コード例 #2
0
ファイル: TripleMovAvg.py プロジェクト: wpr101/SentiSmart
    listOfTrades[:] = []
    marketPosition[:] = []
    entryPrice[:] = []
    entryQuant[:] = []
    exitQuant[:] = []
    trueRanges[:] = []
    myBPV,myComName,myMinMove = getDataAtribs(dataClassList[marketCnt])
    myDate,myOpen,myHigh,myLow,myClose = getDataLists(dataClassList[marketCnt])
    for i in range(0,len(myDate)):
        marketPosition.append(0)
        ranges.append(myHigh[i] - myLow[i])
        if i == 0:
            trueRanges.append(ranges[i])
        if i > 0:
            trueRanges.append(max(myClose[i-1],myHigh[i]) - min(myClose[i-1],myLow[i]))
    systemMarket = systemMarketClass()
    equity = equityClass()
    equItm = 0
    totProfit =0
    maxPositionL = 0
    maxPositionS = 0
    cumuProfit = 0
    curShares = 0
    numShares = 0
    marketPosition.append(0)
    if len(myDate) < numBarsToGoBack: numBarsToGoBack = len(myDate)
    if numBarsToGoBack < rampUp: break
#////////  DO NOT CHANGE ABOVE /////////////////////////////////////////////////

#---------------------------------------------------------------------------------
#Instantiate Indicator Classes if you need them