Кто может помощь с кодом?
?# Win Rate Counter addon in this indicator develpoed by EasyBinarySignals.com, ??????? ????? ??????, ???? ????????? ??????? ???????-?????????! ????? ????????? ?????? ??????? ?????? ? ??????!
#???? ? ?????? ????? ?? ????????? ????? ?????? ????? ?????? ??????! (58-59 ??? ?? ????? ? ?????? ????????). ????? ?????????? 60 ??????. (97% ???????)
#???? ??????? + ??????, ?????? ?? 2 ??????.(97% ???????)
#?????? ???? ?????? ???????, ???? 60 ??????(75% ???????).
#??????? ????? ??????, ???? 2 ??????. (97%) ??. ?????????? ? ?????????.
#???? ??????? + ??????, ???????????, ???? 2 ??????.(97%) ??. ?????????? ? ?????????. (PUT)
# tester by Lawrencevkim
input price = close;
input stdevLength1 = 5;
input avgOfStdevLength1 = 10;
input DYMILength1 = 60;
input DYMILengthLowerLimit1 = 10;
input DYMILengthUpperLimit1 = 60;
input ob1 = 80;
input os1 = 20;
input stdevLength2 = 5;
input avgOfStdevLength2 = 10;
input DYMILength2 = 14;
input DYMILengthLowerLimit2 = 3;
input DYMILengthUpperLimit2 = 30;
input ob2 = 70;
input os2 = 30;
def DYMI1 = DynamicMomentumIndex(price, stdevLength1, avgOfStdevLength1, DYMILength1, DYMILengthLowerLimit1, DYMILengthUpperLimit1).DYMI;
def DYMI2 = DynamicMomentumIndex(price, stdevLength2, avgOfStdevLength2, DYMILength2, DYMILengthLowerLimit2, DYMILengthUpperLimit2).DYMI;
######### CHART DIVERGENCE
input length = 8;
input filterOutSignalsBelow = 7;
def VarP = Round(length / 5);
def VarA = Highest(high, VarP) - Lowest(low, VarP);
def VarR1 = if VarA == 0 and VarP == 1 then AbsValue(close - close[VarP]) else VarA;
def VarB = Highest(high, VarP)[VarP + 1] - Lowest(low, VarP)[VarP];
def VarR2 = if VarB == 0 and VarP == 1 then AbsValue(close[VarP] - close[VarP * 2]) else VarB;
def VarC = Highest(high, VarP)[VarP * 2] - Lowest(low, VarP)[VarP * 2];
def VarR3 = if VarC == 0 and VarP == 1 then AbsValue(close[VarP * 2] - close[VarP * 3]) else VarC;
def VarD = Highest(high, VarP)[VarP * 3] - Lowest(low, VarP)[VarP * 3];
def VarR4 =
if VarD == 0 and VarP == 1 then AbsValue(close[VarP * 3] - close[VarP * 4]) else VarD;
def VarE = Highest(high, VarP)[VarP * 4] - Lowest(low, VarP)[VarP * 4];
def VarR5 = if VarE == 0 and VarP == 1 then AbsValue(close[VarP * 4] - close[VarP * 5]) else VarE;
def LRange = ((VarR1 + VarR2 + VarR3 + VarR4 + VarR5) / 5) * 0.2;
def Var0 = if AbsValue(close - close[1]) > (high - low) then AbsValue(close - close[1]) else (high - low);
def LRange2 = if high == low then Average(AbsValue(close - close[1]), 5) * 0.2 else Average(Var0, 5) * 0.2;
def range = high + low;
def delta = high - low;
def median = range / 2;
def floatingAxis = Average(median, length);
def dynamicVolatilityUnit = if length <= 7 then LRange2 else LRange;
def relativeHigh = (high - floatingAxis) / dynamicVolatilityUnit;
def relativeLow = (low - floatingAxis) / dynamicVolatilityUnit;
def relativeOpen = (open - floatingAxis) / dynamicVolatilityUnit;
def relativeClose = (close - floatingAxis) / dynamicVolatilityUnit;
def h = relativeHigh;
def l = relativeLow;
def sellDivergence = if high > high[1] and relativeHigh < relativeHigh[1] and relativeHigh[1] > filterOutSignalsBelow then 1 else 0;
def buyDivergence = if low < low[1] and relativeLow > relativeLow[1] and relativeLow[1] < -filterOutSignalsBelow then 1 else 0;
def hiddenDivergenceUp = if low > low[1] and relativeLow < relativeLow[1] then 1 else 0;
def hiddenDivergenceDown = if high < high[1] and relativeHigh > relativeHigh[1] then 1 else 0;
def upArrow = if buyDivergence then 1 else 0;
def downArrow = if sellDivergence then 1 else 0;
#####################################################################
def crossup1 = if DYMI1 <= os1 and DYMI1[1] > os1 then 1 else 0;
def crossup2 = if DYMI2 <= os2 and upArrow then 1 else 0;
def crossdown1 = if DYMI1 >= ob1 and DYMI1[1] < ob1 then 1 else 0;
def crossdown2 = if DYMI2 >= ob2 and downArrow then 1 else 0;
#
plot up = if (crossup1 and (crossup2 or crossup2[1])) or (crossup2 and crossup1[1]) or (crossup2 and crossup1[2]) then 1 else 0;
up.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
up.SetLineWeight(5);
up.SetDefaultColor(Color.WHITE);
Alert (up, "UP", Alert.BAR, Sound.Ring);
#
plot down = if (crossdown1 and (crossdown2 or crossdown2[1])) or (crossdown2 and crossdown1[1]) or (crossdown2 and crossdown1[2]) then 1 else 0;
down.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
down.SetLineWeight(5);
down.SetDefaultColor(Color.WHITE);
Alert(down, "DOWN", Alert.BAR, Sound.Ring);
##########---------------------------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));