Спасибо за информацию но сегодня утром я сам сделал,кого интересует держите тестируйте.
# TS_StochasticMomentumIndexDivergence Alert
#
http://www.thinkscripter.com
#
[email protected]
# Last Update 01 Feb 2010
input over_bought = 80.0;
input over_sold = 20.0;
input percentDLength = 3;
input percentKLength = 5;
def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;
def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);
def SMIData = (avgrel / (avgdiff / 2) + 1) * 50;
def isLow = if (SMIData < SMIData[-1] and SMIData < SMIData[1], 1, 0);
def isHigh = if (SMIData > SMIData[-1] and SMIData > SMIData[1], 1, 0);
def prevLowSMI = compoundValue(1,if(isLow[1], SMIData[1], prevLowSMI[1]),0);
def prevHighSMI = compoundValue(1, if(isHigh[1], SMIData[1], prevHighSMI[1]),0);
def prevLow = compoundValue(1, if(isLow[1], low, prevLow[1]),low);
def prevHigh = compoundValue(1, if(isHigh[1], high, prevHigh[1]),high);
def positiveDivergenceReg = if (SMIData > prevLowSMI and low < prevLow, 1, 0);
def positiveDivergenceHid = if (SMIData < prevLowSMI and low > prevLow, 1, 0);
plot posDiv = if(isLow and (positiveDivergenceReg or positiveDivergenceHid), SMIData, Double.Nan);
posDiv.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
posDiv.SetLineWeight(5);
alert(posDiv, "CALL Alert", alert.once, sound.ring);
def negativeDivergenceReg = if (SMIData < prevHighSMI and high > prevHigh, 1, 0);
def negativeDivergenceHid = if (SMIData > prevHighSMI and high < prevHigh, 1, 0);
plot negDiv = if(isHigh and ( negativeDivergenceReg or negativeDivergenceHid), SMIData, Double.Nan);
negDiv.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
negDiv.SetLineWeight(2);
alert(negDiv, "PUT Alert", alert.once, sound.ring);