Пример #1
0
    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
#---------------------------------------------------------------------------------
    rsiStudy = rsiClass()
    stochStudy = stochClass()
    MACDStudy = macdClass()
#---------------------------------------------------------------------------------
    
    for i in range(len(myDate) - numBarsToGoBack,len(myDate)):
        D0 = i
        D1 = i - 1
        D2 = i - 2
        D3 = i - 3
        D4 = i - 4
        equItm += 1
        tempDate = myDate[i]
        todaysCTE = todaysOTE = todaysEquity = 0
        marketPosition[i] = marketPosition[i-1]
        mp = marketPosition[i]
Пример #2
0
    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
    #---------------------------------------------------------------------------------
    rsiStudy = rsiClass()
    stochStudy = stochClass()
    MACDStudy = macdClass()
    #---------------------------------------------------------------------------------

    for i in range(len(myDate) - numBarsToGoBack, len(myDate)):
        D0 = i
        D1 = i - 1
        D2 = i - 2
        D3 = i - 3
        D4 = i - 4
        equItm += 1
        tempDate = myDate[i]
        todaysCTE = todaysOTE = todaysEquity = 0
        marketPosition[i] = marketPosition[i - 1]
        mp = marketPosition[i]