QQE

QQE là chỉ báo miễn phí của DinexSpace cho MT5 và TradingView. RSI làm mượt cùng đường bám theo biến động của chính nó. Bản có tín hiệu (v2) thêm mũi tên Mua/Bán trên nến đã đóng, kèm mức SL và TP gợi ý.

QQE làm gì

QQE là chỉ báo miễn phí của DinexSpace cho MT5 và TradingView. RSI làm mượt cùng đường bám theo biến động của chính nó. Bản có tín hiệu (v2) thêm mũi tên Mua/Bán trên nến đã đóng, kèm mức SL và TP gợi ý.

Cần bật JavaScript để xem biểu đồ.

Biểu đồ dùng thư viện Lightweight Charts™ của TradingView (giấy phép Apache-2.0). tradingview.com

Nến, đường chỉ báo và mũi tên trong khung trên lấy từ chính bản MT5 chạy trong Strategy Tester; trang web không tính lại gì. Bấm ▶ để phát từng nến, rê chuột vào mũi tên để xem lý do, giá, SL, TP.

QQE: RSI(14) làm mượt bằng EMA(5) và một đường bám (trailing) dựng từ trung bình Wilder của mức thay đổi RSI × 4,236. Vẽ ở cửa sổ riêng; mũi tên hiện ở cả cửa sổ QQE và biểu đồ giá.

Khi nào dùng

Dùng để lọc các lần RSI cắt mức bị nhiễu.

Chức năng và chế độ

QQE: RSI(14) làm mượt bằng EMA(5) và một đường bám (trailing) dựng từ trung bình Wilder của mức thay đổi RSI × 4,236. Vẽ ở cửa sổ riêng; mũi tên hiện ở cả cửa sổ QQE và biểu đồ giá.

Thông số

QQE có 51 thông số ở bản MT5 và 25 thông số ở bản TradingView; mọi thông số và giá trị mặc định có trong bảng dưới.

Thông số của QQE
NhómTham sốMặc địnhÝ nghĩa
QQEInpRSIPeriod14Chu kỳ RSI
QQEInpSmooth5EMA làm mượt RSI
QQEInpFactor4.236Hệ số dải
QQEInpModeQQE_PHASELoại tín hiệu: 0 = đổi pha, 1 = cắt 50
SignalsInpSigArrowstrueVẽ mũi tên Mua/Bán (chỉ trên nến đã đóng)
SignalsInpSigLabelstrueNhãn ngắn ghi lý do cạnh mũi tên
SignalsInpSigLevelsfalseVẽ đường vào lệnh / SL / TP cho mỗi tín hiệu
SignalsInpSigSLATR1.5SL gợi ý = ATR × hệ số này
SignalsInpSigRR2.0TP gợi ý = khoảng SL × hệ số này (tỷ lệ R:R)
SignalsInpSigATRLen14Chu kỳ ATR (cho SL/TP và bộ lọc biến động)
SignalsInpSigLevelBars10Độ dài đường vào lệnh/SL/TP, số nến
SignalsInpSigObjBars1500Chỉ vẽ nhãn và đường cho tín hiệu trong N nến gần nhất
Confluence (score x/7, a signal shows when score >= minimum)InpConfMin4Điểm hợp lưu tối thiểu 0–7 để hiện tín hiệu (0 = mọi tín hiệu gốc)
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFtrueYếu tố 1, xu hướng: giá đóng trên (Mua) / dưới (Bán) EMA của khung xu hướng
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFTFPERIOD_H4Khung xu hướng (chỉ dùng nến đã đóng)
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFLen200Chu kỳ EMA xu hướng
Confluence (score x/7, a signal shows when score >= minimum)InpCfMomtrueYếu tố 2, động lượng: RSI(14) trên 50 (Mua) / dưới 50 (Bán)
Confluence (score x/7, a signal shows when score >= minimum)InpCfVolattrueYếu tố 3, biến động: phân vị ATR trong 100 nến nằm giữa 20 và 90
Confluence (score x/7, a signal shows when score >= minimum)InpCfRVoltrueYếu tố 4, khối lượng: tick volume ≥ trung bình cùng giờ 20 ngày
Confluence (score x/7, a signal shows when score >= minimum)InpCfSessiontrueYếu tố 5, phiên: nến tín hiệu nằm trong giờ phiên (giờ máy chủ)
Confluence (score x/7, a signal shows when score >= minimum)InpCfHourFrom7Giờ bắt đầu phiên (0–23)
Confluence (score x/7, a signal shows when score >= minimum)InpCfHourTo21Giờ kết thúc phiên (0–23, không tính giờ này; có thể vắt qua nửa đêm)
Confluence (score x/7, a signal shows when score >= minimum)InpCfNewstrueYếu tố 6, tin tức: không có tin quan trọng trong lịch MT5 quanh nến tín hiệu
Confluence (score x/7, a signal shows when score >= minimum)InpCfNewsMin30Khoảng quanh tin, số phút trước và sau
Confluence (score x/7, a signal shows when score >= minimum)InpCfSpreadtrueYếu tố 7, spread: spread ≤ 1,5 × trung vị spread 100 nến
Confluence (score x/7, a signal shows when score >= minimum)InpFltGapBars0Khoảng cách tối thiểu giữa 2 tín hiệu, số nến (0 = tắt)
Win rate (history of the signal's group)InpMinWin51Tô đậm tín hiệu có tỷ lệ thắng của nhóm từ mức này (%)
Win rate (history of the signal's group)InpHideWeakfalseẨn tín hiệu dưới mức đó (tắt = vẽ mờ)
Win rate (history of the signal's group)InpShowBEfalseBảng góc: hiện tỷ lệ hoà vốn của R:R đang dùng
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbModeDNX_ODDS_BOTH% trên nến: cả 2 phía / chỉ phía mạnh hơn / tắt
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbBars150Số nến có % (0 = mọi nến, chậm hơn)
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbSLATR1.5% trên nến: SL = TP = ATR × hệ số này
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbRR1.0% trên nến: TP = khoảng SL × hệ số này
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD1-5Màu: đỏ khi thấp hơn hoà vốn + mức này (điểm %)
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD20Màu: cam khi thấp hơn hoà vốn + mức này
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD35Màu: vàng khi thấp hơn hoà vốn + mức này
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD410Màu: xanh lá khi thấp hơn hoà vốn + mức này, trên mức này dùng màu nến tăng của biểu đồ
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbFont7Cỡ chữ % trên nến
Alerts (once per closed signal bar)InpAlPopupfalseCảnh báo popup
Alerts (once per closed signal bar)InpAlPushfalseThông báo đẩy về điện thoại (Tools → Options → Notifications)
Alerts (once per closed signal bar)InpAlMailfalseEmail (Tools → Options → Email)
Alerts (once per closed signal bar)InpAlSoundfalseÂm thanh
Alerts (once per closed signal bar)InpAlSoundFile"alert.wav"File âm thanh (thư mục Sounds của MT5)
PanelInpPaneltrueHiện bảng tín hiệu gần nhất
PanelInpPanelCornerCORNER_LEFT_UPPERGóc đặt bảng
PanelInpPanelX10Lệch ngang của bảng, px
PanelInpPanelY25Lệch dọc của bảng, px
PanelInpPanelFont9Cỡ chữ bảng

Tín hiệu

QQE cho tín hiệu Mua khi chế độ mặc định "đổi pha": RSI làm mượt vượt lên dải trên, QQE chuyển sang pha tăng (nhãn "QQE phase up") và tín hiệu Bán khi RSI làm mượt thủng dải dưới, QQE chuyển sang pha giảm (nhãn "QQE phase down"). Chỉ báo không vẽ lại: tín hiệu chỉ được xác nhận khi nến đóng.

  • Mua ▲: chế độ mặc định "đổi pha": RSI làm mượt vượt lên dải trên, QQE chuyển sang pha tăng (nhãn "QQE phase up").
  • Bán ▼: RSI làm mượt thủng dải dưới, QQE chuyển sang pha giảm (nhãn "QQE phase down").
  • Chế độ "cắt 50" (InpMode = 1): Mua khi RSI làm mượt cắt lên 50, Bán khi cắt xuống 50.
  • Chỉ khi nến đã đóng. Nến đang chạy không bao giờ có mũi tên, nên tín hiệu đã vẽ không đổi và không mất (không vẽ lại).
  • Mũi tên đặt ở nến tín hiệu. Nếu vào lệnh theo tín hiệu thì vào ở giá mở của nến kế tiếp.
  • Kèm nhãn ngắn ghi lý do. Có thể bật đường giá vào (giá đóng nến tín hiệu), SL gợi ý (ATR(14) × 1,5) và TP gợi ý (R:R 1:2).
  • Hợp lưu: mỗi tín hiệu được chấm 0–7 điểm (xu hướng khung lớn, động lượng, biến động, khối lượng, phiên, tin tức, spread); mặc định chỉ hiện tín hiệu đạt từ 4/7 (bản MT5).
  • % trên từng nến (bản MT5): ▲ % Mua dưới nến, ▼ % Bán trên nến, mỗi nến coi như một lệnh giả định R:R 1:1, màu theo mức hoà vốn đã gồm spread; chỉ có số cho XAUUSD H1 với tham số mặc định, nơi khác hiện "–".
  • Cảnh báo MT5 (popup, push, email, âm thanh; mỗi loại bật riêng) chỉ báo 1 lần cho mỗi nến tín hiệu. Bản Pine có alertcondition cho Mua và cho Bán.
  • Bảng nhỏ ở góc biểu đồ: tín hiệu gần nhất, giá, SL, TP, thời gian, số nến từ lúc có tín hiệu.

SL gợi ý = ATR(14) × 1,5, TP gợi ý = 2 lần khoảng SL (R:R 1:2). Bộ lọc xu hướng, biến động, phiên và khoảng cách giữa tín hiệu đều tắt theo mặc định.

Cảnh báo

Có. QQE có cảnh báo sẵn: MT5 – cửa sổ báo, thông báo đẩy, email, âm thanh; TradingView – điều kiện cảnh báo dùng trong Create Alert.

Buffer cho EA

Có. Bản MT5 của QQE đưa các đường vẽ ra buffer để EA đọc bằng iCustom và CopyBuffer: Smoothed RSI, Trailing line, Buy, Sell, Signal SL, Signal TP, Signal entry, Signal filter, Confluence score, Win rate %, Sample size, Bar buy odds %, Bar buy samples, Bar sell odds %, Bar sell samples, Lean, Bar buy score, Bar sell score.

QQE – Buffer cho EA
BufferNội dung
0Mua: khác EMPTY_VALUE = có tín hiệu Mua ở nến đó (giá trị là vị trí vẽ mũi tên)
1Bán: khác EMPTY_VALUE = có tín hiệu Bán ở nến đó
2SL gợi ý (giá)
3TP gợi ý (giá)
4Giá vào: giá đóng của nến tín hiệu
5Lọc: 1 = không vào lệnh / dừng giao dịch, 0 = được phép
6Điểm hợp lưu 0–7 ở nến tín hiệu
7Tỷ lệ thắng % của nhóm tín hiệu (giai đoạn thiết kế)
8Số mẫu của nhóm đó (EMPTY khi dưới 30)
9 / 11% Mua / % Bán của nến (lệnh giả định 1:1)
10 / 12Số mẫu của % Mua / % Bán
13Lean: +1/−1 = chiều của tín hiệu gốc gần nhất
14 / 15Điểm hợp lưu của phía Mua / Bán ở nến đó
16RSI làm mượt
17Đường bám

Đọc ở shift 1 (nến vừa đóng) khi có nến mới. Mỗi input group chiếm 1 vị trí tham số trong iCustom; gọi không truyền tham số thì dùng mặc định.

int h = iCustom(_Symbol, _Period, "DinexQQESig");
double buy[1], sell[1], sl[1], tp[1];
CopyBuffer(h, 0, 1, 1, buy); CopyBuffer(h, 1, 1, 1, sell);
CopyBuffer(h, 2, 1, 1, sl);  CopyBuffer(h, 3, 1, 1, tp);
if(buy[0] != EMPTY_VALUE) { /* Mua, SL = sl[0], TP = tp[0] */ }

Pine: các plot ẩn Buy signal, Sell signal (1/0), Signal SL, Signal TP, Signal entry (xem ở Data Window, dùng trong strategy hoặc webhook).

Khung thời gian và thị trường

QQE chạy trên mọi khung thời gian của biểu đồ. Phần tính toán đọc khung thời gian của biểu đồ hoặc một khung cố định (ví dụ D1 hay khung lớn hơn), như mô tả ở phần Chức năng.

Giới hạn

QQE là công cụ phân tích, không phải hệ thống giao dịch. Các giới hạn đã ghi trong tài liệu có ở dưới.

  • SL/TP chỉ là gợi ý theo ATR, không xét spread, phí, trượt giá hay tin tức.

Tín hiệu kỹ thuật chưa qua kiểm định đăng ký trước; không phải lời khuyên đầu tư.

Mã Pine Script

Dán toàn bộ đoạn mã này vào Pine Editor trên TradingView.

DinexQQESig.pine · 16.970 dòng
//@version=6
// DinexSpace | QQE Signals v2.0 (2026-11-14)
// QQE: RSI smoothed by an EMA and a trailing band from the Wilder-style average of the bar-to-bar change of the
// smoothed RSI x factor. Phase mode: buy when the QQE phase switches up, sell when it switches down.
// 50 mode: the smoothed RSI crosses 50. Confirmed bars only (no repaint). Arrows also on the price chart.
// Open source. License: MIT. (c) 2026 DinexSpace
indicator("DinexSpace | QQE Signals", shorttitle = "DNX QQE", overlay = false, max_labels_count = 500, max_lines_count = 500)

const string DNX_NAME = "QQE"
grpI = "QQE"
qLen    = input.int(14, "RSI period", minval = 2, group = grpI)
qSmooth = input.int(5, "EMA smoothing of the RSI", minval = 1, group = grpI)
qFactor = input.float(4.236, "Band factor", minval = 0.1, step = 0.1, group = grpI)
qMode   = input.string("Phase switch", "Signal type", options = ["Phase switch", "Cross 50"], group = grpI)
// ---- DinexSpace signal layer v2.1 (2026-11-17, GII code + GII filter): inputs ----
grpS = "Signals"
sigArrows = input.bool(true, "Buy/sell arrows (closed bars only)", group = grpS)
sigLabels = input.bool(true, "Short reason label next to each arrow", group = grpS)
sigLevels = input.bool(false, "Entry / SL / TP lines for each signal", group = grpS)
sigSlAtr  = input.float(1.5, "Suggested SL = ATR x", minval = 0.1, step = 0.1, group = grpS)
sigRR     = input.float(2.0, "Suggested TP = SL distance x (reward:risk)", minval = 0.1, step = 0.1, group = grpS)
sigAtrLen = input.int(14, "ATR period (SL/TP and volatility filter)", minval = 1, group = grpS)
sigLvlLen = input.int(10, "Length of the entry/SL/TP lines, bars", minval = 1, group = grpS)
grpF = "Filters (all off by default)"
fltTrend   = input.bool(false, "Trend filter: buy only above the EMA, sell only below", group = grpF)
fltTrendLn = input.int(200, "Trend EMA period", minval = 1, group = grpF)
fltTrendTf = input.timeframe("", "Trend EMA timeframe (empty = chart)", group = grpF)
fltAtr     = input.bool(false, "Volatility filter: skip signals when ATR is too small", group = grpF)
fltAtrMin  = input.float(0.0, "Minimum ATR, in price units", minval = 0, group = grpF)
fltSes     = input.bool(false, "Session filter", group = grpF)
fltSesion  = input.session("0800-2000", "Session (exchange time zone)", group = grpF)
fltGap     = input.int(0, "Minimum bars between two signals (0 = off)", minval = 0, group = grpF)
grpP = "Panel"
pnlShow = input.bool(true, "Show the last-signal panel", group = grpP)
pnlPos  = input.string("top_right", "Panel position", options = ["top_left", "top_right", "bottom_left", "bottom_right"], group = grpP)
grpG = "GII (DinexSpace gold index; reference, not validated)"
giiShow   = input.bool(true, "GII rows in the panel (gold charts only)", group = grpG)
giiCode   = input.string("", "GII code (copy today's code from the DinexSpace GII page)", group = grpG)
giiFilter = input.bool(false, "Keep only signals on the GII side (buy: zone >= +1, sell: zone <= -1)", group = grpG)
giiMaxAge = input.int(4, "GII older than this many days is stale: the filter then ignores it", minval = 1, group = grpG)
// ---- end of signal inputs ----

rsi  = ta.rsi(close, qLen)
fast = ta.ema(rsi, qSmooth)
w    = 2 * qLen - 1
dar  = ta.ema(ta.ema(math.abs(fast - fast[1]), w), w) * qFactor
nl = fast - dar
ns = fast + dar
var float lng = na
var float sht = na
var int trend = 1
pf  = fast[1]
pl  = lng
ps  = sht
pl2 = lng[2]
ps2 = sht[2]
if not na(dar)
    lng := (not na(pl) and pf > pl and fast > pl) ? math.max(pl, nl) : nl
    sht := (not na(ps) and pf < ps and fast < ps) ? math.min(ps, ns) : ns
    if not na(ps2) and fast > ps and pf <= ps2
        trend := 1
    else if not na(pl2) and fast < pl and pf >= pl2
        trend := -1
trail = trend > 0 ? lng : sht
plot(fast, "Smoothed RSI", color.new(#1E90FF, 0), 2)
plot(trail, "Trailing line", color.new(#FF8C00, 0), 1, plot.style_circles)
hline(50, "50", color.gray, hline.style_dotted)

phaseFlip = not na(ps2) and trend != trend[1]
x50Up = ta.crossover(fast, 50)
x50Dn = ta.crossunder(fast, 50)
rawBuy  = qMode == "Phase switch" ? phaseFlip and trend > 0 : x50Up
rawSell = qMode == "Phase switch" ? phaseFlip and trend < 0 : x50Dn
whyBuy  = qMode == "Phase switch" ? ("QQE phase up") : ("QQE crossed above 50")
whySell = qMode == "Phase switch" ? ("QQE phase down") : ("QQE crossed below 50")
plotshape(rawBuy and barstate.isconfirmed and sigArrows, "Buy (QQE pane)", shape.triangleup, location.bottom, color.lime, size = size.tiny)
plotshape(rawSell and barstate.isconfirmed and sigArrows, "Sell (QQE pane)", shape.triangledown, location.top, color.red, size = size.tiny)
// ---- DinexSpace signal layer v2.1 (2026-11-17, GII code + GII filter) ----
// Needs, defined above: rawBuy, rawSell (bool), whyBuy, whySell (string), const string DNX_NAME.
// A signal is kept only on a confirmed (closed) bar, so it is never redrawn. The higher timeframe EMA
// uses the previous closed higher bar (lookahead on + [1]), which does not repaint either.
sigAtr  = ta.atr(sigAtrLen)
// Match context.py's ATR14 seed: running mean through bar 13, then Wilder smoothing.
arrowTr = bar_index == 0 ? high - low : math.max(high, close[1]) - math.min(low, close[1])
var float arrowAtr = na
arrowAtr := bar_index < 14 ? (nz(arrowAtr[1]) * bar_index + arrowTr) / (bar_index + 1) : (arrowAtr[1] * 13 + arrowTr) / 14
emaChart = ta.ema(close, fltTrendLn)
emaHtf   = request.security(syminfo.tickerid, fltTrendTf, ta.ema(close, fltTrendLn)[1], lookahead = barmerge.lookahead_on)
arrowEmaH4Prev = request.security(syminfo.tickerid, "240", ta.ema(close, 200)[1], lookahead = barmerge.lookahead_on)
arrowEmaH4Current = request.security(syminfo.tickerid, "240", ta.ema(close, 200), lookahead = barmerge.lookahead_off)
// At an H4 boundary the signal bar has closed that H4 bar, so use its finished EMA.
arrowEmaH4 = timeframe.in_seconds() < 14400 and time_close != time_close("240") ? arrowEmaH4Prev : arrowEmaH4Current
DNX_ARROW_ALL = false   // true: one rate for every market (context table not better)
// Measured selected-context rate. Pine can check only these three signal inputs:
// sigSlAtr=1.5, sigRR=2.0, sigAtrLen=14; other defaults cannot be verified.
// ATR rank counts strictly lower values among 100 bars including the signal bar.
// Session hour in UTC: the MT5 server of the measurement runs on UTC without DST (gold reopens Sun 23:00 winter / 22:00 summer).
dnxArrowRate(int dir, int offset) =>
    float rate = na
    int n = na
    int arT = -1
    int arB = -1
    int arS = -1
    if not na(arrowEmaH4[offset])
        arT := (close[offset] - arrowEmaH4[offset]) * dir > 0 ? 1 : 0
    if bar_index >= offset + 99
        int below = 0
        bool finite = true
        for j = 0 to 99
            float v = arrowAtr[offset + j]
            finite := finite and not na(v)
            if v < arrowAtr[offset]
                below += 1
        if finite
            arB := below < 33 ? 0 : below <= 66 ? 1 : 2
    int h = hour(time[offset], "UTC")
    arS := h < 7 ? 0 : h < 13 ? 1 : h < 21 ? 2 : 3
    if sigSlAtr == 1.5 and sigRR == 2.0 and sigAtrLen == 14
        string ticker = str.upper(syminfo.ticker)
        if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 6
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 3
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 14
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 43
            n := 25
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 43
            n := 25
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 43
            n := 2
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 3
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 5
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 10
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 29
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 35
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 71
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 126
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 186
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 22
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 66
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 89
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 62
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 19
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 76
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 100
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 92
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 21
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 92
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 89
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 183
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 11
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 152
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 114
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 90
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 21
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 101
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 99
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 90
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 31
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 44
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 96
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 153
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 19
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 36
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 78
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 73
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 17
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 57
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 70
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 113
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 20
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 87
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 115
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 190
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 31
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 146
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 139
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 94
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 41
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 116
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 113
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 46
            n := 111
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 26
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 48
            n := 1
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 48
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 43
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 36
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 28
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 43
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 25
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 28
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 30
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 39
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 35
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 36
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 28
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 27
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 26
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 35
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 52
            n := 1
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 15
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 31
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 32
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 24
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 16
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 39
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 52
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 40
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 37
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 38
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 48
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 26
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 37
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 20
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 40
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 84
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 2
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 33
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 25
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 5
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 36
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 55
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 49
            n := 7
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 15
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 34
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 68
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 6
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 66
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 15
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 7
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 26
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 25
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 54
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 28
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 6
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 19
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 42
            n := 28
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 42
            n := 59
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 42
            n := 2
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 26
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 42
            n := 12
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 42
            n := 8
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 27
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 45
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 17
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 42
            n := 3
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 23
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 41
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 88
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 44
            n := 2
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 41
            n := 82
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 42
            n := 23
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 42
            n := 17
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 42
            n := 17
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 44
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 41
            n := 64
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 17
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 42
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 9
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 9
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 20
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 20
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 13
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 13
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 35
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 35
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 6
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 6
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 36
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 36
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 92
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 92
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 20
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 20
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 99
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 99
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 10
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 10
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 76
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 76
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 69
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 69
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 42
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 42
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 42
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 42
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 42
            n := 10
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 42
            n := 10
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 26
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 26
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 42
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 42
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 53
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 53
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 6
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 6
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 73
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 73
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 45
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 45
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 40
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 40
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 13
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 13
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 41
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 41
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 10
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 10
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 38
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 38
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 40
            n := 21
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 40
            n := 21
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 41
            n := 19
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 41
            n := 19
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 35
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 35
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 40
            n := 8
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 40
            n := 8
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 39
            n := 6
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 39
            n := 6
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 40
            n := 26
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 40
            n := 26
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 40
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 40
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 82
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 82
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 20
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 20
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 39
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 39
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 7
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 7
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 82
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 82
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 224
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 224
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 66
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 66
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 203
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 203
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 7
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 7
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 10
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 10
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 30
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 30
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 192
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 192
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 40
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 40
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 137
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 137
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 24
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 24
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 83
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 83
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 43
            n := 11
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 43
            n := 11
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 147
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 147
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 22
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 22
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 118
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 118
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 39
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 39
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 98
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 98
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 87
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 87
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 5
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 5
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 44
            n := 18
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 44
            n := 18
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 2
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 55
            n := 2
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 55
            n := 3
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 56
            n := 17
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 56
            n := 3
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 33
            n := 2
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 33
            n := 1
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 33
            n := 3
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 33
            n := 26
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 33
            n := 7
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 26
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 58
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 71
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 11
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 27
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 68
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 72
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 18
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 48
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 66
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 67
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 76
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 85
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 27
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 71
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 97
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 102
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 41
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 65
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 52
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 71
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 21
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 42
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 44
            n := 64
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 42
            n := 94
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 28
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 60
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 79
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 11
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 35
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 58
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 44
            n := 62
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 16
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 45
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 50
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 43
            n := 77
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 43
            n := 18
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 88
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 109
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 121
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 25
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 63
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 49
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 59
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 23
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 5
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 22
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 8
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 24
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 9
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 17
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 21
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 25
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 54
            n := 25
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 24
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 21
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 19
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 23
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 17
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 7
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 25
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 33
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 5
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 13
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 13
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 14
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 37
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 33
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 13
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 17
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 8
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 9
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 12
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 16
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 24
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 8
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 17
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 10
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 32
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 17
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 51
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 10
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 33
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 4
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 4
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 16
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 13
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 44
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 43
            n := 11
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 44
            n := 17
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 44
            n := 8
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 12
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 4
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 22
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 44
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 20
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 18
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 26
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 12
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 15
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 13
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 44
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 7
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 9
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 5
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 7
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 50
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 11
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 4
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 5
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 6
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 12
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 48
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 22
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 21
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 16
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 14
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 8
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 54
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 25
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 12
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 20
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 54
            n := 18
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 54
            n := 22
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 54
            n := 9
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 14
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 19
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 18
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 53
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 16
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 30
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 7
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 17
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 6
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 9
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 9
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 11
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 21
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 15
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 16
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 26
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 14
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 12
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 23
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 10
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 7
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 8
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 6
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 9
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 6
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 2
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 1
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 3
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 13
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 8
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 4
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 12
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 5
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 5
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 30
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 16
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 46
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 5
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 10
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 27
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 30
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 53
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 29
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 87
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 213
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 59
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 118
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 24
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 59
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 135
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 110
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 26
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 46
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 127
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 242
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 18
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 151
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 116
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 48
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 23
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 71
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 121
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 110
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 22
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 27
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 114
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 193
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 46
            n := 8
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 47
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 115
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 33
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 6
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 48
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 139
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 88
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 35
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 139
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 216
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 21
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 168
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 178
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 44
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 22
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 87
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 163
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 46
            n := 119
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 46
            n := 2
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 41
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 42
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 13
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 25
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 26
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 39
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 41
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 45
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 38
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 33
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 34
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 12
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 48
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 39
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 5
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 22
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 21
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 10
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 23
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 27
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 75
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 56
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 23
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 43
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 35
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 19
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 42
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 42
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 25
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 74
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 7
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 7
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 26
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 69
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 21
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 9
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 49
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 101
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 3
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 88
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 11
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 7
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 23
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 36
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 89
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 20
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 14
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 46
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 37
            n := 5
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 37
            n := 58
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 37
            n := 87
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 37
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 36
            n := 49
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 35
            n := 11
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 36
            n := 6
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 36
            n := 3
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 36
            n := 30
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 36
            n := 69
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 37
            n := 35
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 36
            n := 10
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 36
            n := 2
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 36
            n := 38
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 36
            n := 66
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 36
            n := 1
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 35
            n := 85
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 35
            n := 8
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 35
            n := 3
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 35
            n := 9
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 35
            n := 30
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 35
            n := 63
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 35
            n := 17
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 35
            n := 9
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 12
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 3
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 3
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 24
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 25
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 18
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 57
            n := 5
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 57
            n := 9
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 29
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 56
            n := 17
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 56
            n := 21
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 56
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 17
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 99
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 208
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 7
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 71
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 95
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 29
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 51
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 138
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 105
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 49
            n := 16
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 17
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 158
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 270
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 14
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 154
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 113
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 33
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 18
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 76
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 126
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 114
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 24
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 21
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 126
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 195
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 59
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 96
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 40
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 60
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 151
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 94
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 16
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 33
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 123
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 215
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 18
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 162
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 159
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 45
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 14
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 56
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 162
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 113
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 19
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 9
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 53
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 36
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 18
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 42
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 30
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 19
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 63
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 46
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 22
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 36
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 43
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 19
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 41
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 33
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 62
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 32
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 5
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 31
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 17
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 43
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 33
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == -1 and arS == 1
            rate := 51
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 60
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 38
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 20
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 35
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 40
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 48
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 51
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 51
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 32
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 57
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 28
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 4
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 9
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 17
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 62
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 13
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 5
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 58
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 101
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 102
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 4
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 19
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 39
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 84
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 32
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 15
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 58
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 40
            n := 93
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 40
            n := 49
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 9
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 40
            n := 5
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 40
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 24
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 79
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 31
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 41
            n := 4
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 41
            n := 3
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 40
            n := 23
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 41
            n := 61
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 41
            n := 2
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 41
            n := 75
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 41
            n := 6
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 41
            n := 5
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 41
            n := 10
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 41
            n := 24
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 42
            n := 61
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 41
            n := 22
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 6
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 52
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 23
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 17
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 13
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 81
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 19
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 37
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 33
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 81
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 34
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 190
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 28
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 71
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 130
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 94
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 18
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 45
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 59
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 132
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 28
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 17
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 178
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 16
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 89
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 58
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 2
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 41
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 50
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 106
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 19
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 97
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 47
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 29
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 21
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 42
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 6
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 55
            n := 12
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 32
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 2
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 55
            n := 2
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 5
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 6
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 47
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 20
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 56
            n := 44
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 53
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 30
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 39
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 33
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 56
            n := 13
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 56
            n := 27
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 12
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 20
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 25
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 31
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 28
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 8
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 12
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 52
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 93
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 26
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 40
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 54
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 34
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 8
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 157
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 88
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 113
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 44
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 90
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 15
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 5
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 155
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 87
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 60
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 9
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 72
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 42
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 55
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 46
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 35
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 8
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 5
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 18
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 22
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 1
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 10
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 13
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 42
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 113
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 189
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 24
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 64
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 106
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 67
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 48
            n := 14
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 82
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 83
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 92
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 20
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 74
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 93
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 183
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 35
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 151
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 120
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 81
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 34
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 118
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 102
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 99
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 19
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 36
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 106
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 165
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 46
            n := 27
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 50
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 96
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 79
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 9
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 59
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 98
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 107
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 19
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 77
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 106
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 183
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 44
            n := 41
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 110
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 153
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 102
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 27
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 106
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 114
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 130
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 44
            n := 24
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 10
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 41
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 50
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 14
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 22
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 15
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 35
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 28
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 25
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 38
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 49
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 37
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 43
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 18
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 29
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 13
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 29
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 41
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 11
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 25
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 29
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 16
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 39
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 40
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 40
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 50
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 25
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 40
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 34
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 36
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 38
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 28
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 46
            n := 2
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 9
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 26
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 77
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 28
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 20
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 14
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 6
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 29
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 51
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 27
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 9
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 18
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 41
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 75
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 7
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 53
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 20
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 12
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 25
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 40
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 46
            n := 68
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 12
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 35
            n := 13
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 35
            n := 43
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 35
            n := 69
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 35
            n := 2
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 35
            n := 39
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 35
            n := 20
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 35
            n := 16
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 35
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 34
            n := 30
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 34
            n := 46
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 34
            n := 30
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 34
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 36
            n := 17
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 37
            n := 32
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 37
            n := 70
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 36
            n := 4
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 34
            n := 68
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 34
            n := 19
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 34
            n := 17
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 34
            n := 13
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 34
            n := 37
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 34
            n := 64
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 34
            n := 28
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 34
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 8
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 14
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 22
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 17
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 14
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 14
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 3
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 11
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 17
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 11
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 25
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 15
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 11
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 11
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 5
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 9
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 20
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 10
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 26
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 8
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 18
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 20
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 40
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 54
            n := 19
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 12
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 18
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 8
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 53
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 3
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 54
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 54
            n := 5
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 55
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 55
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 55
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 54
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 54
            n := 5
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 3
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 55
            n := 5
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 55
            n := 3
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 9
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 4
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 2
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 10
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 12
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 3
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 9
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 51
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 6
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 7
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 30
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 25
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 10
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 41
            n := 5
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 41
            n := 9
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 42
            n := 12
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 27
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 19
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 42
            n := 4
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 188
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 10
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 42
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 113
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 47
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 46
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 97
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 117
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 16
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 30
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 107
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 278
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 33
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 139
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 209
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 48
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 80
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 157
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 129
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 31
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 85
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 286
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 18
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 46
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 118
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 33
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 6
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 61
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 126
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 120
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 30
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 72
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 238
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 126
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 162
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 47
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 11
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 67
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 117
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 134
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 21
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 48
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 5
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 26
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 4
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 27
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 24
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 34
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 30
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 69
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 68
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 26
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 37
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 29
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 24
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 46
            n := 42
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 46
            n := 42
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 51
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 55
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 10
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 26
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 18
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 43
            n := 10
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 24
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 38
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 16
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 36
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 46
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 37
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 45
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 41
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 15
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 26
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 36
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 88
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 44
            n := 1
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 37
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 22
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 11
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 84
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 44
            n := 25
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 6
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 25
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 100
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 1
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 88
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 29
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 2
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 27
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 76
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 13
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 4
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 20
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 99
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 4
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 41
            n := 47
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 5
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 41
            n := 3
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 41
            n := 25
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 78
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 11
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 41
            n := 23
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 41
            n := 106
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 41
            n := 1
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 41
            n := 97
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 41
            n := 16
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 41
            n := 1
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 41
            n := 4
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 32
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 41
            n := 83
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 18
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 41
            n := 17
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 41
            n := 1
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 5
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 55
            n := 24
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 22
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 54
            n := 17
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 7
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 3
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 6
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 24
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 30
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 43
            n := 19
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 43
            n := 2
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 32
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 116
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 202
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 12
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 54
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 116
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 40
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 7
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 61
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 135
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 107
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 15
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 128
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 190
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 18
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 146
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 160
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 44
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 17
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 73
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 168
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 92
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 16
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 81
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 211
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 46
            n := 11
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 47
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 95
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 30
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 5
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 60
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 117
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 113
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 14
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 33
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 115
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 286
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 15
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 121
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 171
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 56
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 22
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 66
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 150
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 123
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 46
            n := 25
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 50
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 30
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 8
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 28
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 19
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 10
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 26
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == -1 and arS == 1
            rate := 50
            n := 2
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 57
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 35
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 18
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 45
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 29
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 41
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 48
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 9
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 37
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 43
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 26
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 14
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 8
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 37
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 31
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 11
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 48
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 44
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 39
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 43
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 28
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 46
            n := 26
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 46
            n := 45
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 4
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 44
            n := 69
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 101
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 44
            n := 8
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 56
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 17
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 12
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 29
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 100
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 33
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 15
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 41
            n := 28
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 41
            n := 49
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 41
            n := 4
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 54
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 42
            n := 12
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 42
            n := 5
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 42
            n := 13
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 43
            n := 12
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 43
            n := 47
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 14
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 43
            n := 9
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 35
            n := 19
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 36
            n := 55
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 35
            n := 1
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 36
            n := 29
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 35
            n := 6
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 35
            n := 3
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 35
            n := 3
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 35
            n := 10
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 35
            n := 44
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 35
            n := 17
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 35
            n := 4
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 33
            n := 2
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 33
            n := 52
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 33
            n := 121
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 33
            n := 15
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 33
            n := 136
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 33
            n := 23
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 34
            n := 8
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 33
            n := 15
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 33
            n := 33
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 33
            n := 102
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 33
            n := 37
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 33
            n := 25
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 4
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 6
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 29
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 31
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 4
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 13
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 35
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 18
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 4
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 41
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 101
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 171
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 14
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 35
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 86
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 75
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 14
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 52
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 75
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 103
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 112
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 106
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 180
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 26
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 140
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 146
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 116
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 47
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 97
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 115
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 117
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 28
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 68
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 81
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 159
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 19
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 50
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 103
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 62
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 11
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 71
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 97
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 105
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 22
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 89
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 93
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 157
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 123
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 126
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 91
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 25
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 103
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 88
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 86
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 6
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 36
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 35
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 6
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 19
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 25
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 10
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 19
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 29
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 29
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 46
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 42
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 29
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 57
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 48
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 23
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 35
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 34
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 52
            n := 1
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 18
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 39
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 32
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 20
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 25
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 9
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 34
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 38
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 39
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 36
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 26
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 33
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 21
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 21
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 51
            n := 1
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 44
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 3
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 9
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 26
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 10
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 18
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 39
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 16
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 4
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 18
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 62
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 83
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 7
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 73
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 35
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 62
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 54
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 42
            n := 47
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 77
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 42
            n := 2
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 40
            n := 36
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 14
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 40
            n := 37
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 40
            n := 61
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 40
            n := 25
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 40
            n := 9
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 38
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 38
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 6
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 33
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 17
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 18
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 30
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 39
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 24
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 7
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 7
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 23
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 23
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 18
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 18
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 17
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 17
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 54
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 54
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 5
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 5
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 23
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 23
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 39
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 39
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 15
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 15
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 45
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 45
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 76
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 76
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 215
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 215
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 16
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 16
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 71
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 71
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 135
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 135
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 66
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 66
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 70
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 70
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 92
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 92
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 123
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 123
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 19
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 19
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 51
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 51
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 98
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 98
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 239
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 239
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 14
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 14
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 128
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 128
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 173
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 173
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 67
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 67
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 11
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 11
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 64
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 64
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 116
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 116
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 134
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 134
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 12
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 12
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 37
            n := 41
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 37
            n := 41
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 38
            n := 76
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 38
            n := 76
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 38
            n := 216
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 38
            n := 216
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 38
            n := 12
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 38
            n := 12
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 55
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 55
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 38
            n := 127
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 38
            n := 127
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 39
            n := 41
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 39
            n := 41
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 39
            n := 5
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 39
            n := 5
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 37
            n := 61
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 37
            n := 61
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 38
            n := 84
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 38
            n := 84
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 37
            n := 99
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 37
            n := 99
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 37
            n := 9
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 37
            n := 9
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 38
            n := 40
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 38
            n := 40
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 38
            n := 68
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 38
            n := 68
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 39
            n := 238
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 39
            n := 238
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 39
            n := 14
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 39
            n := 14
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 37
            n := 155
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 37
            n := 155
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 38
            n := 248
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 38
            n := 248
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 37
            n := 103
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 37
            n := 103
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 38
            n := 8
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 38
            n := 8
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 38
            n := 75
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 38
            n := 75
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 38
            n := 129
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 38
            n := 129
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 38
            n := 136
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 38
            n := 136
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 38
            n := 9
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 38
            n := 9
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 9
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 9
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 46
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 46
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 10
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 10
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 28
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 28
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 36
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 36
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 33
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 33
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 40
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 40
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 46
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 46
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 28
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 28
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 46
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 46
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 30
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 30
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 34
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 34
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 15
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 15
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 41
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 41
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 40
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 40
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 18
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 18
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 23
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 23
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 44
            n := 39
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 44
            n := 39
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 44
            n := 27
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 44
            n := 27
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 16
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 16
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 48
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 48
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 36
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 36
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 47
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 47
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 53
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 53
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 43
            n := 43
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 43
            n := 43
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 43
            n := 14
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 43
            n := 14
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 43
            n := 47
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 43
            n := 47
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 38
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 38
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 31
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 31
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 85
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 85
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 26
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 26
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 10
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 10
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 2
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 2
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 29
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 29
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 44
            n := 77
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 44
            n := 77
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 5
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 5
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 38
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 38
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 107
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 107
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 1
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 100
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 100
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 26
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 26
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 18
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 18
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 60
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 60
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 100
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 100
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 35
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 35
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 38
            n := 10
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 38
            n := 10
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 39
            n := 42
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 39
            n := 42
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 38
            n := 101
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 38
            n := 101
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 38
            n := 2
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 38
            n := 2
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 43
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 43
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 39
            n := 20
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 39
            n := 20
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 39
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 39
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 39
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 39
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 40
            n := 57
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 40
            n := 57
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 39
            n := 92
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 39
            n := 92
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 40
            n := 32
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 40
            n := 32
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 39
            n := 7
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 39
            n := 7
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 38
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 38
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 38
            n := 29
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 38
            n := 29
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 38
            n := 80
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 38
            n := 80
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 38
            n := 76
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 38
            n := 76
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 38
            n := 17
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 38
            n := 17
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 38
            n := 6
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 38
            n := 6
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 38
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 38
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 37
            n := 41
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 37
            n := 41
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 37
            n := 73
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 37
            n := 73
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 37
            n := 14
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 37
            n := 14
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 37
            n := 4
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 37
            n := 4
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 38
            n := 1
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 38
            n := 1
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 4
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 7
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 31
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 5
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 6
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 20
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 55
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 62
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 202
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 22
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 67
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 100
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 33
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 48
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 84
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 91
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 111
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 12
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 56
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 104
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 262
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 27
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 136
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 164
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 60
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 82
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 106
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 151
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 26
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 43
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 83
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 226
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 46
            n := 15
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 62
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 131
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 45
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 62
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 109
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 97
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 14
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 35
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 79
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 232
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 141
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 240
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 85
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 54
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 116
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 127
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 20
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 48
            n := 2
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 41
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 6
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 27
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 27
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 29
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 33
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 38
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 65
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 54
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 36
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 16
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 23
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 48
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 13
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 57
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 7
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 37
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 20
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 32
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 40
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 11
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 35
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 41
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 35
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 41
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 37
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 41
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 2
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 35
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 88
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 44
            n := 3
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 38
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 14
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 3
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 32
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 73
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 18
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 7
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 38
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 111
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 103
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 30
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 6
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 39
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 91
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 22
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 105
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 2
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 28
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 30
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 6
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 42
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 79
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 31
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 44
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 83
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 86
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 22
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 9
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 5
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 48
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 46
            n := 72
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 22
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 4
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 4
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 47
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 46
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 22
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 26
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 21
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 23
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 48
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 42
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 9
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 14
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 21
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 49
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 57
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 72
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 65
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 30
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 38
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 32
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 54
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 37
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 44
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 55
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 28
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 33
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 30
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 32
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 38
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 12
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 23
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 57
            n := 2
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 57
            n := 18
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 57
            n := 7
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 57
            n := 8
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 57
            n := 1
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 13
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 57
            n := 2
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 57
            n := 42
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 57
            n := 8
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 52
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 56
            n := 22
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 56
            n := 20
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 20
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 57
            n := 14
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 57
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 26
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 9
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 16
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 8
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 6
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 7
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 96
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 87
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 51
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 23
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 84
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 78
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 106
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 91
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 90
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 36
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 35
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 9
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 68
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 82
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 34
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 38
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 48
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 122
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 59
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 11
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 76
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 83
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 40
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 57
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 101
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 64
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 24
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 24
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 11
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 11
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 30
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 30
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 14
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 14
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 35
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 35
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 54
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 54
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 122
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 122
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 2
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 2
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 4
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 4
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 91
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 91
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 13
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 13
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 93
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 93
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 70
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 70
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 36
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 36
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 4
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 4
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 57
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 57
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 59
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 59
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 46
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 46
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 37
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 37
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 4
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 4
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 58
            n := 15
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 58
            n := 15
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 13
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 13
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 58
            n := 13
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 58
            n := 13
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 37
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 37
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 44
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 44
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 58
            n := 3
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 58
            n := 3
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 37
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 37
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 25
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 25
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 19
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 19
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 30
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 30
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 20
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 20
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 82
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 82
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 7
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 7
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 40
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 40
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 6
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 6
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 66
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 66
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 9
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 9
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 246
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 246
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 164
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 164
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 17
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 17
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 197
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 197
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 15
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 15
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 28
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 28
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 150
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 150
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 70
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 70
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 14
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 14
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 19
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 19
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 140
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 140
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 9
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 9
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 23
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 23
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 130
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 130
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 2
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 2
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 5
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 5
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 97
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 97
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 10
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 10
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 80
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 80
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 4
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 4
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 1
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 6
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 52
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 23
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 17
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 13
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 81
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 19
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 37
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 33
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 81
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 34
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 190
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 28
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 71
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 130
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 94
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 18
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 45
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 59
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 132
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 28
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 17
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 178
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 16
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 89
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 58
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 2
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 41
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 50
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 106
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 19
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 97
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 47
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 29
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 21
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 42
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 6
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 7
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 55
            n := 12
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 32
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 2
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 55
            n := 2
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 5
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 6
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 7
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 47
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 20
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 56
            n := 44
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 53
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 30
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 39
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 33
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 56
            n := 13
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 56
            n := 27
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 12
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 20
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 25
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 31
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 28
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 8
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 7
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 12
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 52
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 93
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 26
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 40
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 54
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 34
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 8
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 157
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 88
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 113
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 44
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 90
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 15
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 5
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 155
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 87
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 60
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 9
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 72
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 42
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 55
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 46
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 35
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 7
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 5
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 34
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 21
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 74
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 81
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 49
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 37
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 45
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 51
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 94
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 104
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 29
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 101
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 78
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 68
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 15
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 65
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 92
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 60
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 72
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 66
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 80
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 10
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 67
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 62
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 59
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 60
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 12
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 47
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 40
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 46
            n := 2
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 8
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 28
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 9
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 23
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 32
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 31
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 26
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 24
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 15
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 16
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 22
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 42
            n := 19
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 13
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 42
            n := 14
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 9
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 42
            n := 24
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 42
            n := 9
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 42
            n := 17
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 11
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 42
            n := 2
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 84
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 74
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 28
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 33
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 54
            n := 46
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 69
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 75
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 24
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 100
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 111
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 107
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 58
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 58
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 33
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 114
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 97
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 90
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 97
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 40
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 67
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 54
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 21
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 133
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 77
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 9
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 43
            n := 65
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 43
            n := 78
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 55
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 50
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 20
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 80
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 52
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 59
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 59
            n := 3
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 43
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 46
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 58
            n := 25
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 18
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 26
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 25
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 77
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 37
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 16
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 36
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 33
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 77
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 43
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 192
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 36
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 69
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 140
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 92
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 58
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 50
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 126
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 23
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 162
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 15
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 29
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 62
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 10
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 52
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 115
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 16
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 98
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 25
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 20
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 30
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 38
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 12
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 56
            n := 25
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 3
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 10
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 10
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 54
            n := 31
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 54
            n := 38
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 40
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 31
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 54
            n := 45
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 33
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 54
            n := 12
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 54
            n := 34
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 21
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 6
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 27
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 17
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 36
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 16
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 32
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 16
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 31
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 10
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 14
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 12
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 100
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 25
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 48
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 13
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 143
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 88
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 104
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 7
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 50
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 91
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 61
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 5
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 7
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 138
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 41
            n := 8
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 41
            n := 24
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 86
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 4
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 41
            n := 1
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 33
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 41
            n := 72
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 60
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 3
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 5
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 86
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 54
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 24
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 62
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 41
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 5
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 36
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 14
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 13
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 15
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 22
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 121
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 31
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 69
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 11
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 33
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 40
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 52
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 32
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 188
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 16
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 66
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 124
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 66
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 107
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 142
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 24
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 92
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 31
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 20
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 30
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 119
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 54
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 89
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 2
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 38
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 59
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 13
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 55
            n := 13
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 11
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 11
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 55
            n := 15
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 55
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 55
            n := 15
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 32
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 17
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 55
            n := 33
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 32
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 25
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 19
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 55
            n := 14
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 55
            n := 31
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 55
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 18
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 30
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 18
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 18
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 19
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 24
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 15
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 24
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 29
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 27
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 16
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 11
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 19
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 138
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 3
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 56
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 41
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 2
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 19
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 102
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 87
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 30
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 93
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 12
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 7
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 10
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 85
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 29
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 26
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 18
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 86
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 27
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 13
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 1
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 16
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 153
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 3
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 111
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 4
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 35
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 124
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 42
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 4
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 47
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 46
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 22
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 26
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 21
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 23
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 48
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 42
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 9
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 14
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 21
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 49
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 57
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 72
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 65
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 30
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 38
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 32
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 54
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 37
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 44
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 55
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 28
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 33
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 30
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 32
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 38
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 12
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 23
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 57
            n := 2
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 57
            n := 18
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 57
            n := 7
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 57
            n := 8
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 57
            n := 1
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 13
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 57
            n := 2
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 57
            n := 42
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 57
            n := 8
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 52
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 56
            n := 22
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 56
            n := 20
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 20
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 57
            n := 14
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 57
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 26
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 9
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 16
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 8
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 6
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 7
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 96
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 87
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 51
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 23
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 84
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 78
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 106
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 91
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 90
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 36
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 35
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 9
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 68
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 82
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 34
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 38
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 48
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 122
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 59
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 11
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 76
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 83
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 40
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 57
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 101
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 64
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 7
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 5
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 34
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 21
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 74
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 81
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 49
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 37
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 45
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 51
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 94
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 104
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 29
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 101
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 78
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 68
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 15
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 65
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 92
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 60
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 72
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 66
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 80
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 10
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 67
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 62
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 59
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 60
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 12
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 47
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 40
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 46
            n := 2
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 8
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 28
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 9
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 23
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 32
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 31
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 26
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 24
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 15
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 16
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 22
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 42
            n := 19
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 13
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 42
            n := 14
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 9
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 42
            n := 24
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 42
            n := 9
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 42
            n := 17
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 11
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 42
            n := 2
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 84
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 74
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 28
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 33
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 54
            n := 46
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 69
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 75
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 24
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 100
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 111
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 107
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 58
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 58
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 33
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 114
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 97
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 90
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 97
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 40
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 67
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 54
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 21
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 133
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 77
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 9
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 43
            n := 65
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 43
            n := 78
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 55
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 50
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 20
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 80
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 52
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 40
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 37
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 24
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 39
            n := 12
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 39
            n := 22
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 8
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 39
            n := 2
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 38
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 94
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 20
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 20
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 53
            n := 3
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 32
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 5
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 63
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 30
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 195
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 28
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 64
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 156
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 91
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 57
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 63
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 91
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 22
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 161
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 34
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 55
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 3
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 45
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 50
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 121
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 21
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 108
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 12
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 18
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 22
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 44
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 29
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 12
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 43
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 25
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 35
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 32
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 11
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 31
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 18
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 26
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 23
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 16
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 28
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 23
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 15
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 30
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 8
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 5
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 108
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 34
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 53
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 17
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 61
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 34
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 134
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 73
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 95
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 35
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 92
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 69
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 136
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 82
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 79
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 61
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 11
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 92
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 58
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 66
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 2
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 1
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 58
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 53
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 9
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 4
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 7
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 31
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 5
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 6
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 15
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 20
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 55
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 62
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 202
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 22
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 67
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 100
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 33
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 48
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 84
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 91
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 111
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 12
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 56
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 104
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 262
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 27
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 136
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 164
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 60
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 82
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 106
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 151
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 26
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 43
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 83
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 226
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 46
            n := 15
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 62
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 131
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 45
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 62
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 109
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 97
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 14
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 35
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 79
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 232
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 141
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 240
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 85
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 54
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 116
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 127
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 20
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 48
            n := 2
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 41
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 6
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 27
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 27
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 29
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 33
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 38
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 65
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 54
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 36
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 16
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 23
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 48
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 13
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 57
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 7
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 49
            n := 37
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 20
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 32
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 40
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 11
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 35
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 41
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 35
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 41
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 37
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 41
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 2
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 35
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 88
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 44
            n := 3
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 38
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 45
            n := 14
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 45
            n := 3
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 32
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 73
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 18
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 7
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 38
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 111
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 103
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 30
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 6
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 39
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 91
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 22
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 105
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 2
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 28
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 30
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 6
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 42
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 79
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 31
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 44
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 83
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 86
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 22
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 46
            n := 9
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 5
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 46
            n := 48
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 46
            n := 72
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 22
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 9
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 18
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 34
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 20
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 13
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 35
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 6
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 36
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 92
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 20
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 99
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 10
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 47
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 76
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 47
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 42
            n := 69
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 42
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 42
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 42
            n := 10
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 26
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 42
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 53
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 6
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 73
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 10
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 45
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 40
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 13
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 41
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 10
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 38
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 21
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 40
            n := 21
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 41
            n := 19
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 7
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 35
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 40
            n := 8
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 39
            n := 6
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 40
            n := 26
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 40
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 82
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 20
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 39
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 7
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 82
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 224
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 66
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 203
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 7
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 10
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 50
            n := 30
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 192
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 40
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 137
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 43
            n := 24
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 83
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 4
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 43
            n := 11
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 44
            n := 147
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 3
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 43
            n := 22
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 118
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 39
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 98
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 44
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 87
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 5
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 44
            n := 18
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 4
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 47
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 46
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 22
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 26
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 21
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 23
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 48
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 42
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 9
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 14
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 16
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 21
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 21
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 49
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 57
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 72
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 65
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 30
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 38
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 32
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 40
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 54
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 37
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 44
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 49
            n := 55
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 28
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 33
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 30
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 32
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 38
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 12
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 23
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 57
            n := 2
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 57
            n := 18
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 57
            n := 7
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 57
            n := 8
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 57
            n := 1
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 13
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 57
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 57
            n := 2
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 57
            n := 42
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 57
            n := 8
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 52
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 56
            n := 22
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 56
            n := 20
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 20
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 57
            n := 14
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 57
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 26
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 9
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 16
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 31
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 49
            n := 8
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 6
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 7
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 10
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 96
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 87
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 51
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 23
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 84
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 78
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 11
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 106
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 91
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 90
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 36
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 53
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 35
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == -1 and arS == 2
            rate := 50
            n := 1
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 9
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 68
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 82
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 34
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 38
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 48
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 19
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 122
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 59
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 11
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 76
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 83
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 40
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 57
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 101
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 64
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 24
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 11
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 30
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 14
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 54
            n := 35
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 54
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 122
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 2
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 4
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 91
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 13
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 93
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 70
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 36
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 4
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 48
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 57
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 47
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 59
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 46
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 47
            n := 2
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 37
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 4
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 58
            n := 15
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 13
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 58
            n := 13
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 37
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 44
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 58
            n := 3
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 57
            n := 37
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 25
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 46
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 19
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 47
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 30
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 20
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 82
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 7
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 40
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 6
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 66
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 9
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 246
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 10
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 164
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 17
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 24
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 197
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 15
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 28
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 150
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 8
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 43
            n := 70
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 14
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 19
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 140
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 9
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 43
            n := 23
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 130
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 2
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 5
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 97
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 10
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 80
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 4
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 6
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 52
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 23
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 17
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 13
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 81
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 19
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 37
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 33
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 81
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 34
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 190
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 28
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 71
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 130
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 94
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 18
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 45
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 59
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 132
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 28
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 17
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 178
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 16
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 89
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 58
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 2
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 41
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 50
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 106
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 19
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 97
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 47
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 29
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 21
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 42
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 6
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 7
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 55
            n := 12
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 32
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 2
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 55
            n := 2
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 5
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 6
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 7
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 47
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 20
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 56
            n := 44
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 53
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 30
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 39
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 33
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 56
            n := 13
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 56
            n := 27
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 12
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 20
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 25
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 31
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 28
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 8
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 7
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 12
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 52
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 93
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 26
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 40
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 54
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 34
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 8
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 157
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 88
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 113
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 44
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 90
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 15
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 5
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 155
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 87
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 60
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 9
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 72
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 42
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 55
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 46
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 35
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 7
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 1
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 5
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 34
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 21
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 49
            n := 10
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 10
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 49
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 17
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 16
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 2
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 9
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 74
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 81
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 49
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 37
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 8
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 45
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 51
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 28
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 94
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 104
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 29
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 101
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 78
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 68
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 15
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 46
            n := 65
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 46
            n := 92
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 60
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 72
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 21
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 66
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 80
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 10
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 67
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 62
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 20
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 46
            n := 59
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 60
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 12
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 47
            n := 47
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 47
            n := 40
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 46
            n := 2
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 8
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 28
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 4
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 9
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 8
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 23
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 32
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 31
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 26
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 24
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 48
            n := 28
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 48
            n := 15
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 16
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 43
            n := 22
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 42
            n := 19
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 17
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 13
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 42
            n := 15
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 42
            n := 14
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 42
            n := 9
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 42
            n := 24
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 42
            n := 9
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 42
            n := 17
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 42
            n := 11
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 42
            n := 2
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 11
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 84
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 74
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 28
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 33
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 54
            n := 46
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 69
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 75
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 24
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 100
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 111
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 107
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 58
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 48
            n := 58
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 33
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 114
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 97
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 16
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 90
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 97
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 40
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 67
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 54
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 21
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 43
            n := 133
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 77
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 43
            n := 9
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 43
            n := 65
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 43
            n := 78
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 55
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 50
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 20
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 80
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 52
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 1
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 2
            rate := 44
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 40
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 37
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 24
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 39
            n := 12
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 39
            n := 22
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 8
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 39
            n := 2
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 38
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 94
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 20
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 20
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 53
            n := 3
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 32
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 5
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 63
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 30
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 195
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 28
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 64
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 156
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 91
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 57
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 63
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 91
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 22
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 161
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 34
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 55
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 3
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 45
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 50
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 121
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 21
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 108
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 12
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 18
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 22
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 44
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 29
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 12
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 43
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 25
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 35
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 32
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 11
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 31
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 18
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 26
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 23
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 16
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 28
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 23
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 15
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 30
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 8
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 5
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 108
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 34
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 53
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 17
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 61
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 34
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 134
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 73
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 95
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 35
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 92
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 69
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 136
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 82
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 79
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 61
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 11
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 92
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 58
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 66
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 2
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 1
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 58
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 53
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 9
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 59
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 59
            n := 3
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 43
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 46
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 58
            n := 25
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 18
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 26
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 25
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 77
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 37
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 16
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 36
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 33
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 77
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 43
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 192
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 36
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 69
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 140
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 92
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 58
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 50
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 126
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 23
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 162
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 15
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 29
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 62
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 10
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 52
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 115
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 16
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 98
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 25
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 20
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 30
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 38
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 12
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 56
            n := 25
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 3
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 10
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 10
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 54
            n := 31
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 54
            n := 38
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 40
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 31
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 54
            n := 45
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 33
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 54
            n := 12
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 54
            n := 34
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 21
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 6
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 27
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 17
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 36
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 16
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 32
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 16
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 31
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 10
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 14
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 12
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 100
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 25
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 48
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 13
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 143
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 88
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 104
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 7
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 50
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 91
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 61
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 5
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 7
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 138
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 41
            n := 8
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 41
            n := 24
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 86
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 4
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 41
            n := 1
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 33
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 41
            n := 72
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 60
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 3
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 5
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 86
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 54
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 24
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 62
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 41
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 5
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 36
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 14
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 13
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 15
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 22
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 121
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 31
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 69
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 11
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 33
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 40
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 52
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 32
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 188
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 16
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 66
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 124
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 66
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 107
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 142
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 24
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 92
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 31
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 20
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 30
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 119
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 54
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 89
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 2
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 38
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 59
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 13
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 55
            n := 13
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 11
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 11
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 55
            n := 15
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 55
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 55
            n := 15
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 32
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 17
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 55
            n := 33
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 32
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 25
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 19
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 55
            n := 14
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 55
            n := 31
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 55
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 18
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 30
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 18
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 18
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 19
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 24
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 15
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 24
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 29
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 27
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 16
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 11
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 19
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 138
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 3
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 56
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 41
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 2
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 19
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 102
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 87
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 30
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 93
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 12
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 7
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 10
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 85
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 29
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 26
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 18
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 86
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 27
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 13
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 1
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 16
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 153
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 3
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 111
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 4
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 35
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 124
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 42
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 54
            n := 6
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 2
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 52
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 23
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 46
            n := 17
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 13
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 31
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 6
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 48
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 23
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 81
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 38
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 20
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 19
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 37
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 33
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 81
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 34
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 190
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 28
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 71
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 130
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 94
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 18
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 45
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 59
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 132
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 15
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 28
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 17
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 178
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 16
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 30
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 48
            n := 89
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 58
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 2
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 48
            n := 41
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 50
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 106
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 19
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 14
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 97
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 13
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 47
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 29
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 21
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 42
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 6
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 7
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 55
            n := 12
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 32
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 2
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 55
            n := 2
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 5
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 6
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 7
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 47
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 20
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 56
            n := 44
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 53
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 30
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 39
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 33
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 56
            n := 13
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 56
            n := 27
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 12
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 31
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 14
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 20
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 50
            n := 25
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 18
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 31
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 14
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 28
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 7
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 7
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 12
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 52
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 3
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 49
            n := 93
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 26
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 40
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 19
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 54
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 34
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 4
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 50
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 157
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 88
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 113
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 50
            n := 5
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 44
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 51
            n := 90
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 64
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 15
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 48
            n := 3
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 48
            n := 5
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 155
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 48
            n := 8
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 87
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 3
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 47
            n := 60
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 47
            n := 9
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 48
            n := 7
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 48
            n := 72
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 48
            n := 4
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 42
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 49
            n := 55
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 46
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 35
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 5
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 49
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 40
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 37
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 24
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 39
            n := 12
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 39
            n := 18
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 39
            n := 22
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 39
            n := 8
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 39
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 39
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 22
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 38
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 94
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 20
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 20
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 53
            n := 3
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 20
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 54
            n := 32
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 34
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 5
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 63
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 30
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 195
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 28
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 64
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 156
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 91
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 57
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 63
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 91
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 50
            n := 25
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 49
            n := 22
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 48
            n := 161
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 49
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 34
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 51
            n := 55
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 51
            n := 3
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 45
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 50
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 121
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 21
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 108
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 12
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 18
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 30
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 22
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 35
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 44
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 52
            n := 15
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 29
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 6
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 53
            n := 12
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 52
            n := 43
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 25
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 35
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 28
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 32
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 11
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 36
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 45
            n := 31
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 44
            n := 18
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 44
            n := 26
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 23
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 16
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 28
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 23
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 15
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 30
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 8
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 5
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 108
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 54
            n := 34
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 54
            n := 53
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 53
            n := 17
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 61
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 34
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 53
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 3
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 134
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 73
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 95
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 35
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 92
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 69
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 53
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 136
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 32
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 82
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 5
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 15
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 45
            n := 79
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 45
            n := 61
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 45
            n := 11
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 45
            n := 7
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 92
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 4
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 45
            n := 58
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 66
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 45
            n := 2
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 45
            n := 1
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 21
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 58
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 44
            n := 53
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 9
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 45
            n := 2
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 59
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 59
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 59
            n := 3
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 59
            n := 43
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 58
            n := 46
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 58
            n := 25
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 44
            n := 13
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 45
            n := 18
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 45
            n := 26
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 11
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 52
            n := 25
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 52
            n := 77
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 8
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 37
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 16
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 2
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 17
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 36
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 33
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 77
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 43
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 192
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 36
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 50
            n := 69
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 140
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 92
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 58
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 50
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 51
            n := 126
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 13
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 39
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 47
            n := 23
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 47
            n := 162
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 47
            n := 15
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 47
            n := 29
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 47
            n := 77
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 47
            n := 62
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 47
            n := 10
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 52
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 48
            n := 43
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 48
            n := 115
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 48
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 21
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 16
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 98
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 50
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 49
            n := 25
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 50
            n := 46
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 49
            n := 26
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 20
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 30
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 38
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 49
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 56
            n := 6
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 12
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 56
            n := 25
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 3
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 56
            n := 10
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 56
            n := 10
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 54
            n := 42
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 54
            n := 31
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 54
            n := 38
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 40
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 31
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 54
            n := 45
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 53
            n := 33
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 54
            n := 12
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 54
            n := 34
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 43
            n := 21
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 43
            n := 6
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 43
            n := 27
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 42
            n := 11
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 42
            n := 20
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 43
            n := 17
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 36
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 42
            n := 16
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 42
            n := 32
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 18
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 16
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 44
            n := 31
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 10
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 6
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 44
            n := 14
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 43
            n := 12
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == -1 and arS == 0
            rate := 44
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 5
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 100
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 25
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 48
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 15
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 49
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 2
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 13
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 51
            n := 143
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 52
            n := 9
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 88
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 104
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 7
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 50
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 91
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 61
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 41
            n := 5
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 41
            n := 7
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 41
            n := 138
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 41
            n := 8
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 41
            n := 24
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 41
            n := 86
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 41
            n := 4
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 41
            n := 1
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 42
            n := 33
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 41
            n := 72
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 41
            n := 60
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 41
            n := 7
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 44
            n := 3
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 44
            n := 5
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 45
            n := 86
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 44
            n := 43
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 44
            n := 54
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 44
            n := 2
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 24
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 45
            n := 62
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 41
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 5
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == -1 and arS == 1
            rate := 44
            n := 2
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 51
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 51
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 50
            n := 24
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 51
            n := 36
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 16
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 47
            n := 14
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 48
            n := 13
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 47
            n := 17
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 48
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 47
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 47
            n := 15
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 25
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 53
            n := 22
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 53
            n := 121
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 53
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 52
            n := 31
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 51
            n := 69
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 11
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 33
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 40
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 52
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 52
            n := 6
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 32
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 52
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 52
            n := 188
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 16
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 66
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 52
            n := 124
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 52
            n := 40
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 52
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 50
            n := 30
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 50
            n := 66
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 50
            n := 107
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 51
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 51
            n := 23
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 51
            n := 29
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 51
            n := 142
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 51
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 24
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 52
            n := 92
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 52
            n := 31
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 52
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 36
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 51
            n := 68
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 74
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 51
            n := 8
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 51
            n := 20
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 51
            n := 30
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 50
            n := 119
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 51
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 52
            n := 54
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 51
            n := 89
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 51
            n := 35
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 51
            n := 2
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 51
            n := 38
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 52
            n := 45
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 52
            n := 59
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 51
            n := 13
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 0
            rate := 55
            n := 13
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 56
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 56
            n := 11
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 56
            n := 7
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 0 and arS == 2
            rate := 56
            n := 11
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 55
            n := 15
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 55
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 55
            n := 15
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 0
            rate := 56
            n := 32
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 56
            n := 17
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 55
            n := 33
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 55
            n := 32
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 55
            n := 25
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 0 and arS == 2
            rate := 55
            n := 25
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 55
            n := 19
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 55
            n := 14
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 55
            n := 31
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1 and arT == 1 and arB == -1 and arS == 0
            rate := 55
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 53
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 54
            n := 18
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 54
            n := 30
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 53
            n := 9
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 53
            n := 18
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 0 and arS == 2
            rate := 53
            n := 18
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 52
            n := 19
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 52
            n := 19
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 52
            n := 24
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 53
            n := 15
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 53
            n := 24
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 53
            n := 29
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 53
            n := 27
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 53
            n := 16
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 0 and arS == 2
            rate := 53
            n := 11
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 52
            n := 13
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 53
            n := 11
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 53
            n := 19
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 1
            rate := 50
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 2
            rate := 50
            n := 138
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 2 and arS == 3
            rate := 50
            n := 3
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 0
            rate := 50
            n := 56
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 1
            rate := 50
            n := 41
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 0 and arS == 3
            rate := 50
            n := 2
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 0
            rate := 50
            n := 22
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 1
            rate := 50
            n := 114
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 2
            rate := 50
            n := 27
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 0 and arB == 1 and arS == 3
            rate := 50
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 1
            rate := 49
            n := 19
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 2
            rate := 49
            n := 102
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 2 and arS == 3
            rate := 49
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 0
            rate := 48
            n := 87
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 1
            rate := 48
            n := 30
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 0 and arS == 3
            rate := 48
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 0
            rate := 49
            n := 15
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 1
            rate := 49
            n := 93
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 2
            rate := 49
            n := 12
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1 and arT == 1 and arB == 1 and arS == 3
            rate := 49
            n := 7
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 0
            rate := 45
            n := 2
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 1
            rate := 45
            n := 10
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 2
            rate := 44
            n := 85
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 2 and arS == 3
            rate := 45
            n := 2
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 0
            rate := 46
            n := 29
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 1
            rate := 46
            n := 26
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 0 and arS == 3
            rate := 46
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 0
            rate := 46
            n := 18
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 1
            rate := 46
            n := 86
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 2
            rate := 46
            n := 27
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 0 and arB == 1 and arS == 3
            rate := 46
            n := 13
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 0
            rate := 46
            n := 1
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 1
            rate := 46
            n := 16
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 2
            rate := 46
            n := 153
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 2 and arS == 3
            rate := 46
            n := 3
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 0
            rate := 46
            n := 111
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 1
            rate := 45
            n := 51
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 0 and arS == 3
            rate := 46
            n := 4
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 0
            rate := 45
            n := 35
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 1
            rate := 44
            n := 124
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 2
            rate := 45
            n := 42
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1 and arT == 1 and arB == 1 and arS == 3
            rate := 45
            n := 8
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == 1
            rate := 47
            n := 84
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 102
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 2003
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "60" and dir == -1
            rate := 49
            n := 1986
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 556
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 560
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == 1
            rate := 48
            n := 688
        else if str.startswith(ticker, "AUDUSD") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 687
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 93
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 93
        else if str.startswith(ticker, "AUS200") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 85
        else if str.startswith(ticker, "ASX200") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 85
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 434
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 434
        else if str.startswith(ticker, "AUS200") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 369
        else if str.startswith(ticker, "ASX200") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 369
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == 1
            rate := 47
            n := 197
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == 1
            rate := 47
            n := 197
        else if str.startswith(ticker, "AUS200") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 177
        else if str.startswith(ticker, "ASX200") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 177
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1039
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1039
        else if str.startswith(ticker, "AUS200") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 814
        else if str.startswith(ticker, "ASX200") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 814
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 48
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 39
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 1290
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "60" and dir == -1
            rate := 46
            n := 1291
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 331
        else if str.startswith(ticker, "BNBUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 309
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 304
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 311
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 74
        else if str.startswith(ticker, "BTCUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 77
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 303
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 318
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 74
        else if str.startswith(ticker, "ETHUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 78
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 88
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 103
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 1983
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 2039
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 529
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 565
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 715
        else if str.startswith(ticker, "EURUSD") and timeframe.period == "15" and dir == -1
            rate := 43
            n := 695
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 83
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 1957
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 1994
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == 1
            rate := 47
            n := 553
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 563
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == 1
            rate := 48
            n := 699
        else if str.startswith(ticker, "GBPUSD") and timeframe.period == "15" and dir == -1
            rate := 45
            n := 655
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 128
        else if str.startswith(ticker, "NAS100") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 93
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1201
        else if str.startswith(ticker, "NAS100") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 952
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "NAS100") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 307
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 876
        else if str.startswith(ticker, "NAS100") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 785
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 78
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 96
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 2005
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "60" and dir == -1
            rate := 46
            n := 2025
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 552
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 568
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 704
        else if str.startswith(ticker, "NZDUSD") and timeframe.period == "15" and dir == -1
            rate := 42
            n := 692
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 299
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "60" and dir == -1
            rate := 49
            n := 323
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 73
        else if str.startswith(ticker, "SOLUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 79
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 93
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 86
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 2009
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 2003
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == 1
            rate := 47
            n := 546
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "240" and dir == -1
            rate := 46
            n := 541
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 726
        else if str.startswith(ticker, "USDCAD") and timeframe.period == "15" and dir == -1
            rate := 45
            n := 725
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 87
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 91
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == 1
            rate := 47
            n := 1982
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 1986
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 539
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 533
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == 1
            rate := 46
            n := 701
        else if str.startswith(ticker, "USDCHF") and timeframe.period == "15" and dir == -1
            rate := 42
            n := 760
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 98
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 90
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 2016
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 1872
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 529
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 518
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 713
        else if str.startswith(ticker, "USDJPY") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 654
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 79
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 79
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 101
        else if str.startswith(ticker, "SILVER") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 101
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == 1
            rate := 47
            n := 2041
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == 1
            rate := 47
            n := 2041
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "60" and dir == -1
            rate := 41
            n := 2049
        else if str.startswith(ticker, "SILVER") and timeframe.period == "60" and dir == -1
            rate := 41
            n := 2049
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 550
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 550
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "240" and dir == -1
            rate := 46
            n := 560
        else if str.startswith(ticker, "SILVER") and timeframe.period == "240" and dir == -1
            rate := 46
            n := 560
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 794
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 794
        else if str.startswith(ticker, "XAGUSD") and timeframe.period == "15" and dir == -1
            rate := 44
            n := 767
        else if str.startswith(ticker, "SILVER") and timeframe.period == "15" and dir == -1
            rate := 44
            n := 767
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 84
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 96
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 2038
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 2039
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 570
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 570
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 789
        else if str.startswith(ticker, "XAUUSD") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 768
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 139
        else if str.startswith(ticker, "GER40") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 128
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 678
        else if str.startswith(ticker, "GER40") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 608
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 273
        else if str.startswith(ticker, "GER40") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 246
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1090
        else if str.startswith(ticker, "GER40") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 1018
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 79
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 79
        else if str.startswith(ticker, "JP225") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 88
        else if str.startswith(ticker, "NI225") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 88
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 420
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 420
        else if str.startswith(ticker, "JP225") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 337
        else if str.startswith(ticker, "NI225") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 337
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 162
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 162
        else if str.startswith(ticker, "JP225") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 140
        else if str.startswith(ticker, "NI225") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 140
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 931
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 931
        else if str.startswith(ticker, "JP225") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 786
        else if str.startswith(ticker, "NI225") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 786
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 128
        else if str.startswith(ticker, "US100") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 93
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1201
        else if str.startswith(ticker, "US100") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 952
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "US100") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 307
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 876
        else if str.startswith(ticker, "US100") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 785
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 98
        else if str.startswith(ticker, "UK100") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 85
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 962
        else if str.startswith(ticker, "UK100") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 861
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 313
        else if str.startswith(ticker, "UK100") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 283
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1144
        else if str.startswith(ticker, "UK100") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 1057
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 122
        else if str.startswith(ticker, "US500") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1194
        else if str.startswith(ticker, "US500") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 974
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "US500") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 869
        else if str.startswith(ticker, "US500") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 774
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 109
        else if str.startswith(ticker, "USOIL") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 111
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1139
        else if str.startswith(ticker, "USOIL") and timeframe.period == "60" and dir == -1
            rate := 50
            n := 1054
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 362
        else if str.startswith(ticker, "USOIL") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 332
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == 1
            rate := 48
            n := 808
        else if str.startswith(ticker, "USOIL") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 847
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 139
        else if str.startswith(ticker, "DE40") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 128
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 678
        else if str.startswith(ticker, "DE40") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 608
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 273
        else if str.startswith(ticker, "DE40") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 246
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1090
        else if str.startswith(ticker, "DE40") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 1018
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 98
        else if str.startswith(ticker, "FTSE") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 85
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 962
        else if str.startswith(ticker, "FTSE") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 861
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 313
        else if str.startswith(ticker, "FTSE") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 283
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1144
        else if str.startswith(ticker, "FTSE") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 1057
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 114
        else if str.startswith(ticker, "US30") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == 1
            rate := 51
            n := 1174
        else if str.startswith(ticker, "US30") and timeframe.period == "60" and dir == -1
            rate := 49
            n := 1010
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 376
        else if str.startswith(ticker, "US30") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == 1
            rate := 50
            n := 854
        else if str.startswith(ticker, "US30") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 811
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 84
        else if str.startswith(ticker, "GOLD") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 96
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 2038
        else if str.startswith(ticker, "GOLD") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 2039
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 570
        else if str.startswith(ticker, "GOLD") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 570
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == 1
            rate := 47
            n := 789
        else if str.startswith(ticker, "GOLD") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 768
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 93
        else if str.startswith(ticker, "XJO") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 85
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == 1
            rate := 48
            n := 434
        else if str.startswith(ticker, "XJO") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 369
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == 1
            rate := 47
            n := 197
        else if str.startswith(ticker, "XJO") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 177
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1039
        else if str.startswith(ticker, "XJO") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 814
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 139
        else if str.startswith(ticker, "DAX") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 128
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 678
        else if str.startswith(ticker, "DAX") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 608
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 273
        else if str.startswith(ticker, "DAX") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 246
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1090
        else if str.startswith(ticker, "DAX") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 1018
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 79
        else if str.startswith(ticker, "NKY") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 88
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == 1
            rate := 49
            n := 420
        else if str.startswith(ticker, "NKY") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 337
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 162
        else if str.startswith(ticker, "NKY") and timeframe.period == "240" and dir == -1
            rate := 48
            n := 140
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 931
        else if str.startswith(ticker, "NKY") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 786
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 128
        else if str.startswith(ticker, "NDX") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 93
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1201
        else if str.startswith(ticker, "NDX") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 952
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "NDX") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 307
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 876
        else if str.startswith(ticker, "NDX") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 785
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 98
        else if str.startswith(ticker, "UKX") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 85
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 962
        else if str.startswith(ticker, "UKX") and timeframe.period == "60" and dir == -1
            rate := 47
            n := 861
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == 1
            rate := 48
            n := 313
        else if str.startswith(ticker, "UKX") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 283
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 1144
        else if str.startswith(ticker, "UKX") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 1057
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 114
        else if str.startswith(ticker, "DJI") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == 1
            rate := 51
            n := 1174
        else if str.startswith(ticker, "DJI") and timeframe.period == "60" and dir == -1
            rate := 49
            n := 1010
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 376
        else if str.startswith(ticker, "DJI") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == 1
            rate := 50
            n := 854
        else if str.startswith(ticker, "DJI") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 811
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 122
        else if str.startswith(ticker, "SPX") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1194
        else if str.startswith(ticker, "SPX") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 974
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "SPX") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 869
        else if str.startswith(ticker, "SPX") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 774
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 109
        else if str.startswith(ticker, "WTI") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 111
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1139
        else if str.startswith(ticker, "WTI") and timeframe.period == "60" and dir == -1
            rate := 50
            n := 1054
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 362
        else if str.startswith(ticker, "WTI") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 332
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == 1
            rate := 48
            n := 808
        else if str.startswith(ticker, "WTI") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 847
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 128
        else if str.startswith(ticker, "NQ") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 93
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1201
        else if str.startswith(ticker, "NQ") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 952
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "NQ") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 307
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 876
        else if str.startswith(ticker, "NQ") and timeframe.period == "15" and dir == -1
            rate := 48
            n := 785
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 114
        else if str.startswith(ticker, "YM") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == 1
            rate := 51
            n := 1174
        else if str.startswith(ticker, "YM") and timeframe.period == "60" and dir == -1
            rate := 49
            n := 1010
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == 1
            rate := 49
            n := 376
        else if str.startswith(ticker, "YM") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == 1
            rate := 50
            n := 854
        else if str.startswith(ticker, "YM") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 811
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == 1
            rate := 49
            n := 122
        else if str.startswith(ticker, "ES") and timeframe.period == "D" and dir == -1
            rate := 47
            n := 96
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1194
        else if str.startswith(ticker, "ES") and timeframe.period == "60" and dir == -1
            rate := 48
            n := 974
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 383
        else if str.startswith(ticker, "ES") and timeframe.period == "240" and dir == -1
            rate := 47
            n := 312
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == 1
            rate := 49
            n := 869
        else if str.startswith(ticker, "ES") and timeframe.period == "15" and dir == -1
            rate := 46
            n := 774
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == 1
            rate := 48
            n := 109
        else if str.startswith(ticker, "CL") and timeframe.period == "D" and dir == -1
            rate := 48
            n := 111
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == 1
            rate := 50
            n := 1139
        else if str.startswith(ticker, "CL") and timeframe.period == "60" and dir == -1
            rate := 50
            n := 1054
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == 1
            rate := 50
            n := 362
        else if str.startswith(ticker, "CL") and timeframe.period == "240" and dir == -1
            rate := 49
            n := 332
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == 1
            rate := 48
            n := 808
        else if str.startswith(ticker, "CL") and timeframe.period == "15" and dir == -1
            rate := 47
            n := 847
    [rate, n]
emaUse   = fltTrendTf == "" ? emaChart : emaHtf
var int sigLastBar = na
inSes  = not fltSes or not na(time(timeframe.period, fltSesion))
gapOk  = fltGap == 0 or na(sigLastBar) or bar_index - sigLastBar >= fltGap
atrOk  = not fltAtr or sigAtr >= fltAtrMin
// GII: Pine cannot read the GII API, so the user pastes the day's code:
//   G1|<as_of yyyy-mm-dd>|<score>|<zone -2..2>|<up %>|<down %>|<base up %>|<horizon sessions>|<check>
// check = sum over the characters before the last "|" of (position in "0123456789-.|G" + 1) x (index + 1), mod 9973.
// The check only catches typing errors; the Ed25519 signature of the API is NOT checked here.
// The data of date d is used from d + 1 day 01:00 UTC; bars before that, or older than giiMaxAge days, ignore GII.
giiCheck(string p) =>
    int giiAcc = 0
    for giiI = 0 to str.length(p) - 1
        int giiK = str.pos("0123456789-.|G", str.substring(p, giiI, giiI + 1))
        giiAcc := (giiAcc + (na(giiK) ? 99 : giiK + 1) * (giiI + 1)) % 9973
    giiAcc
giiGold = str.contains(str.upper(syminfo.ticker), "XAU") or str.contains(str.upper(syminfo.ticker), "GOLD")
giiClean = str.replace_all(giiCode, " ", "")
giiParts = str.split(giiClean, "|")
giiHave  = array.size(giiParts) == 9 and array.get(giiParts, 0) == "G1"
giiChk   = giiHave ? str.tonumber(array.get(giiParts, 8)) : na
giiValid = giiHave and str.length(array.get(giiParts, 1)) == 10 and not na(giiChk) and
           giiCheck(str.substring(giiClean, 0, str.length(giiClean) - str.length(array.get(giiParts, 8)) - 1)) == int(giiChk)
giiAsOf = giiValid ? timestamp("UTC", int(str.tonumber(str.substring(array.get(giiParts, 1), 0, 4))), int(str.tonumber(str.substring(array.get(giiParts, 1), 5, 7))), int(str.tonumber(str.substring(array.get(giiParts, 1), 8, 10))), 0, 0) : na
giiZone  = giiValid ? str.tonumber(array.get(giiParts, 3)) : na
giiUse   = giiValid and giiGold and time >= giiAsOf + 25 * 3600000 and time - giiAsOf <= giiMaxAge * 86400000
giiBuyOk  = not giiFilter or not giiUse or giiZone >= 1
giiSellOk = not giiFilter or not giiUse or giiZone <= -1
common = barstate.isconfirmed and inSes and gapOk and atrOk and not na(sigAtr)
buySig  = common and rawBuy and (not fltTrend or close > emaUse) and giiBuyOk
sellSig = common and rawSell and not buySig and (not fltTrend or close < emaUse) and giiSellOk
sigRisk = sigAtr * sigSlAtr
sigEntry = buySig or sellSig ? close : na
sigSL = buySig ? close - sigRisk : sellSig ? close + sigRisk : na
sigTP = buySig ? close + sigRisk * sigRR : sellSig ? close - sigRisk * sigRR : na

var float lastEntry = na
var float lastSL = na
var float lastTP = na
var int lastDir = 0
var string lastWhy = ""
var int lastTime = na
if buySig or sellSig
    sigLastBar := bar_index
    lastEntry := sigEntry
    lastSL := sigSL
    lastTP := sigTP
    lastDir := buySig ? 1 : -1
    lastWhy := buySig ? whyBuy : whySell
    lastTime := time
    if sigLabels
        [arrowRate, arrowN] = dnxArrowRate(lastDir, 0)
        string arrowText = lastWhy + (na(arrowRate) ? "" : "  " + (lastDir > 0 ? "Buy 1:1 " : "Sell 1:1 ") +
                           str.tostring(arrowRate, "#") + "%" + (DNX_ARROW_ALL ? " all mkts" : "") + " (n=" + str.tostring(arrowN) + ")")
        label.new(bar_index, buySig ? low - sigAtr * 0.9 : high + sigAtr * 0.9, arrowText, style = label.style_none,
                  textcolor = buySig ? color.lime : color.red, size = size.small, force_overlay = true)
    if sigLevels
        line.new(bar_index, sigEntry, bar_index + sigLvlLen, sigEntry, color = color.silver, force_overlay = true)
        line.new(bar_index, sigSL, bar_index + sigLvlLen, sigSL, color = color.red, style = line.style_dashed, force_overlay = true)
        line.new(bar_index, sigTP, bar_index + sigLvlLen, sigTP, color = color.lime, style = line.style_dashed, force_overlay = true)

plotshape(sigArrows and buySig, "Buy arrow", shape.triangleup, location.belowbar, color.lime, size = size.small, force_overlay = true)
plotshape(sigArrows and sellSig, "Sell arrow", shape.triangledown, location.abovebar, color.red, size = size.small, force_overlay = true)
// hidden values for strategies and webhooks (Data Window only)
plot(buySig ? 1 : 0, "Buy signal", display = display.data_window, editable = false)
plot(sellSig ? 1 : 0, "Sell signal", display = display.data_window, editable = false)
plot(sigSL, "Signal SL", display = display.data_window, editable = false)
plot(sigTP, "Signal TP", display = display.data_window, editable = false)
plot(sigEntry, "Signal entry", display = display.data_window, editable = false)
alertcondition(buySig, "DNX " + DNX_NAME + " Buy", "DNX " + DNX_NAME + " BUY {{ticker}} {{interval}} close {{close}}")
alertcondition(sellSig, "DNX " + DNX_NAME + " Sell", "DNX " + DNX_NAME + " SELL {{ticker}} {{interval}} close {{close}}")

pnlWhere = pnlPos == "top_left" ? position.top_left : pnlPos == "bottom_left" ? position.bottom_left :
           pnlPos == "bottom_right" ? position.bottom_right : position.top_right
var table pnl = table.new(pnlWhere, 1, 9, bgcolor = color.new(color.black, 20), border_width = 1, force_overlay = true)
if pnlShow and barstate.islast
    table.cell(pnl, 0, 0, "DinexSpace | " + DNX_NAME, text_color = color.white, text_size = size.small)
    if lastDir == 0
        table.cell(pnl, 0, 1,"No signal yet", text_color = color.silver, text_size = size.small)
    else
        table.cell(pnl, 0, 1, (lastDir > 0 ? ("BUY ▲ ") : ("SELL ▼ ")) + lastWhy,
                   text_color = lastDir > 0 ? color.lime : color.red, text_size = size.small)
        table.cell(pnl, 0, 2, ("Price ") + str.tostring(lastEntry, format.mintick) + "  SL " +
                   str.tostring(lastSL, format.mintick) + "  TP " + str.tostring(lastTP, format.mintick),
                   text_color = color.silver, text_size = size.small)
        table.cell(pnl, 0, 3, str.format_time(lastTime, "yyyy-MM-dd HH:mm", syminfo.timezone) + "  ·  " +
                   str.tostring(bar_index - sigLastBar) + (" bars ago"),
                   text_color = color.silver, text_size = size.small)
        [panelRate, panelN] = dnxArrowRate(lastDir, bar_index - sigLastBar)
        table.cell(pnl, 0, 4, na(panelRate) ? "" : "Win 1:1  " + str.tostring(panelRate, "#") + (DNX_ARROW_ALL ? "% all mkts" : "%") +
                   " (n=" + str.tostring(panelN) + ")", text_color = color.silver, text_size = size.small)
    if giiShow and giiGold
        if not giiValid
            table.cell(pnl, 0, 5, giiCode == "" ? "GII: no code entered (input GII code)" : "GII code invalid: check digits",
                       text_color = color.orange, text_size = size.small)
            table.cell(pnl, 0, 6, "Copy today's code from the DinexSpace GII page", text_color = color.gray, text_size = size.small)
        else
            bool giiStale = timenow - giiAsOf > giiMaxAge * 86400000
            float gUp = str.tonumber(array.get(giiParts, 4))
            float gDn = str.tonumber(array.get(giiParts, 5))
            table.cell(pnl, 0, 5, "Gold potential (" + array.get(giiParts, 7) + " D1 sessions): Up " + str.tostring(gUp, "#") +
                       "% / Down " + str.tostring(gDn, "#") + "%",
                       text_color = giiStale ? color.gray : gUp > gDn ? color.lime : gUp < gDn ? color.red : color.silver, text_size = size.small)
            table.cell(pnl, 0, 6, "Base rate up " + array.get(giiParts, 6) + "%  ·  GII score " + array.get(giiParts, 2) +
                       "  ·  zone " + array.get(giiParts, 3), text_color = color.silver, text_size = size.small)
            table.cell(pnl, 0, 7, "GII data " + array.get(giiParts, 1) + "  ·  pasted code, signature not checked  ·  " +
                       (giiStale ? "STALE: filter ignores GII" : "fresh"), text_color = giiStale ? color.orange : color.silver, text_size = size.small)
        table.cell(pnl, 0, 8, (giiFilter ? "GII filter ON" : "GII filter off") + "  ·  GII not validated, reference only",
                   text_color = color.gray, text_size = size.small)
// ---- end of DinexSpace signal layer ----

Câu hỏi về QQE

QQE miễn phí, chạy trên MT5 và TradingView và không đặt lệnh.

QQE có miễn phí không?

Có. QQE miễn phí, tải trực tiếp trên trang này, không cần đăng ký. Gói tải về có sẵn mã nguồn.

QQE chạy trên nền tảng nào?

QQE có bản cho MetaTrader 5 (MQL5) và TradingView (Pine Script v6).

QQE có cho tín hiệu Mua/Bán không?

QQE cho tín hiệu Mua khi chế độ mặc định "đổi pha": RSI làm mượt vượt lên dải trên, QQE chuyển sang pha tăng (nhãn "QQE phase up") và tín hiệu Bán khi RSI làm mượt thủng dải dưới, QQE chuyển sang pha giảm (nhãn "QQE phase down"). Chỉ báo không vẽ lại: tín hiệu chỉ được xác nhận khi nến đóng.

QQE có cảnh báo không?

Có. QQE có cảnh báo sẵn: MT5 – cửa sổ báo, thông báo đẩy, email, âm thanh; TradingView – điều kiện cảnh báo dùng trong Create Alert.

EA có đọc được QQE không?

Có. Bản MT5 của QQE đưa các đường vẽ ra buffer để EA đọc bằng iCustom và CopyBuffer: Smoothed RSI, Trailing line, Buy, Sell, Signal SL, Signal TP, Signal entry, Signal filter, Confluence score, Win rate %, Sample size, Bar buy odds %, Bar buy samples, Bar sell odds %, Bar sell samples, Lean, Bar buy score, Bar sell score.

QQE dùng trên khung thời gian nào?

QQE chạy trên mọi khung thời gian của biểu đồ. Phần tính toán đọc khung thời gian của biểu đồ hoặc một khung cố định (ví dụ D1 hay khung lớn hơn), như mô tả ở phần Chức năng.

QQE có tự đặt lệnh không?

Không. Đây là chỉ báo, chỉ đọc dữ liệu và hiển thị kết quả trên biểu đồ hoặc xuất ra tệp. Mã nguồn không có lệnh mở, đóng hay sửa lệnh.

Cài QQE thế nào?

Tải gói .zip rồi làm theo hướng dẫn cài đặt từng bước cho MT5 và TradingView: https://indicators.dinexspace.com/vi/huong-dan-cai-dat/

Tín hiệu của QQE có vẽ lại không?

Không. Tín hiệu chỉ xuất hiện khi nến đã đóng. Khi kiểm trên XAUUSD H1, 1.723/1.723 tín hiệu lúc chạy trùng với lúc tính lại toàn bộ lịch sử.

Tỷ lệ thắng kiểm thử

Đã đo

Ngoài mẫu khung H1: 2/21 mã trên mức hoà vốn sau chi phí.

Vuốt ngang để xem đủ các khung.

Ngoài mẫu: 2024-01-01 đến 2026-11-16
MãM15H1H4D1
AUDUSD43.7% (n=3791; hoà vốn 61.7%)46.8% (n=891; hoà vốn 55.4%)42.5% (n=252; hoà vốn 52.6%)46.7% (n=45; hoà vốn 51.1%)
AUS20045.4% (n=726; hoà vốn 64.6%)45.1% (n=213; hoà vốn 56.4%)47.8% (n=92; hoà vốn 54.0%)48.4% (n=31; hoà vốn 52.4%)
BNB–48.6% (n=1152; hoà vốn 57.8%)50.2% (n=294; hoà vốn 53.7%)55.6% (n=36; hoà vốn 51.3%)
BTCUSD47.6% (n=5159; hoà vốn 53.9%)51.9% (n=1209; hoà vốn 51.7%)52.8% (n=304; hoà vốn 50.8%)39.6% (n=48; hoà vốn 50.3%)
ETHUSD46.3% (n=5060; hoà vốn 57.7%)51.2% (n=1209; hoà vốn 53.4%)49.2% (n=308; hoà vốn 51.6%)51.3% (n=39; hoà vốn 50.6%)
EURUSD45.3% (n=3707; hoà vốn 58.3%)49.8% (n=913; hoà vốn 53.8%)49.8% (n=249; hoà vốn 51.8%)61.1% (n=37; hoà vốn 50.7%)
GBPUSD46.0% (n=3743; hoà vốn 58.7%)46.6% (n=936; hoà vốn 53.9%)47.8% (n=253; hoà vốn 51.9%)56.1% (n=41; hoà vốn 50.8%)
GER4048.2% (n=2691; hoà vốn 53.7%)53.3% (n=698; hoà vốn 51.7%)51.2% (n=201; hoà vốn 50.8%)61.3% (n=31; hoà vốn 50.3%)
JP22546.6% (n=3025; hoà vốn 57.5%)49.0% (n=768; hoà vốn 53.4%)52.3% (n=172; hoà vốn 51.6%)45.2% (n=42; hoà vốn 50.7%)
NAS10048.9% (n=3603; hoà vốn 52.0%)49.0% (n=875; hoà vốn 50.9%)53.5% (n=256; hoà vốn 50.4%)45.5% (n=44; hoà vốn 50.2%)
NZDUSD41.0% (n=3788; hoà vốn 66.0%)45.3% (n=912; hoà vốn 57.4%)46.1% (n=241; hoà vốn 53.5%)40.0% (n=45; hoà vốn 51.5%)
SOLUSD34.6% (n=5050; hoà vốn 84.1%)41.8% (n=1231; hoà vốn 65.7%)50.6% (n=310; hoà vốn 56.8%)62.5% (n=32; hoà vốn 51.9%)
UK10043.6% (n=2874; hoà vốn 62.5%)48.5% (n=711; hoà vốn 55.6%)47.7% (n=193; hoà vốn 52.8%)46.0% (n=37; hoà vốn 51.1%)
US3047.3% (n=3591; hoà vốn 52.9%)51.2% (n=883; hoà vốn 51.2%)51.3% (n=237; hoà vốn 50.6%)48.8% (n=43; hoà vốn 50.2%)
US50046.6% (n=3614; hoà vốn 55.5%)49.7% (n=875; hoà vốn 52.3%)50.4% (n=244; hoà vốn 51.0%)35.6% (n=45; hoà vốn 50.5%)
USDCAD43.3% (n=3770; hoà vốn 62.7%)46.5% (n=959; hoà vốn 55.8%)50.0% (n=240; hoà vốn 52.8%)46.7% (n=45; hoà vốn 51.2%)
USDCHF43.1% (n=3733; hoà vốn 63.7%)46.4% (n=895; hoà vốn 56.1%)52.1% (n=238; hoà vốn 52.9%)45.8% (n=48; hoà vốn 51.2%)
USDJPY45.7% (n=3711; hoà vốn 59.1%)49.6% (n=869; hoà vốn 54.1%)48.4% (n=244; hoà vốn 52.0%)53.3% (n=45; hoà vốn 50.8%)
WTI46.5% (n=3603; hoà vốn 56.6%)48.0% (n=887; hoà vốn 53.0%)47.8% (n=248; hoà vốn 51.5%)48.9% (n=45; hoà vốn 50.6%)
XAGUSD43.5% (n=3653; hoà vốn 58.2%)50.1% (n=872; hoà vốn 53.8%)48.7% (n=226; hoà vốn 51.8%)60.0% (n=40; hoà vốn 50.8%)
XAUUSD49.4% (n=3580; hoà vốn 51.9%)49.4% (n=249; hoà vốn 51.5%)đã đo đến 2024-10-1651.0% (n=243; hoà vốn 50.4%)50.0% (n=51; hoà vốn 50.2%)

Không có dữ liệu: HK50, KOSPI

Vuốt ngang để xem đủ các khung.

Trong mẫu: đến 2023-12-31
MãM15H1H4D1
AUDUSD45.5% (n=1376; hoà vốn 57.0%)49.2% (n=3990; hoà vốn 51.4%)51.9% (n=1116; hoà vốn 50.7%)44.9% (n=194; hoà vốn 50.3%)
AUS20047.4% (n=1853; hoà vốn 56.9%)46.3% (n=803; hoà vốn 51.9%)42.7% (n=375; hoà vốn 51.1%)44.6% (n=177; hoà vốn 50.6%)
BNB–47.7% (n=2581; hoà vốn 55.1%)51.6% (n=640; hoà vốn 52.5%)44.4% (n=90; hoà vốn 51.0%)
BTCUSD56.6% (n=53; hoà vốn 50.9%)47.8% (n=615; hoà vốn 51.1%)49.3% (n=152; hoà vốn 50.5%)–
ETHUSD46.3% (n=54; hoà vốn 61.6%)51.5% (n=621; hoà vốn 52.5%)48.7% (n=152; hoà vốn 51.1%)–
EURUSD41.7% (n=1411; hoà vốn 58.6%)48.3% (n=4022; hoà vốn 51.6%)48.7% (n=1095; hoà vốn 50.8%)46.7% (n=199; hoà vốn 50.2%)
GBPUSD44.9% (n=1355; hoà vốn 54.9%)49.2% (n=3952; hoà vốn 51.1%)49.2% (n=1117; hoà vốn 50.5%)54.9% (n=182; hoà vốn 50.2%)
GER4049.8% (n=2108; hoà vốn 51.5%)51.3% (n=1286; hoà vốn 50.3%)53.7% (n=521; hoà vốn 50.1%)51.9% (n=260; hoà vốn 50.0%)
JP22548.0% (n=1718; hoà vốn 53.1%)50.9% (n=758; hoà vốn 50.9%)53.3% (n=302; hoà vốn 50.2%)54.5% (n=165; hoà vốn 50.1%)
NAS10049.9% (n=1661; hoà vốn 52.2%)50.9% (n=2153; hoà vốn 50.2%)54.1% (n=690; hoà vốn 50.1%)52.0% (n=229; hoà vốn 50.0%)
NZDUSD40.8% (n=1396; hoà vốn 61.8%)47.5% (n=4030; hoà vốn 52.8%)49.5% (n=1120; hoà vốn 51.4%)49.2% (n=187; hoà vốn 50.6%)
SOLUSD56.0% (n=50; hoà vốn 50.0%)53.0% (n=623; hoà vốn 50.2%)53.3% (n=152; hoà vốn 50.1%)–
UK10047.8% (n=2202; hoà vốn 53.4%)49.6% (n=1823; hoà vốn 50.5%)46.5% (n=596; hoà vốn 50.2%)50.5% (n=182; hoà vốn 50.1%)
US3049.9% (n=1665; hoà vốn 52.5%)52.3% (n=2185; hoà vốn 50.2%)49.4% (n=689; hoà vốn 50.1%)48.1% (n=212; hoà vốn 50.0%)
US50047.8% (n=1643; hoà vốn 55.1%)50.4% (n=2169; hoà vốn 50.4%)49.9% (n=695; hoà vốn 50.1%)50.9% (n=230; hoà vốn 50.0%)
USDCAD44.0% (n=1451; hoà vốn 57.2%)48.9% (n=4013; hoà vốn 51.2%)45.5% (n=1087; hoà vốn 50.6%)45.2% (n=188; hoà vốn 50.3%)
USDCHF39.0% (n=1461; hoà vốn 62.8%)47.3% (n=3969; hoà vốn 51.9%)49.4% (n=1072; hoà vốn 50.9%)50.8% (n=183; hoà vốn 50.4%)
USDJPY47.9% (n=1368; hoà vốn 57.3%)49.3% (n=3889; hoà vốn 51.8%)51.7% (n=1047; hoà vốn 50.9%)45.2% (n=199; hoà vốn 50.4%)
WTI47.9% (n=1655; hoà vốn 54.0%)51.9% (n=2194; hoà vốn 50.3%)54.6% (n=694; hoà vốn 50.1%)47.6% (n=229; hoà vốn 50.0%)
XAGUSD43.0% (n=1562; hoà vốn 58.7%)43.0% (n=4090; hoà vốn 60.6%)47.7% (n=1110; hoà vốn 55.2%)51.0% (n=190; hoà vốn 52.4%)
XAUUSD47.2% (n=1559; hoà vốn 52.7%)49.2% (n=4077; hoà vốn 51.5%)49.4% (n=1140; hoà vốn 50.8%)49.2% (n=193; hoà vốn 50.4%)

Không có dữ liệu: HK50, KOSPI

Cũng đã đo: tỷ lệ thắng TP 1:2 và 1:3
Cũng đã đo: tỷ lệ thắng TP 1:2 và 1:3
Mẫu · mã · khung1:21:3
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUDUSD · M1527.6%20.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUDUSD · H131.5%22.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUDUSD · H426.2%21.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUDUSD · D126.7%20.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUS200 · M1534.9%28.0%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUS200 · H130.0%22.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUS200 · H434.8%25.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · AUS200 · D132.3%19.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BNB · H132.8%24.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BNB · H433.1%25.0%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BNB · D141.7%36.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BTCUSD · M1532.4%23.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BTCUSD · H135.8%25.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BTCUSD · H437.3%27.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · BTCUSD · D127.1%25.0%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · ETHUSD · M1531.4%23.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · ETHUSD · H134.3%25.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · ETHUSD · H431.9%24.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · ETHUSD · D133.3%26.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · EURUSD · M1529.7%22.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · EURUSD · H132.2%23.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · EURUSD · H434.5%27.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · EURUSD · D136.1%33.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GBPUSD · M1530.1%22.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GBPUSD · H130.5%24.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GBPUSD · H432.8%26.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GBPUSD · D134.2%21.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GER40 · M1532.5%24.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GER40 · H137.7%27.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GER40 · H431.5%21.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · GER40 · D138.7%32.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · JP225 · M1532.4%24.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · JP225 · H132.2%24.0%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · JP225 · H434.1%25.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · JP225 · D121.4%19.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NAS100 · M1533.5%26.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NAS100 · H133.8%25.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NAS100 · H434.9%25.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NAS100 · D127.3%20.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NZDUSD · M1526.8%19.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NZDUSD · H129.4%22.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NZDUSD · H432.4%21.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · NZDUSD · D126.7%18.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · SOLUSD · M1525.2%20.0%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · SOLUSD · H128.1%20.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · SOLUSD · H432.6%22.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · SOLUSD · D146.9%37.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · UK100 · M1528.0%20.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · UK100 · H132.5%25.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · UK100 · H434.4%24.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · UK100 · D127.8%17.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US30 · M1532.5%24.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US30 · H135.1%25.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US30 · H433.9%24.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US30 · D127.9%23.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US500 · M1531.3%24.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US500 · H132.5%25.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US500 · H431.7%22.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · US500 · D117.8%17.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCAD · M1528.9%21.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCAD · H130.4%22.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCAD · H433.8%22.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCAD · D134.1%31.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCHF · M1528.0%20.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCHF · H129.3%21.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCHF · H438.7%27.3%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDCHF · D125.5%25.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDJPY · M1531.8%23.6%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDJPY · H133.0%26.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDJPY · H435.2%25.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · USDJPY · D137.8%31.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · WTI · M1532.0%23.4%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · WTI · H132.6%24.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · WTI · H430.4%25.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · WTI · D128.9%20.9%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAGUSD · M1528.7%21.8%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAGUSD · H132.2%23.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAGUSD · H433.2%25.7%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAGUSD · D132.5%23.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAUUSD · M1533.0%25.1%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAUUSD · H133.7%22.5%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAUUSD · H435.4%29.2%
Ngoài mẫu: 2024-01-01 đến 2026-11-16 · XAUUSD · D132.0%28.0%
Trong mẫu: đến 2023-12-31 · AUDUSD · M1530.6%22.9%
Trong mẫu: đến 2023-12-31 · AUDUSD · H133.4%24.7%
Trong mẫu: đến 2023-12-31 · AUDUSD · H435.7%26.0%
Trong mẫu: đến 2023-12-31 · AUDUSD · D132.5%22.7%
Trong mẫu: đến 2023-12-31 · AUS200 · M1533.2%27.3%
Trong mẫu: đến 2023-12-31 · AUS200 · H130.4%23.4%
Trong mẫu: đến 2023-12-31 · AUS200 · H429.1%20.3%
Trong mẫu: đến 2023-12-31 · AUS200 · D131.6%23.2%
Trong mẫu: đến 2023-12-31 · BNB · H133.4%26.0%
Trong mẫu: đến 2023-12-31 · BNB · H437.2%29.8%
Trong mẫu: đến 2023-12-31 · BNB · D137.1%32.6%
Trong mẫu: đến 2023-12-31 · BTCUSD · M1537.7%23.1%
Trong mẫu: đến 2023-12-31 · BTCUSD · H131.3%23.6%
Trong mẫu: đến 2023-12-31 · BTCUSD · H430.9%22.5%
Trong mẫu: đến 2023-12-31 · ETHUSD · M1538.9%31.5%
Trong mẫu: đến 2023-12-31 · ETHUSD · H134.2%25.2%
Trong mẫu: đến 2023-12-31 · ETHUSD · H428.3%21.2%
Trong mẫu: đến 2023-12-31 · EURUSD · M1527.3%20.2%
Trong mẫu: đến 2023-12-31 · EURUSD · H132.7%25.0%
Trong mẫu: đến 2023-12-31 · EURUSD · H432.9%25.0%
Trong mẫu: đến 2023-12-31 · EURUSD · D130.6%23.1%
Trong mẫu: đến 2023-12-31 · GBPUSD · M1529.1%21.6%
Trong mẫu: đến 2023-12-31 · GBPUSD · H134.4%26.0%
Trong mẫu: đến 2023-12-31 · GBPUSD · H433.6%24.6%
Trong mẫu: đến 2023-12-31 · GBPUSD · D137.9%28.6%
Trong mẫu: đến 2023-12-31 · GER40 · M1534.3%25.5%
Trong mẫu: đến 2023-12-31 · GER40 · H135.2%26.0%
Trong mẫu: đến 2023-12-31 · GER40 · H438.2%26.5%
Trong mẫu: đến 2023-12-31 · GER40 · D135.8%25.4%
Trong mẫu: đến 2023-12-31 · JP225 · M1535.0%28.2%
Trong mẫu: đến 2023-12-31 · JP225 · H137.2%28.5%
Trong mẫu: đến 2023-12-31 · JP225 · H436.4%28.5%
Trong mẫu: đến 2023-12-31 · JP225 · D132.7%24.2%
Trong mẫu: đến 2023-12-31 · NAS100 · M1533.6%25.1%
Trong mẫu: đến 2023-12-31 · NAS100 · H134.1%26.8%
Trong mẫu: đến 2023-12-31 · NAS100 · H436.2%28.8%
Trong mẫu: đến 2023-12-31 · NAS100 · D133.2%26.6%
Trong mẫu: đến 2023-12-31 · NZDUSD · M1526.0%19.9%
Trong mẫu: đến 2023-12-31 · NZDUSD · H131.7%24.1%
Trong mẫu: đến 2023-12-31 · NZDUSD · H431.9%23.8%
Trong mẫu: đến 2023-12-31 · NZDUSD · D131.0%22.5%
Trong mẫu: đến 2023-12-31 · SOLUSD · M1540.0%30.0%
Trong mẫu: đến 2023-12-31 · SOLUSD · H136.0%28.1%
Trong mẫu: đến 2023-12-31 · SOLUSD · H432.2%26.3%
Trong mẫu: đến 2023-12-31 · UK100 · M1531.7%23.5%
Trong mẫu: đến 2023-12-31 · UK100 · H133.2%24.6%
Trong mẫu: đến 2023-12-31 · UK100 · H431.7%24.7%
Trong mẫu: đến 2023-12-31 · UK100 · D134.1%20.9%
Trong mẫu: đến 2023-12-31 · US30 · M1533.7%25.1%
Trong mẫu: đến 2023-12-31 · US30 · H134.7%25.9%
Trong mẫu: đến 2023-12-31 · US30 · H435.0%27.7%
Trong mẫu: đến 2023-12-31 · US30 · D131.6%25.5%
Trong mẫu: đến 2023-12-31 · US500 · M1531.9%23.8%
Trong mẫu: đến 2023-12-31 · US500 · H134.0%25.8%
Trong mẫu: đến 2023-12-31 · US500 · H433.6%26.4%
Trong mẫu: đến 2023-12-31 · US500 · D132.2%25.7%
Trong mẫu: đến 2023-12-31 · USDCAD · M1527.2%20.2%
Trong mẫu: đến 2023-12-31 · USDCAD · H132.7%24.7%
Trong mẫu: đến 2023-12-31 · USDCAD · H430.8%23.0%
Trong mẫu: đến 2023-12-31 · USDCAD · D131.9%22.9%
Trong mẫu: đến 2023-12-31 · USDCHF · M1525.7%19.1%
Trong mẫu: đến 2023-12-31 · USDCHF · H132.4%23.9%
Trong mẫu: đến 2023-12-31 · USDCHF · H432.9%24.5%
Trong mẫu: đến 2023-12-31 · USDCHF · D132.8%25.1%
Trong mẫu: đến 2023-12-31 · USDJPY · M1530.9%23.3%
Trong mẫu: đến 2023-12-31 · USDJPY · H134.3%26.2%
Trong mẫu: đến 2023-12-31 · USDJPY · H434.6%26.0%
Trong mẫu: đến 2023-12-31 · USDJPY · D130.3%21.2%
Trong mẫu: đến 2023-12-31 · WTI · M1532.3%24.2%
Trong mẫu: đến 2023-12-31 · WTI · H135.3%27.3%
Trong mẫu: đến 2023-12-31 · WTI · H438.0%29.4%
Trong mẫu: đến 2023-12-31 · WTI · D136.7%30.6%
Trong mẫu: đến 2023-12-31 · XAGUSD · M1528.6%21.0%
Trong mẫu: đến 2023-12-31 · XAGUSD · H128.6%22.0%
Trong mẫu: đến 2023-12-31 · XAGUSD · H431.2%24.8%
Trong mẫu: đến 2023-12-31 · XAGUSD · D137.4%26.3%
Trong mẫu: đến 2023-12-31 · XAUUSD · M1531.9%24.7%
Trong mẫu: đến 2023-12-31 · XAUUSD · H134.3%25.7%
Trong mẫu: đến 2023-12-31 · XAUUSD · H434.5%26.8%
Trong mẫu: đến 2023-12-31 · XAUUSD · D137.3%31.1%

Thế nào là thắng

  • W1: chạm chốt lời trước cắt lỗ. Cắt lỗ = 1,5 × ATR(14) Wilder của nến tín hiệu; chốt lời hiển thị = 1 × cắt lỗ (1:1). Vào lệnh tại giá đóng nến tín hiệu. Lệnh mua trả spread khi vào, lệnh bán trả spread khi thoát. Nếu cắt lỗ và chốt lời cùng xảy ra trong một nến M15, tính là thua. Không có kết quả trong 200 nến thì không tính.
  • W2 đo hướng giá sau 5, 10 và 20 nến.
  • Đầu vào mặc định yêu cầu hội tụ ≥ 4/7.
  • Trong mẫu: từ nến đầu đến 2023-12-31; ngoài mẫu: 2024-01-01 đến 2026-11-16.
  • Chi phí: Spread thực tế của tài khoản MT5 dạng ECN, commission 0.
  • Nguồn dữ liệu: Tick data MT5 (BNB: Binance spot).
  • Ô có ít hơn 30 tín hiệu hiển thị –.

Nến H4/D1 của TradingView có thể chia theo múi giờ của sàn trên TradingView, khác giờ máy chủ MT5 (UTC) dùng khi đo; phiên và xu hướng H4 trên bản Pine có thể lệch. Chưa kiểm cùng tín hiệu trên TradingView.

Mũi tên hiển thị tỷ lệ đã đo theo từng thị trường.

Nâng cấp so với bản gốc

  • MT5 không có QQE trong bộ chỉ báo chuẩn. Các bản QQE trên TradingView không ghi xác suất thắng đã đo cho từng tín hiệu.
  • Mỗi mũi tên ghi tỷ lệ thắng đã đo, ví dụ "Buy 1:1 49% (n=2038)" cho XAUUSD H1 lệnh Mua. Đo trên 20 mã MT5 + BNB, khung M15–D1, tách trong mẫu / ngoài mẫu.
  • Tín hiệu chỉ trên nến đã đóng, đã kiểm không vẽ lại trong tester; điểm hợp lưu 7 yếu tố, mặc định chỉ hiện tín hiệu ≥ 4/7.
  • Gợi ý SL/TP theo ATR, % theo từng nến (bar odds), buffer chuẩn cho EA, cảnh báo một lần mỗi nến đóng.
  • Với vàng: panel GII và bộ lọc cùng chiều GII (tắt mặc định vì GII chưa kiểm chứng).

Thống kê kiểm thử quá khứ không bảo đảm kết quả tương lai.

Chỉ báo cùng danh mục

Tất cả chỉ báo Động lượng

Chande Momentum

Động lượng · Chỉ báo

Bộ dao động động lượng Chande, có thể kèm đường trung bình. Dùng khi cần thước đo động lượng có biên trên dưới rõ ràng.

Miễn phíMT5Đã đo

Connors RSI

Động lượng · Chỉ báo

Trung bình của ba thành phần RSI, chuỗi tăng giảm và thứ hạng thay đổi. Dùng cho kiểu giao dịch hồi về ngắn hạn.

Miễn phíMT5Đã đo

Coppock Curve

Động lượng · Chỉ báo

Histogram màu từ tốc độ thay đổi giá dài và ngắn. Dùng để đọc động lượng dài hạn qua dấu và độ dốc.

Miễn phíMT5Đã đo

Currency Strength Meter

Động lượng · Chỉ báo

Đo sức mạnh tương đối của các đồng tiền chính. Dùng để chọn cặp ghép đồng đang mạnh với đồng đang yếu.

Miễn phíMT5TradingViewĐã đo