Переделанные и доработанные индикаторы для Thinkorswim!!!

Статус
Закрыто для дальнейших ответов.

kikos

Старейшина
Регистрация
23.09.14
Сообщения
4,554
Реакции
6,126
kikos не предоставил никакой дополнительной информации.
Всем доброго времени суток! Решил создать тему где те кто торгует с помощью платформы Thinkorswim могут выкладывать свои мысли касаемо индикаторов и того что можно прописать в код! Я понемаю что свои наработки некто не желает выкладывать это и понятно потому что вложено много сил а главное времени которое дороже денег да и вокруг много тех кто ничего не делает а просто качает или того хлещё потом продаёт! В данной теме любой может кинуть индюк с элементарной просьбой сделать аллерт или что то добавить в него! У меня почта иной раз разрывается просто из за подобного!Приведу несколько примеров!!!




Вобщем скрины можно кидать до бесконечности! Можете писать даже самые бредовые идеи, но они могут таковыми показаться для вас а на самом деле возможно реальны!
Я торгую на минутках и начну первым это моё малое!))))))))))))
 
Последнее редактирование модератором:

Алексей1986

Новичок
Регистрация
09.07.15
Сообщения
17
Реакции
18
Алексей1986 не предоставил никакой дополнительной информации.
kikos, можешь прикрутить алерт и тестер к стандартному индикатору ТОСа - StochRSI ?
 

kokman

Новичок
Регистрация
28.01.15
Сообщения
95
Реакции
106
kokman не предоставил никакой дополнительной информации.
Собрал тут индюк, из чего попало под руку. На истории очень красиво))) А вот в реале по ходу рисует.
Фильтруется все динамическим каналом Hurst. Если поставить статический 50/50. Как можно сделать чтобы не рисовал?
[POSTS]
Код:
input price1 = hl2;
input length = 10;
def num = fold count = 1 to length with num_temp = 0 do
    num_temp + (1 + count) * price1[count];
def denom = fold count2 = 1 to length with denom_temp = 0 do
    denom_temp + price1[count2];
def Ehler_CG = If(denom == 0, 0, -num / denom);
def CG = Ehler_CG;
def CG1 = Ehler_CG[1];
input pricehurst = hl2;
input lengthHurst = 10;
input InnerValue = 0.02;
input OuterValue = 0.03;
input ExtremeValue = 0.035;
#def displacement = 0;
def displacement = (-lengthHurst / 2) + 1;
def dPrice = pricehurst[displacement];

rec CMA = if !IsNaN(dPrice) then Average(dPrice, AbsValue(lengthHurst)) else CMA[1] + (CMA[1] - CMA[2]);

def OscValue =
    if high >= high[1] and low <= low[1]
    then
        if close >= close[1]    # high >= high[2]
        then high
        else low
    else
        if high > high[1]
        then high
        else
            if low < low[1]
            then low
            else
                if close > close[1]
                then high
                else
                    if close < close[1]
                    then low
                    else (high + low) / 2;

def HurstOsc = (100 * OscValue / CMA) - 100;

def CenterLine       =   0;
def UpperExtremeBand =   ExtremeValue;
def LowerExtremeBand = - ExtremeValue;
def UpperOuterBand   =   OuterValue;
def LowerOuterBand   = - OuterValue;
def UpperInnerBand   =   InnerValue;
def LowerInnerBand   = - InnerValue;

def up3 = HurstOsc <= - ExtremeValue;
def down3 = HurstOsc >= ExtremeValue;


#
plot UP1 =  if CG crosses above CG1 and up3 then 1 else 0;
UP1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UP1.SetLineWeight(5);
UP1.SetDefaultColor(Color.WHITE);
Alert (UP1, "UP", Alert.BAR, Sound.Ring);
#
plot down1 =  if CG crosses below CG1 and down3 then 1 else 0;
down1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
down1.SetLineWeight(5);
down1.SetDefaultColor(Color.WHITE);
Alert(down1, "DOWN", Alert.BAR, Sound.Ring);

input price = close;
input stdevLength = 5;
input avgOfStdevLength = 9;
input ZMLength = 14;
input ZMLengthLowerLimit = 3;
input ZMLengthUpperLimit = 30;
input Over_Bought = 90;
input Over_sold = 10;
Assert(ZMLengthLowerLimit > 0, "'ZM length lower limit' must be positive: " + ZMLengthLowerLimit);
Assert(ZMLength between ZMLengthLowerLimit and ZMLengthUpperLimit, "'ZM length' must be between lower and upper limit: " + ZMLength);

def std = StDev(price, stdevLength);
def ratio = std / Average(std, avgOfStdevLength);
def dynamicLength = Floor(ZMLength / ratio);
def limitedLength = if dynamicLength between ZMLengthLowerLimit and ZMLengthUpperLimit then dynamicLength else 0;
def sf = 2 / (limitedLength + 1);
def bn = Max(BarNumber(), 0);
# 10^-5 precision for ema multiplier
def expIndex = if limitedLength == 0 then 1 else Max(1, bn - Ceil(-5 / Lg(1 - sf)));
def fromIndex = if IsNaN(expIndex) then 1 else expIndex;
def chg = price - price[1];
def absChg = AbsValue(chg);
def netChgAvg = fold indexN = fromIndex to bn + 1 with accuN do sf * (if IsNaN(GetValue(chg, bn - indexN)) then 0 else GetValue(chg,
bn - indexN)) + (1 - sf) * accuN;
def totChgAvg = fold indexT = fromIndex to bn + 1 with accuT do sf * (if IsNaN(GetValue(absChg, bn - indexT)) then 0 else GetValue
(absChg, bn - indexT)) + (1 - sf) * accuT;
def RSI = if totChgAvg != 0 and limitedLength != 0 then 50 * (netChgAvg / totChgAvg + 1) else RSI[1];


#############################

def ZM = RSI;
def OverBought = Over_Bought;
def OverSold = Over_sold;
def centr1 = 50;
def centr2 = 50;

plot Up2 =  ZM crosses below OverSold and up3;
Up2.SetStyle(Curve.POINTS);
Up2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Up2.SetLineWeight(5);
Up2.SetDefaultColor(Color.DARK_GREEN);
Alert (Up2, "UP", Alert.BAR, Sound.Ring);
AddLabel(Up2, "Вверх", if Up2 then Color.DARK_GREEN else Color.RED);
plot Down2 =  ZM crosses above OverBought and down3;
Down2.SetStyle(Curve.POINTS);
Down2.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Down2.SetLineWeight(5);
Down2.SetDefaultColor(Color.RED);
Alert(Down2, "DOWN", Alert.BAR, Sound.Ring);
AddLabel(Down2, "Вниз", if Down2 then Color.RED else Color.DARK_GREEN);

input over_boughtp = 80.0;
input over_soldp = 20.0;
input percentDLength = 4;
input percentKLength = 6;

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 SMI = (avgrel / (avgdiff / 2) + 1) * 50;
def AvgSMI = ExpAverage(SMI, percentDLength);

plot up4 = if SMI > AvgSMI and SMI[1]<=AvgSMI[1] and SMI < over_soldp and up3 then 1 else 0;
up4.setLineWeight(5);
up4.setDefaultColor(color.DARK_GREEN);
up4.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
Alert (up4,"UP",Alert.Bar,Sound.ring);
AddLabel(up4, "Вверх", if up4 then Color.DARK_GREEN else Color.RED);

plot down4 = if SMI < AvgSMI and SMI[1]>=AvgSMI[1] and SMI > over_boughtp  and down3 then 1 else 0;
down4.setLineWeight(5);
down4.setDefaultColor(color.red);
down4.setPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
Alert(down4,"DOWN",Alert.Bar,Sound.ring);
AddLabel(down4, "Вниз", if down4 then Color.RED else Color.DARK_GREEN);

#######CCI
input longLength = 14;
input CCIOversold = -200;
input CCIOverbought = 200;

def pricecc = close;
def LCCI = CCI(length = longLength);

#def sCCI_BUY = LCCI crosses above CCIOverbought;
#def sCCI_SELL = LCCI crosses below CCIOversold;

#########WATERFALL
def WaterfallDn = if (close[3] <= open[3] and close[2] <= open[2] and close[1] <= open[1] and close[0] <= close[1]) then 1 else 0;

def WaterfallUp = if (close[3] >= open[3] and close[2] >= open[2] and close[1] >= open[1] and close[0] >= close[1]) then 1 else 0;


rec up = if Up2 or UP1 or up4 then 1 else 0;
rec down = if Down2 or DOWN1 or down4 then 1 else 0;

##########---------------------------TEST OPTIONS---------------------------------------------
#hint timetest: Test according to timeperiods
#hint expiry: Numbers of candles after signal (1 = next candle after signal, 2 = second candle)
#hint secondcandle: Use only if candleexpiry = 1. Adding signals taking second candle after loss
#hint moneycount: display labels with profit/loss in $
#hint invest: amount of investment per trade
#hint RPI: Return Per Investment (payout)

input expiry = 1;
input secondcandle = no;
input moneycount = no;
input invest = 25;
input RPI = 0.80;
input timetest = no;

########-------------------------------------------TIME FILTER-----------------------------------------------
#hint TradingOpen1: EST NY TIME
input TradingOpen1 = 330;
input TradingClose1 = 530;
input TradingOpen2 = 0930;
input TradingClose2 = 1130;

#hint input AsiaOpenTime1 = 2000;
#hint input AsiaCloseTime1 = 2359;
#hint input AsiaOpenTime2 = 0000;
#hint input AsiaCloseTime2 = 0200;
#hint input EUOpenTime = 330;
#hint input EUCloseTime = 530;
#hint input USOpenTime = 0930;
#hint input USCloseTime = 1130;

# Set below to 'True' to allow for DST difference adjustment if you are setting
# windows up for a european instrument like the euro.
input EnableDSTAutoAdjust = {default "Yes", "No"};
input DSTOffsetHours = 1;

#==========================================================================
#  Figure out DST adjustment for diffence between USA and europe
#==========================================================================
#basically, if we are after the 2nd Sunday in March and before
#the last Sunday in March, we need to offset the Trading Windows by 1hr forward
#if we are after the last Sunday in Oct, until the 1st Sunday in Nov
# we need to offset the trading windows by 1hr backward...
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

#What is the first day of the week for the 1st of this month?
def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstSundayDOM1 = if Day1DOW1 < 7
    then 7 - Day1DOW1 + 1
    else 1;

def SecondSundayOfMonth = FirstSundayDOM1 + 7;
def isMarch = If (CurrentMonth == 3, 1, 0);
def SpringDSTShiftStart = If (isMarch and (SecondSundayOfMonth <= CurrentDOM), 1, 0);

#last sunday in march...
def SpringDSTShiftStop = If (isMarch and ((SecondSundayOfMonth + 14) > CurrentDOM), 1, 0);
def DoSpringShift = If (SpringDSTShiftStart and SpringDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isOctober = If (CurrentMonth == 10, 1, 0);
def isNovember = If (CurrentMonth == 11, 1, 0);
def FallDSTShiftStart = If (isOctober and ((SecondSundayOfMonth + 14) <= CurrentDOM), 1, 0);
def FallDSTShiftStop = If (isNovember and FirstSundayDOM1 > CurrentDOM, 1, 0);
def DoFallShift = If (FallDSTShiftStart or FallDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isToday = If(GetDay() == GetLastDay(), 1, 0);

#PITA.  SecondsTillTime only takes constants...  Need to manually adjust for DST if it's enabled.
def DSTAdjust = If (DoSpringShift, DSTOffsetHours * 3600, If (DoFallShift, -DSTOffsetHours * 3600, 0));


def TradingOpenTime1 = If((SecondsTillTime(TradingOpen1) + DSTAdjust > 0), 0, 1);
def TradingCloseTime1 = If((SecondsTillTime(TradingClose1) + DSTAdjust > 0), 0, 1);
def TradingWindow1 = If(TradingOpenTime1 and !TradingCloseTime1, 1, 0);

def TradingOpenTime2 = If((SecondsTillTime(TradingOpen2) + DSTAdjust > 0), 0, 1);
def TradingCloseTime2 = If((SecondsTillTime(TradingClose2) + DSTAdjust > 0), 0, 1);
def TradingWindow2 = If(TradingOpenTime2 and !TradingCloseTime2, 1, 0);


AddVerticalLine(TradingWindow1 and TradingWindow1[1] == 0 and timetest, "TradingOpen 1" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow1 == 0 and TradingWindow1[1] and timetest, "TradingClose 1" , Color.RED, Curve.SHORT_DASH);

AddVerticalLine(TradingWindow2 and TradingWindow2[1] == 0 and timetest, "TradingOpen 2" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow2 == 0 and TradingWindow2[1] and timetest, "TradingClose 2" , Color.RED, Curve.SHORT_DASH);


#####-------------------------------------TESTER-----------------------------------------------------

def ITM1 = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (Up[expiry] and  close[0] > close[expiry]) or (Down[expiry] and close[0] < close[expiry]) or (secondcandle and Up[2] and close[1] < close[2] and close > close[1]) or (secondcandle and Down[2] and close[1] > close[2] and close < close[1]) then 1 else 0;
def itm = if IsNaN(ITM1) then 0 else ITM1;
def itmsum = TotalSum(itm);

def OTM1 = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (Up[expiry] and  close[0] < close[expiry]) or (Down[expiry] and close[0] > close[expiry]) or (secondcandle and Up[2] and close[1] < close[2] and close < close[1]) or (secondcandle and Down[2] and close[1] > close[2] and close > close[1]) then 1 else 0;
def otm = if IsNaN(OTM1) then 0 else OTM1;
def otmsum = TotalSum(otm);

def itmrate =  RoundUp((itmsum / (itmsum + otmsum) * 100), 2);
def label = 1;

AddLabel(label, Concat("ITM = ",  itmsum), Color.GREEN);
AddLabel(label, Concat("OTM = ", otmsum), Color.RED);
AddLabel(label, Concat("ITM RATE = %", itmrate), Color.WHITE);

#####---------Moneycount--------------------------------------------
def PL = invest * itmsum * RPI - invest * otmsum;
def PLColor = if PL > 0 then 6 else 5;

AddLabel(moneycount, Concat("PROFIT/LOSS = $", PL), GetColor(PLColor));
[/POSTS]
 

asl123

Местный
Регистрация
08.02.15
Сообщения
427
Реакции
602
asl123 не предоставил никакой дополнительной информации.
Собрал тут индюк, из чего попало под руку. На истории очень красиво))) А вот в реале по ходу рисует.
Фильтруется все динамическим каналом Hurst. Если поставить статический 50/50. Как можно сделать чтобы не рисовал?

Вот вариант замены рисующего СМА на подбор нерисующей машки (CMA_type)
 

Вложения

  • kokmanSTUDY.ts
    12.1 КБ · Просмотры: 46

kokman

Новичок
Регистрация
28.01.15
Сообщения
95
Реакции
106
kokman не предоставил никакой дополнительной информации.
Вот вариант замены рисующего СМА на подбор нерисующей машки (CMA_type)
спасибо asl123! в принципе получилось тоже самое что и при статичном херст, но все равно итм поднялся на 2-3%. А ты можешь визуально показать отделым индикатором как рисует машка с херстом? чтоб понимать в какой момент происходит фильтр...
 

asl123

Местный
Регистрация
08.02.15
Сообщения
427
Реакции
602
asl123 не предоставил никакой дополнительной информации.
спасибо asl123! в принципе получилось тоже самое что и при статичном херст, но все равно итм поднялся на 2-3%. А ты можешь визуально показать отделым индикатором как рисует машка с херстом? чтоб понимать в какой момент происходит фильтр...

Ну вот вариант херст осциллятора, который рисует две линии - рисующую по СМА и нерисующую с выбором машки для него.
 

Вложения

  • HurstOsc_compareSTUDY.ts
    3.3 КБ · Просмотры: 35

kikos

Старейшина
Регистрация
23.09.14
Сообщения
4,554
Реакции
6,126
kikos не предоставил никакой дополнительной информации.
kikos, можешь прикрутить алерт и тестер к стандартному индикатору ТОСа - StochRSI ?
Привет!
Для всех друзья когда просите что то прописать посторайтесь как можно чётче и подробней описать что надо именно чтоб потом не переделывать ( это время потраченное впустую )!
 

kikos

Старейшина
Регистрация
23.09.14
Сообщения
4,554
Реакции
6,126
kikos не предоставил никакой дополнительной информации.
немогу почемуто загрузить индюком и кидаю кодом!

#KIKOS
#StochasticRSI
#04.10.2015
declare upper;

input RSI_length = 14;
input over_bought = 80;
input over_sold = 20;
input RSI_average_type = AverageType.WILDERS;
input RSI_price = close;
input KPeriod = 14;
input DPeriod = 3;
input slowing_period = 1;
input averageType = AverageType.SIMPLE;

def RSI = RSI(price = RSI_price, length = RSI_length, averageType = RSI_average_type);

def FullK = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullK;
def FullD = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullD;
def OverBought = over_bought;
def OverSold = over_sold;

plot up = if FullK < OverSold and FullK[1] > OverSold then 1 else 0;
plot down = if FullK > OverBought and FullK[1] < OverBought then 1 else 0;

up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
up.SetLineWeight(5);
up.SetDefaultColor(Color.WHITE);
Alert (up, "UP", Alert.BAR, Sound.Ring);

down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
down.SetLineWeight(5);
down.SetDefaultColor(Color.WHITE);
Alert(down, "DOWN", Alert.BAR, Sound.Ring);

AddLabel(Down, "$", Color.RED);

#######################################3
##########---------------------------TEST OPTIONS---------------------------------------------
#hint timetest: Test according to timeperiods
#hint expiry: Numbers of candles after signal (1 = next candle after signal, 2 = second candle)
#hint secondcandle: Use only if candleexpiry = 1. Adding signals taking second candle after loss
#hint moneycount: display labels with profit/loss in $
#hint invest: amount of investment per trade
#hint RPI: Return Per Investment (payout)


input expiry = 1;
input secondcandle = no;
input moneycount = no;
input invest = 25;
input RPI = 0.80;
input timetest = no;

########-------------------------------------------TIME FILTER-----------------------------------------------
#hint TradingOpen1: EST NY TIME
input TradingOpen1 = 330;
input TradingClose1 = 530;
input TradingOpen2 = 0930;
input TradingClose2 = 1130;

#hint input AsiaOpenTime1 = 2000;
#hint input AsiaCloseTime1 = 2359;
#hint input AsiaOpenTime2 = 0000;
#hint input AsiaCloseTime2 = 0200;
#hint input EUOpenTime = 330;
#hint input EUCloseTime = 530;
#hint input USOpenTime = 0930;
#hint input USCloseTime = 1130;

# Set below to 'True' to allow for DST difference adjustment if you are setting
# windows up for a european instrument like the euro.
input EnableDSTAutoAdjust = {default "Yes", "No"};
input DSTOffsetHours = 1;

#==========================================================================
# Figure out DST adjustment for diffence between USA and europe
#==========================================================================
#basically, if we are after the 2nd Sunday in March and before
#the last Sunday in March, we need to offset the Trading Windows by 1hr forward
#if we are after the last Sunday in Oct, until the 1st Sunday in Nov
# we need to offset the trading windows by 1hr backward...
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

#What is the first day of the week for the 1st of this month?
def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstSundayDOM1 = if Day1DOW1 < 7
then 7 - Day1DOW1 + 1
else 1;

def SecondSundayOfMonth = FirstSundayDOM1 + 7;
def isMarch = If (CurrentMonth == 3, 1, 0);
def SpringDSTShiftStart = If (isMarch and (SecondSundayOfMonth <= CurrentDOM), 1, 0);

#last sunday in march...
def SpringDSTShiftStop = If (isMarch and ((SecondSundayOfMonth + 14) > CurrentDOM), 1, 0);
def DoSpringShift = If (SpringDSTShiftStart and SpringDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isOctober = If (CurrentMonth == 10, 1, 0);
def isNovember = If (CurrentMonth == 11, 1, 0);
def FallDSTShiftStart = If (isOctober and ((SecondSundayOfMonth + 14) <= CurrentDOM), 1, 0);
def FallDSTShiftStop = If (isNovember and FirstSundayDOM1 > CurrentDOM, 1, 0);
def DoFallShift = If (FallDSTShiftStart or FallDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isToday = If(GetDay() == GetLastDay(), 1, 0);

#PITA. SecondsTillTime only takes constants... Need to manually adjust for DST if it's enabled.
def DSTAdjust = If (DoSpringShift, DSTOffsetHours * 3600, If (DoFallShift, -DSTOffsetHours * 3600, 0));


def TradingOpenTime1 = If((SecondsTillTime(TradingOpen1) + DSTAdjust > 0), 0, 1);
def TradingCloseTime1 = If((SecondsTillTime(TradingClose1) + DSTAdjust > 0), 0, 1);
def TradingWindow1 = If(TradingOpenTime1 and !TradingCloseTime1, 1, 0);

def TradingOpenTime2 = If((SecondsTillTime(TradingOpen2) + DSTAdjust > 0), 0, 1);
def TradingCloseTime2 = If((SecondsTillTime(TradingClose2) + DSTAdjust > 0), 0, 1);
def TradingWindow2 = If(TradingOpenTime2 and !TradingCloseTime2, 1, 0);


AddVerticalLine(TradingWindow1 and TradingWindow1[1] == 0 and timetest, "TradingOpen 1" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow1 == 0 and TradingWindow1[1] and timetest, "TradingClose 1" , Color.RED, Curve.SHORT_DASH);

AddVerticalLine(TradingWindow2 and TradingWindow2[1] == 0 and timetest, "TradingOpen 2" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow2 == 0 and TradingWindow2[1] and timetest, "TradingClose 2" , Color.RED, Curve.SHORT_DASH);


#####-------------------------------------TESTER-----------------------------------------------------

def ITM = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (up[expiry] and close[0] > close[expiry]) or (down[expiry] and close[0] < close[expiry]) or (secondcandle and up[2] and close[1] < close[2] and close > close[1]) or (secondcandle and down[2] and close[1] > close[2] and close < close[1]) then 1 else 0;
def itmsum = TotalSum(ITM);

def OTM = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (up[expiry] and close[0] < close[expiry]) or (down[expiry] and close[0] > close[expiry]) or (secondcandle and up[2] and close[1] < close[2] and close < close[1]) or (secondcandle and down[2] and close[1] > close[2] and close > close[1]) then 1 else 0;
def otmsum = TotalSum(OTM);

def itmrate = RoundUp((itmsum / (itmsum + otmsum) * 100), 2);
def label = 1;

AddLabel(label, Concat("ITM = ", itmsum), Color.GREEN);
AddLabel(label, Concat("OTM = ", otmsum), Color.RED);
AddLabel(label, Concat("ITM RATE = %", itmrate), Color.WHITE);

#####---------Moneycount--------------------------------------------
def PL = invest * itmsum * RPI - invest * otmsum;
def PLColor = if PL > 0 then 6 else 5;

AddLabel(moneycount, Concat("PROFIT/LOSS = $", PL), GetColor(PLColor));
 

Алексей1986

Новичок
Регистрация
09.07.15
Сообщения
17
Реакции
18
Алексей1986 не предоставил никакой дополнительной информации.
Привет!
Для всех друзья когда просите что то прописать посторайтесь как можно чётче и подробней описать что надо именно чтоб потом не переделывать ( это время потраченное впустую )!

Понял свою ошибку, исправлюсь.
Интересует алерт в момент пробития уровня обоими стохастиками, пробитие верхнего уровня - алерт вниз, пробитие нижнего уровня - алерт вверх.
 

Алексей1986

Новичок
Регистрация
09.07.15
Сообщения
17
Реакции
18
Алексей1986 не предоставил никакой дополнительной информации.
Понял свою ошибку, исправлюсь.
Интересует алерт в момент пробития уровня обоими стохастиками, пробитие верхнего уровня - алерт вниз, пробитие нижнего уровня - алерт вверх.
я сам врубился как это сделать, по сути надо было пробитие только медленныс стохастиком забить тк когда он пробивает то быстрый уже пробил

прописал
plot up = if FullD < OverSold and FullD[1] > OverSold then 1 else 0;
plot down = if FullD > OverBought and FullD[1] < OverBought then 1 else 0;
вместо
plot up = if FullK < OverSold and FullK[1] > OverSold then 1 else 0;
plot down = if FullK > OverBought and FullK[1] < OverBought then 1 else 0;

и получил то что хотел.

Спасибо за помощь!
 

kuzinvitaliy

Местный
Регистрация
08.03.15
Сообщения
334
Реакции
179
kuzinvitaliy не предоставил никакой дополнительной информации.

Michael Boston

Заблокирован
Регистрация
20.08.15
Сообщения
132
Реакции
46
Michael Boston не предоставил никакой дополнительной информации.
немогу почемуто загрузить индюком и кидаю кодом!

#KIKOS
#StochasticRSI
#04.10.2015
declare upper;

input RSI_length = 14;
input over_bought = 80;
input over_sold = 20;
input RSI_average_type = AverageType.WILDERS;
input RSI_price = close;
input KPeriod = 14;
input DPeriod = 3;
input slowing_period = 1;
input averageType = AverageType.SIMPLE;

def RSI = RSI(price = RSI_price, length = RSI_length, averageType = RSI_average_type);

def FullK = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullK;
def FullD = StochasticFull(over_bought, over_sold, KPeriod, DPeriod, RSI, RSI, RSI, slowing_period, averageType).FullD;
def OverBought = over_bought;
def OverSold = over_sold;

plot up = if FullK < OverSold and FullK[1] > OverSold then 1 else 0;
plot down = if FullK > OverBought and FullK[1] < OverBought then 1 else 0;

up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
up.SetLineWeight(5);
up.SetDefaultColor(Color.WHITE);
Alert (up, "UP", Alert.BAR, Sound.Ring);

down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
down.SetLineWeight(5);
down.SetDefaultColor(Color.WHITE);
Alert(down, "DOWN", Alert.BAR, Sound.Ring);

AddLabel(Down, "$", Color.RED);

#######################################3
##########---------------------------TEST OPTIONS---------------------------------------------
#hint timetest: Test according to timeperiods
#hint expiry: Numbers of candles after signal (1 = next candle after signal, 2 = second candle)
#hint secondcandle: Use only if candleexpiry = 1. Adding signals taking second candle after loss
#hint moneycount: display labels with profit/loss in $
#hint invest: amount of investment per trade
#hint RPI: Return Per Investment (payout)


input expiry = 1;
input secondcandle = no;
input moneycount = no;
input invest = 25;
input RPI = 0.80;
input timetest = no;

########-------------------------------------------TIME FILTER-----------------------------------------------
#hint TradingOpen1: EST NY TIME
input TradingOpen1 = 330;
input TradingClose1 = 530;
input TradingOpen2 = 0930;
input TradingClose2 = 1130;

#hint input AsiaOpenTime1 = 2000;
#hint input AsiaCloseTime1 = 2359;
#hint input AsiaOpenTime2 = 0000;
#hint input AsiaCloseTime2 = 0200;
#hint input EUOpenTime = 330;
#hint input EUCloseTime = 530;
#hint input USOpenTime = 0930;
#hint input USCloseTime = 1130;

# Set below to 'True' to allow for DST difference adjustment if you are setting
# windows up for a european instrument like the euro.
input EnableDSTAutoAdjust = {default "Yes", "No"};
input DSTOffsetHours = 1;

#==========================================================================
# Figure out DST adjustment for diffence between USA and europe
#==========================================================================
#basically, if we are after the 2nd Sunday in March and before
#the last Sunday in March, we need to offset the Trading Windows by 1hr forward
#if we are after the last Sunday in Oct, until the 1st Sunday in Nov
# we need to offset the trading windows by 1hr backward...
def CurrentYear = GetYear();
def CurrentMonth = GetMonth();
def CurrentDOM = GetDayOfMonth(GetYYYYMMDD());

#What is the first day of the week for the 1st of this month?
def Day1DOW1 = GetDayOfWeek(CurrentYear * 10000 + CurrentMonth * 100 + 1);
def FirstSundayDOM1 = if Day1DOW1 < 7
then 7 - Day1DOW1 + 1
else 1;

def SecondSundayOfMonth = FirstSundayDOM1 + 7;
def isMarch = If (CurrentMonth == 3, 1, 0);
def SpringDSTShiftStart = If (isMarch and (SecondSundayOfMonth <= CurrentDOM), 1, 0);

#last sunday in march...
def SpringDSTShiftStop = If (isMarch and ((SecondSundayOfMonth + 14) > CurrentDOM), 1, 0);
def DoSpringShift = If (SpringDSTShiftStart and SpringDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isOctober = If (CurrentMonth == 10, 1, 0);
def isNovember = If (CurrentMonth == 11, 1, 0);
def FallDSTShiftStart = If (isOctober and ((SecondSundayOfMonth + 14) <= CurrentDOM), 1, 0);
def FallDSTShiftStop = If (isNovember and FirstSundayDOM1 > CurrentDOM, 1, 0);
def DoFallShift = If (FallDSTShiftStart or FallDSTShiftStop and EnableDSTAutoAdjust, 1, 0);

def isToday = If(GetDay() == GetLastDay(), 1, 0);

#PITA. SecondsTillTime only takes constants... Need to manually adjust for DST if it's enabled.
def DSTAdjust = If (DoSpringShift, DSTOffsetHours * 3600, If (DoFallShift, -DSTOffsetHours * 3600, 0));


def TradingOpenTime1 = If((SecondsTillTime(TradingOpen1) + DSTAdjust > 0), 0, 1);
def TradingCloseTime1 = If((SecondsTillTime(TradingClose1) + DSTAdjust > 0), 0, 1);
def TradingWindow1 = If(TradingOpenTime1 and !TradingCloseTime1, 1, 0);

def TradingOpenTime2 = If((SecondsTillTime(TradingOpen2) + DSTAdjust > 0), 0, 1);
def TradingCloseTime2 = If((SecondsTillTime(TradingClose2) + DSTAdjust > 0), 0, 1);
def TradingWindow2 = If(TradingOpenTime2 and !TradingCloseTime2, 1, 0);


AddVerticalLine(TradingWindow1 and TradingWindow1[1] == 0 and timetest, "TradingOpen 1" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow1 == 0 and TradingWindow1[1] and timetest, "TradingClose 1" , Color.RED, Curve.SHORT_DASH);

AddVerticalLine(TradingWindow2 and TradingWindow2[1] == 0 and timetest, "TradingOpen 2" , Color.GREEN, Curve.SHORT_DASH);
AddVerticalLine(TradingWindow2 == 0 and TradingWindow2[1] and timetest, "TradingClose 2" , Color.RED, Curve.SHORT_DASH);


#####-------------------------------------TESTER-----------------------------------------------------

def ITM = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (up[expiry] and close[0] > close[expiry]) or (down[expiry] and close[0] < close[expiry]) or (secondcandle and up[2] and close[1] < close[2] and close > close[1]) or (secondcandle and down[2] and close[1] > close[2] and close < close[1]) then 1 else 0;
def itmsum = TotalSum(ITM);

def OTM = if timetest and TradingWindow1 == 0 and TradingWindow2 == 0 then 0 else if (up[expiry] and close[0] < close[expiry]) or (down[expiry] and close[0] > close[expiry]) or (secondcandle and up[2] and close[1] < close[2] and close < close[1]) or (secondcandle and down[2] and close[1] > close[2] and close > close[1]) then 1 else 0;
def otmsum = TotalSum(OTM);

def itmrate = RoundUp((itmsum / (itmsum + otmsum) * 100), 2);
def label = 1;

AddLabel(label, Concat("ITM = ", itmsum), Color.GREEN);
AddLabel(label, Concat("OTM = ", otmsum), Color.RED);
AddLabel(label, Concat("ITM RATE = %", itmrate), Color.WHITE);

#####---------Moneycount--------------------------------------------
def PL = invest * itmsum * RPI - invest * otmsum;
def PLColor = if PL > 0 then 6 else 5;

AddLabel(moneycount, Concat("PROFIT/LOSS = $", PL), GetColor(PLColor));
когда в скайпе появишься ?
 

asl123

Местный
Регистрация
08.02.15
Сообщения
427
Реакции
602
asl123 не предоставил никакой дополнительной информации.

Вложения

  • SupportResistanceMTFSTUDY.ts
    6.9 КБ · Просмотры: 28

kikos

Старейшина
Регистрация
23.09.14
Сообщения
4,554
Реакции
6,126
kikos не предоставил никакой дополнительной информации.

sssss

Старейшина
Регистрация
07.08.14
Сообщения
1,481
Реакции
1,069
sssss не предоставил никакой дополнительной информации.
Ребят подскажите сейчас эту панель нельзя как то скрыть?Скрин создан_‎8 ‎октября ‎2015 ‎г._16h15m58s.png
 

Alexandro

Старейшина
Регистрация
25.04.14
Сообщения
985
Реакции
841
Alexandro не предоставил никакой дополнительной информации.

Вложения

  • Clip2net_151008162307.png
    Clip2net_151008162307.png
    3.6 КБ · Просмотры: 69

nicki

Новичок
Регистрация
14.06.14
Сообщения
20
Реакции
8
nicki не предоставил никакой дополнительной информации.
Привет всем.Можно сделать чтоб при пересечении свечей канал TTM LCR появлялась точка.
 

nicki

Новичок
Регистрация
14.06.14
Сообщения
20
Реакции
8
nicki не предоставил никакой дополнительной информации.
Пожалуйста
 

Вложения

  • 1.jpg
    1.jpg
    41.1 КБ · Просмотры: 69
Статус
Закрыто для дальнейших ответов.
Верх Низ