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

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

kikos

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




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

kikos

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


declare lower;

input length = 13;
input over_Bought = 80;
input over_Sold = 20;
input price = close;

def NetChgAvg = WildersAverage(price - price[1], length);
def TotChgAvg = WildersAverage(AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;
plot OverBought = over_Bought;

plot emaPlot = movAvgExponential(RSI, 13, 0);

plot ADX = DMI(5).ADX;
ADX.SetDefaultColor(GetColor(5));

input KPeriod = 21;
input DPeriod = 8;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input smoothingType = {Default SMA, EMA};

def c1 = priceC - Lowest(priceL, KPeriod);
def c2 = Highest(priceH, KPeriod) - Lowest(priceL, KPeriod);
def FastK = c1 / c2 * 100;

plot FullK;
plot FullD;

switch(smoothingType) {
case SMA:
FullK = Average(FastK, slowing_period);
FullD = Average(FullK, DPeriod);
case EMA:
FullK = ExpAverage(FastK, slowing_period);
FullD = ExpAverage(FullK, DPeriod);
}

FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));

plot Midline50 = 50;
Midline50.SetDefaultColor(GetColor(7));
 
  • Like
Реакции: emo

torres1987

Новичок
Регистрация
16.04.15
Сообщения
61
Реакции
20
torres1987 не предоставил никакой дополнительной информации.
Вот толькочто наткнулся на один индюк на просторах нета может кому пригодится!!!
Федь а как называеться?


declare lower;

input length = 13;
input over_Bought = 80;
input over_Sold = 20;
input price = close;

def NetChgAvg = WildersAverage(price - price[1], length);
def TotChgAvg = WildersAverage(AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);

plot OverSold = over_Sold;
plot OverBought = over_Bought;

plot emaPlot = movAvgExponential(RSI, 13, 0);

plot ADX = DMI(5).ADX;
ADX.SetDefaultColor(GetColor(5));

input KPeriod = 21;
input DPeriod = 8;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 3;
input smoothingType = {Default SMA, EMA};

def c1 = priceC - Lowest(priceL, KPeriod);
def c2 = Highest(priceH, KPeriod) - Lowest(priceL, KPeriod);
def FastK = c1 / c2 * 100;

plot FullK;
plot FullD;

switch(smoothingType) {
case SMA:
FullK = Average(FastK, slowing_period);
FullD = Average(FullK, DPeriod);
case EMA:
FullK = ExpAverage(FastK, slowing_period);
FullD = ExpAverage(FullK, DPeriod);
}

FullK.SetDefaultColor(GetColor(5));
FullD.SetDefaultColor(GetColor(0));
OverBought.SetDefaultColor(GetColor(1));
OverSold.SetDefaultColor(GetColor(1));

plot Midline50 = 50;
Midline50.SetDefaultColor(GetColor(7));
 

ArtiSt

Местный
Регистрация
12.09.14
Сообщения
232
Реакции
196
ArtiSt не предоставил никакой дополнительной информации.
Всем привет. Может сделаем такую сиську. Скрин. Средняя МА зеленая, TTM показывает направление вверх. На каждом баре стрела БАЙ. И наоборот. Потом уже попробуем отфильтровать. Средняя находится в этом индюке.
Посмотреть вложение 23641
Вот накинул кое что на индюк который тебе kikos сделал. Фиолетовые точки - сигнал на продажу, бирюзовые на покупку.
 

Вложения

  • Screenshot_1.png
    Screenshot_1.png
    51 КБ · Просмотры: 206

kikos

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


declare lower;

input symbol = {default "/DX"} ;

plot PriceClose = close(symbol);


Ставите скрипт как новый индюк потом просто перетаскиваете его в верх из ловер в прайсе!!!
 

ncc_777

Местный
Регистрация
29.07.14
Сообщения
340
Реакции
147
ncc_777 не предоставил никакой дополнительной информации.
Добрый день форумчане, подскажите плиз если в ТОСе кластеры, если да то где их включить, заранее спасибо
 

figo78

Непризнанный
Регистрация
04.10.14
Сообщения
52
Реакции
7
figo78 не предоставил никакой дополнительной информации.
здравствуте Фёдор скажите рисует ли это индикатор

### MASTER DENEG_1(c)
### 27.10.2014
#

declare Upper;

#######ADD
input lprice = hl2;
input length = 17;
input OValue = 0.008;
input AlertsOn = no;



def displacementa = (-length / 2) + 1;
def dPricea = lprice[displacementa];
def price = close;

rec CMAA = if !IsNaN(dPricea) then Average(dPricea, AbsValue(length)) else CMAA[1] + (CMAA[1] - CMAA[2]);

def JEMOB = CMAA * 0.004 / 100;;
def OMOSB = CMAA * OValue / 100;
def IDMOB = CMAA * 0.008 / 100;

def UMOLOB = if !IsNaN(price) then CMAA + OMOSB else Double.Nan;
def LMOLOB = if !IsNaN(price) then CMAA - OMOSB else Double.Nan;


plot MOUpa = If Price crosses below LMOLOB then 1 else 0;;
MOUpa.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
MOUpa.SetDefaultColor(Color.WHITE);
MOUpa.SetLineWeight(3);
alert(AlertsOn && MOUpa, "MOADIT UP", Alert.BAR, Sound.ding);

plot MODna = If Price crosses above UMOLOB then 1 else 0;;
MODna.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
MODna.SetDefaultColor(Color.WHITE);
MODna.SetLineWeight(3);
alert(AlertsOn && MODna, "MOADIT DN", Alert.BAR, Sound.ding);

###MAIN

input MO_length = 28;
input TypeMA = {default EMA, SMA};
input MA_length = 8;
input PC_length = 14;


def JUMOB = Highest(high[-0 + 1], 14);
def LMOSB = Lowest(low[-0 + 1], 14);
def MDMOB = (JUMOB + LMOSB) / 2;
def displacement = (-MO_length / 2) + 1;
def dPrice = hl2[displacement];

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

def ExtremeBand = CMA * 0.004 / 100;;
def OLMOB = CMA * 0.01 / 100;
def LIMOB = CMA * 0.008 / 100;

def UMOOB = if !IsNaN(price) then CMA + OLMOB else Double.Nan;
def LMOOB = if !IsNaN(price) then CMA - OLMOB else Double.Nan;

def sDev = stdev(data = price[-0], length = 20);
def JMMOL = ExpAverage(data = price[-0], length = 20);
def JCMOL = JMMOL + -2.0 * sDev;
def JCMOU = JMMOL + 2.0 * sDev;

rec up1 = If low <= LMOOB and Price crosses below LMOSB then 1 else 0;;

rec down1 = If high >= UMOOB and Price crosses above JUMOB then 1 else 0;;

rec up2 = If low <= LMOOB and price crosses below MDMOB then 1 else 0;

rec down2 = If high >= UMOOB and Price crosses above MDMOB then 1 else 0;

rec up3 = If low <= LMOOB and Price crosses below JMMOL then 1 else 0;

rec down3 = If high >= UMOOB and Price crosses above JMMOL then 1 else 0;


plot MA;
switch (TypeMA) {
case EMA:
MA = ExpAverage(price[-0], MA_length);
case SMA:
MA = Average(price[-0], MA_length);
}
MA.AssignValueColor(if MA > MA[1] then Color.UPTICK else Color.DOWNTICK);
MA.SetLineWeight(3);
MA.HideBubble();
MA.HideTitle();

plot UpperBand = Highest(high[-0 + 1], PC_length);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(2);
UpperBand.HideBubble();
UpperBand.HideTitle();

plot LowerBand = Lowest(low[-0 + 1], PC_length);
LowerBand.SetDefaultColor(GetColor(6));
LowerBand.SetLineWeight(2);
LowerBand.HideBubble();
LowerBand.HideTitle();



######-------------------------------------------------PLOT ARROWS-------------------------------------------
plot Up = if MOUpa and (up1 or up2 or up3) then 1 else 0;
Up.SetDefaultColor(Color.WHITE);
Up.SetLineWeight(4);
Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Alert(Up, "CALL Alert", Alert.BAR, Sound.Ring);

plot Down = if modna and (down1 or down2 or down3) then 1 else 0;
Down.SetDefaultColor(Color.WHITE);
Down.SetLineWeight(4);
Down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Alert(Down, "PUT Alert", Alert.BAR, Sound.Ring);

AddLabel(Up, "CALL", Color.WHITE);
AddLabel(Down, "PUT", Color.WHITE);


##########---------------------------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 = 9;
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));plot Data = close;
 

pavel.elba

Местный
Регистрация
29.12.14
Сообщения
1,129
Реакции
607
здравствуте Фёдор скажите рисует ли это индикатор

### MASTER DENEG_1(c)
### 27.10.2014
#

declare Upper;

#######ADD
input lprice = hl2;
input length = 17;
input OValue = 0.008;
input AlertsOn = no;



def displacementa = (-length / 2) + 1;
def dPricea = lprice[displacementa];
def price = close;

rec CMAA = if !IsNaN(dPricea) then Average(dPricea, AbsValue(length)) else CMAA[1] + (CMAA[1] - CMAA[2]);

def JEMOB = CMAA * 0.004 / 100;;
def OMOSB = CMAA * OValue / 100;
def IDMOB = CMAA * 0.008 / 100;

def UMOLOB = if !IsNaN(price) then CMAA + OMOSB else Double.Nan;
def LMOLOB = if !IsNaN(price) then CMAA - OMOSB else Double.Nan;


plot MOUpa = If Price crosses below LMOLOB then 1 else 0;;
MOUpa.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
MOUpa.SetDefaultColor(Color.WHITE);
MOUpa.SetLineWeight(3);
alert(AlertsOn && MOUpa, "MOADIT UP", Alert.BAR, Sound.ding);

plot MODna = If Price crosses above UMOLOB then 1 else 0;;
MODna.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
MODna.SetDefaultColor(Color.WHITE);
MODna.SetLineWeight(3);
alert(AlertsOn && MODna, "MOADIT DN", Alert.BAR, Sound.ding);

###MAIN

input MO_length = 28;
input TypeMA = {default EMA, SMA};
input MA_length = 8;
input PC_length = 14;


def JUMOB = Highest(high[-0 + 1], 14);
def LMOSB = Lowest(low[-0 + 1], 14);
def MDMOB = (JUMOB + LMOSB) / 2;
def displacement = (-MO_length / 2) + 1;
def dPrice = hl2[displacement];

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

def ExtremeBand = CMA * 0.004 / 100;;
def OLMOB = CMA * 0.01 / 100;
def LIMOB = CMA * 0.008 / 100;

def UMOOB = if !IsNaN(price) then CMA + OLMOB else Double.Nan;
def LMOOB = if !IsNaN(price) then CMA - OLMOB else Double.Nan;

def sDev = stdev(data = price[-0], length = 20);
def JMMOL = ExpAverage(data = price[-0], length = 20);
def JCMOL = JMMOL + -2.0 * sDev;
def JCMOU = JMMOL + 2.0 * sDev;

rec up1 = If low <= LMOOB and Price crosses below LMOSB then 1 else 0;;

rec down1 = If high >= UMOOB and Price crosses above JUMOB then 1 else 0;;

rec up2 = If low <= LMOOB and price crosses below MDMOB then 1 else 0;

rec down2 = If high >= UMOOB and Price crosses above MDMOB then 1 else 0;

rec up3 = If low <= LMOOB and Price crosses below JMMOL then 1 else 0;

rec down3 = If high >= UMOOB and Price crosses above JMMOL then 1 else 0;


plot MA;
switch (TypeMA) {
case EMA:
MA = ExpAverage(price[-0], MA_length);
case SMA:
MA = Average(price[-0], MA_length);
}
MA.AssignValueColor(if MA > MA[1] then Color.UPTICK else Color.DOWNTICK);
MA.SetLineWeight(3);
MA.HideBubble();
MA.HideTitle();

plot UpperBand = Highest(high[-0 + 1], PC_length);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(2);
UpperBand.HideBubble();
UpperBand.HideTitle();

plot LowerBand = Lowest(low[-0 + 1], PC_length);
LowerBand.SetDefaultColor(GetColor(6));
LowerBand.SetLineWeight(2);
LowerBand.HideBubble();
LowerBand.HideTitle();



######-------------------------------------------------PLOT ARROWS-------------------------------------------
plot Up = if MOUpa and (up1 or up2 or up3) then 1 else 0;
Up.SetDefaultColor(Color.WHITE);
Up.SetLineWeight(4);
Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Alert(Up, "CALL Alert", Alert.BAR, Sound.Ring);

plot Down = if modna and (down1 or down2 or down3) then 1 else 0;
Down.SetDefaultColor(Color.WHITE);
Down.SetLineWeight(4);
Down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Alert(Down, "PUT Alert", Alert.BAR, Sound.Ring);

AddLabel(Up, "CALL", Color.WHITE);
AddLabel(Down, "PUT", Color.WHITE);


##########---------------------------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 = 9;
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));plot Data = close;
да. Вот этот параметр отвечает за рисование. def displacementa = (-length / 2) + 1;
 

kuzinvitaliy

Местный
Регистрация
08.03.15
Сообщения
334
Реакции
179
kuzinvitaliy не предоставил никакой дополнительной информации.
Рисует как великий художник, только что стрелка перескочила с одной свечи на другую. Откуда 98 процентов прибыльности индикатора? Конечно из-за рисования.
 

figo78

Непризнанный
Регистрация
04.10.14
Сообщения
52
Реакции
7
figo78 не предоставил никакой дополнительной информации.
а можно сделать чтоб не рисовал ??
 

ISV1971

Местный
Регистрация
26.05.14
Сообщения
212
Реакции
27
ISV1971 не предоставил никакой дополнительной информации.
Ребята подскажите стоит сегодня торговать? Смотрю много новостей.
 

figo78

Непризнанный
Регистрация
04.10.14
Сообщения
52
Реакции
7
figo78 не предоставил никакой дополнительной информации.
СТАВЛЮ НОЛЬ СИГНАЛЫ ПРОПАДАЮТ ВООБЩЕ
 

ncc_777

Местный
Регистрация
29.07.14
Сообщения
340
Реакции
147
ncc_777 не предоставил никакой дополнительной информации.

viktor8821

Местный
Регистрация
12.12.14
Сообщения
255
Реакции
94
viktor8821 не предоставил никакой дополнительной информации.
Кто нибуть подскажет как по этому индикатору торговать
название master_option_17
код
declare upper;

input AlertsOn = no;
input MO_length = 25;
input TypeMA = {default EMA, SMA};
input MA_length = 8;
input PC_length = 14;


def price = close;
def UMOBR = Highest(high[-0 + 1], 14);
def LOMOB = Lowest(low[-0 + 1], 14);
def MSMOB = (UMOBR + LOMOB) / 2;
def displacement = (-MO_length / 2) + 1;
def dPrice = hl2[displacement];

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

def ExtremeBand = CMA * 0.004 / 100;
;
def EOMOB = CMA * 0.01 / 100;
def NIMOB = CMA * 0.008 / 100;

def UMGOOB = if !IsNaN(price) then CMA + EOMOB else Double.NaN;
def LMGOOB = if !IsNaN(price) then CMA - EOMOB else Double.NaN;

def sDev = StDev(data = price[-0], length = 20);
def JMMOL = ExpAverage(data = price[-0], length = 20);
def JCMOL = JMMOL + -2.0 * sDev;
def JCMOU = JMMOL + 2.0 * sDev;


plot MOUp = if low <= LMGOOB and price crosses below LOMOB then 1 else 0;
;
MOUp.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
MOUp.SetDefaultColor(Color.WHITE);
MOUp.SetLineWeight(3);
Alert(AlertsOn && MOUp, "MOMAIN UP", Alert.BAR, Sound.Ding);
MOUp.HideBubble();
MOUp.HideTitle();

plot MODn = if high >= UMGOOB and price crosses above UMOBR then 1 else 0;
;
MODn.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
MODn.SetDefaultColor(Color.WHITE);
MODn.SetLineWeight(3);
Alert(AlertsOn && MODn, "MOMAIN DN", Alert.BAR, Sound.Ding);
MODn.HideBubble();
MODn.HideTitle();

plot MOMUp = if low <= LMGOOB and price crosses below MSMOB then 1 else 0;
;
MOMUp.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
MOMUp.SetDefaultColor(Color.YELLOW);
MOMUp.SetLineWeight(3);
Alert(AlertsOn && MOMUp, "MOMAIN UP", Alert.BAR, Sound.Ding);
MOMUp.HideBubble();
MOMUp.HideTitle();

plot MOMDn = if high >= UMGOOB and price crosses above MSMOB then 1 else 0;
;
MOMDn.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
MOMDn.SetDefaultColor(Color.YELLOW);
MOMDn.SetLineWeight(3);
Alert(AlertsOn && MOMDn, "MOMAIN DN", Alert.BAR, Sound.Ding);
MOMDn.HideBubble();
MOMDn.HideTitle();

plot JCMOUp = if low <= LMGOOB and price crosses below JMMOL then 1 else 0;
;
JCMOUp.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
JCMOUp.SetDefaultColor(Color.YELLOW);
JCMOUp.SetLineWeight(3);
Alert(AlertsOn && JCMOUp, "MOADIT UP", Alert.BAR, Sound.Ding);
JCMOUp.HideBubble();
JCMOUp.HideTitle();

plot JCMODn = if high >= UMGOOB and price crosses above JMMOL then 1 else 0;
JCMODn.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
JCMODn.SetDefaultColor(Color.YELLOW);
JCMODn.SetLineWeight(3);
Alert(AlertsOn && JCMODn, "MOADIT DN", Alert.BAR, Sound.Ding);
JCMODn.HideBubble();
JCMODn.HideTitle();

plot MA;
switch (TypeMA) {
case EMA:
MA = ExpAverage(price[-0], MA_length);
case SMA:
MA = Average(price[-0], MA_length);
}
MA.AssignValueColor(if MA > MA[1] then Color.UPTICK else Color.DOWNTICK);
MA.SetLineWeight(3);
MA.HideBubble();
MA.HideTitle();

plot UpperBand = Highest(high[-0 + 1], PC_length);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(2);
UpperBand.HideBubble();
UpperBand.HideTitle();

plot LowerBand = Lowest(low[-0 + 1], PC_length);
LowerBand.SetDefaultColor(GetColor(6));
LowerBand.SetLineWeight(2);
LowerBand.HideBubble();
LowerBand.HideTitle();


rec up = if MOUp or MOMUp or JCMOUp then 1 else 0;
rec down = if MODn or MOMDn or jcmodn 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));
 

Вложения

  • Screenshot_1.png
    Screenshot_1.png
    76.7 КБ · Просмотры: 152

viktor8821

Местный
Регистрация
12.12.14
Сообщения
255
Реакции
94
viktor8821 не предоставил никакой дополнительной информации.
да и алертов что-то нету
 

kikos

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

viktor8821

Местный
Регистрация
12.12.14
Сообщения
255
Реакции
94
viktor8821 не предоставил никакой дополнительной информации.
алерт нашел как посмотрел
забыл просто
 

kikos

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

### MASTER DENEG_1(c)
### 27.10.2014
#

declare Upper;

#######ADD
input lprice = hl2;
input length = 17;
input OValue = 0.008;
input AlertsOn = no;



def displacementa = (-length / 2) + 1;
def dPricea = lprice[displacementa];
def price = close;

rec CMAA = if !IsNaN(dPricea) then Average(dPricea, AbsValue(length)) else CMAA[1] + (CMAA[1] - CMAA[2]);

def JEMOB = CMAA * 0.004 / 100;;
def OMOSB = CMAA * OValue / 100;
def IDMOB = CMAA * 0.008 / 100;

def UMOLOB = if !IsNaN(price) then CMAA + OMOSB else Double.Nan;
def LMOLOB = if !IsNaN(price) then CMAA - OMOSB else Double.Nan;


plot MOUpa = If Price crosses below LMOLOB then 1 else 0;;
MOUpa.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_UP);
MOUpa.SetDefaultColor(Color.WHITE);
MOUpa.SetLineWeight(3);
alert(AlertsOn && MOUpa, "MOADIT UP", Alert.BAR, Sound.ding);

plot MODna = If Price crosses above UMOLOB then 1 else 0;;
MODna.SetPaintingStrategy(PaintingStrategy.boolean_ARROW_DOWN);
MODna.SetDefaultColor(Color.WHITE);
MODna.SetLineWeight(3);
alert(AlertsOn && MODna, "MOADIT DN", Alert.BAR, Sound.ding);

###MAIN

input MO_length = 28;
input TypeMA = {default EMA, SMA};
input MA_length = 8;
input PC_length = 14;


def JUMOB = Highest(high[-0 + 1], 14);
def LMOSB = Lowest(low[-0 + 1], 14);
def MDMOB = (JUMOB + LMOSB) / 2;
def displacement = (-MO_length / 2) + 1;
def dPrice = hl2[displacement];

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

def ExtremeBand = CMA * 0.004 / 100;;
def OLMOB = CMA * 0.01 / 100;
def LIMOB = CMA * 0.008 / 100;

def UMOOB = if !IsNaN(price) then CMA + OLMOB else Double.Nan;
def LMOOB = if !IsNaN(price) then CMA - OLMOB else Double.Nan;

def sDev = stdev(data = price[-0], length = 20);
def JMMOL = ExpAverage(data = price[-0], length = 20);
def JCMOL = JMMOL + -2.0 * sDev;
def JCMOU = JMMOL + 2.0 * sDev;

rec up1 = If low <= LMOOB and Price crosses below LMOSB then 1 else 0;;

rec down1 = If high >= UMOOB and Price crosses above JUMOB then 1 else 0;;

rec up2 = If low <= LMOOB and price crosses below MDMOB then 1 else 0;

rec down2 = If high >= UMOOB and Price crosses above MDMOB then 1 else 0;

rec up3 = If low <= LMOOB and Price crosses below JMMOL then 1 else 0;

rec down3 = If high >= UMOOB and Price crosses above JMMOL then 1 else 0;


plot MA;
switch (TypeMA) {
case EMA:
MA = ExpAverage(price[-0], MA_length);
case SMA:
MA = Average(price[-0], MA_length);
}
MA.AssignValueColor(if MA > MA[1] then Color.UPTICK else Color.DOWNTICK);
MA.SetLineWeight(3);
MA.HideBubble();
MA.HideTitle();

plot UpperBand = Highest(high[-0 + 1], PC_length);
UpperBand.SetDefaultColor(GetColor(5));
UpperBand.SetLineWeight(2);
UpperBand.HideBubble();
UpperBand.HideTitle();

plot LowerBand = Lowest(low[-0 + 1], PC_length);
LowerBand.SetDefaultColor(GetColor(6));
LowerBand.SetLineWeight(2);
LowerBand.HideBubble();
LowerBand.HideTitle();



######-------------------------------------------------PLOT ARROWS-------------------------------------------
plot Up = if MOUpa and (up1 or up2 or up3) then 1 else 0;
Up.SetDefaultColor(Color.WHITE);
Up.SetLineWeight(4);
Up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Alert(Up, "CALL Alert", Alert.BAR, Sound.Ring);

plot Down = if modna and (down1 or down2 or down3) then 1 else 0;
Down.SetDefaultColor(Color.WHITE);
Down.SetLineWeight(4);
Down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Alert(Down, "PUT Alert", Alert.BAR, Sound.Ring);

AddLabel(Up, "CALL", Color.WHITE);
AddLabel(Down, "PUT", Color.WHITE);


##########---------------------------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 = 9;
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));plot Data = close;
Доброго времени суток! Мой Вам совет выкинуть этот индюк и забыть куда Вы его выкинули чтоб небыло соблазна попробовать поторговать! То что он рисует это не беда а вот то что там нет профита это да! Как писали выше убрать динамику надо поставить 0 на дисбалансе , но так же есть ещё вариант убрать минус на том же дисбалансе и стрелы перестанут рисовать но тогда мы получим совершенно другой индикатор так как посностью изменим условие формирования сигнала!
Мной сегодня была проведена работа полностью над этим индикаторам и благодаря помощи asl123 воссоздано полное движение по истории (большой респект ему за это) тоесть весь индикатор был раскинут на состовляющии и построено движение по точкам на каждой свече и таким образом получены эти же самые стрелы только которые с открытием новой свечи не исчезают а остаются на баре и таким образом мы видим настоящий процент данного индикатора! На скрине это последний тестер!!!!

Всем профита друзья!!!!
 

kikos

Старейшина
Регистрация
23.09.14
Сообщения
4,554
Реакции
6,126
kikos не предоставил никакой дополнительной информации.
Доброго времени суток! Мой Вам совет выкинуть этот индюк и забыть куда Вы его выкинули чтоб небыло соблазна попробовать поторговать! То что он рисует это не беда а вот то что там нет профита это да! Как писали выше убрать динамику надо поставить 0 на дисбалансе , но так же есть ещё вариант убрать минус на том же дисбалансе и стрелы перестанут рисовать но тогда мы получим совершенно другой индикатор так как посностью изменим условие формирования сигнала!
Мной сегодня была проведена работа полностью над этим индикаторам и благодаря помощи asl123 воссоздано полное движение по истории (большой респект ему за это) тоесть весь индикатор был раскинут на состовляющии и построено движение по точкам на каждой свече и таким образом получены эти же самые стрелы только которые с открытием новой свечи не исчезают а остаются на баре и таким образом мы видим настоящий процент данного индикатора! На скрине это последний тестер!!!!

Всем профита друзья!!!!
Для многих может быть непонятно что озночают линии так что продемонстрирую малость иначе! Кто ставил себе этот код на график замечали что часто стрелы появляются на истории там где их на тот момент когда цена проходила там и в помине небыло! Вот на скринах белые стрелы это наш динамический индюк а вот синии это он же только показывающий все стрелы которые появлялись на текущем баре и с открытием нового не исчезали!
 
Статус
Закрыто для дальнейших ответов.
Верх Низ