QQE

QQE is a free indicator by DinexSpace for MT5 and TradingView. A smoothed RSI with a trailing line driven by its own volatility. The signal version (v2) adds buy/sell arrows on closed bars with suggested SL and TP levels.

What QQE does

QQE is a free indicator by DinexSpace for MT5 and TradingView. A smoothed RSI with a trailing line driven by its own volatility. The signal version (v2) adds buy/sell arrows on closed bars with suggested SL and TP levels.

Enable JavaScript to see the chart.

Chart powered by TradingView Lightweight Charts™ (Apache-2.0 license). tradingview.com

The candles, indicator lines and arrows above come straight from the MT5 version running in the Strategy Tester; nothing is recalculated in the browser. Press ▶ to replay bar by bar and hover an arrow to see the reason, entry, SL and TP.

Video walkthrough

QQE: RSI(14) smoothed with EMA(5), plus a trailing line built from a Wilder average of the RSI changes × 4.236. Plotted in a separate window; arrows appear both in the QQE window and on the price chart.

When to use it

Use it to filter out noisy RSI level crosses.

Features and modes

QQE: RSI(14) smoothed with EMA(5) plus a trailing line built from a Wilder average of the RSI change × 4.236. Plotted in a separate window; arrows appear in both the QQE window and the price chart.

Parameters

QQE has 51 inputs in the MT5 version and 25 in the TradingView version; every input and its default is listed below.

QQE inputs
GroupInputDefaultMeaning
QQEInpRSIPeriod14RSI period
QQEInpSmooth5EMA smoothing of the RSI
QQEInpFactor4.236Band factor
QQEInpModeQQE_PHASESignal type: 0 = phase change, 1 = cross 50
SignalsInpSigArrowstrueDraw buy/sell arrows (closed bars only)
SignalsInpSigLabelstrueShort reason label next to each arrow
SignalsInpSigLevelsfalseDraw entry / SL / TP lines for each signal
SignalsInpSigSLATR1.5Suggested SL = ATR × this value
SignalsInpSigRR2.0Suggested TP = SL distance × this value (reward:risk)
SignalsInpSigATRLen14ATR period (used for SL/TP and the volatility filter)
SignalsInpSigLevelBars10Length of the entry/SL/TP lines, in bars
SignalsInpSigObjBars1500Labels and lines only for signals in the last N bars
Confluence (score x/7, a signal shows when score >= minimum)InpConfMin4Minimum confluence score 0–7 for a signal to show (0 = every raw signal)
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFtrueFactor 1, trend: close above (buy) / below (sell) the EMA of the trend timeframe
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFTFPERIOD_H4Trend timeframe (closed bars only)
Confluence (score x/7, a signal shows when score >= minimum)InpCfMTFLen200Trend EMA period
Confluence (score x/7, a signal shows when score >= minimum)InpCfMomtrueFactor 2, momentum: RSI(14) above 50 (buy) / below 50 (sell)
Confluence (score x/7, a signal shows when score >= minimum)InpCfVolattrueFactor 3, volatility: ATR percentile over 100 bars between 20 and 90
Confluence (score x/7, a signal shows when score >= minimum)InpCfRVoltrueFactor 4, volume: tick volume at or above its same-hour average of 20 days
Confluence (score x/7, a signal shows when score >= minimum)InpCfSessiontrueFactor 5, session: signal bar inside the session hours (server time)
Confluence (score x/7, a signal shows when score >= minimum)InpCfHourFrom7Session start hour (0–23)
Confluence (score x/7, a signal shows when score >= minimum)InpCfHourTo21Session end hour (0–23, exclusive; may wrap past midnight)
Confluence (score x/7, a signal shows when score >= minimum)InpCfNewstrueFactor 6, news: no high-impact MT5 calendar event around the signal bar
Confluence (score x/7, a signal shows when score >= minimum)InpCfNewsMin30News window, minutes before and after
Confluence (score x/7, a signal shows when score >= minimum)InpCfSpreadtrueFactor 7, spread: spread at most 1.5 × the 100-bar median
Confluence (score x/7, a signal shows when score >= minimum)InpFltGapBars0Minimum bars between two signals (0 = off)
Win rate (history of the signal's group)InpMinWin51Highlight signals whose group win rate is at least this %
Win rate (history of the signal's group)InpHideWeakfalseHide signals below that rate (off = drawn faint)
Win rate (history of the signal's group)InpShowBEfalsePanel: show the break-even win rate of the R:R in use
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbModeDNX_ODDS_BOTHBar odds: both sides / stronger side only / off
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbBars150Bars with odds (0 = all bars, slower)
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbSLATR1.5Bar odds: SL = TP distance = ATR × this
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbRR1.0Bar odds: TP distance = SL distance × this
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD1-5Colour: red below break-even + this (points of %)
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD20Colour: orange below break-even + this
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD35Colour: yellow below break-even + this
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbD410Colour: green below break-even + this, the chart's up-candle colour above
Bar odds (every closed bar as a hypothetical trade, design-period history)InpPbFont7Bar odds font size
Alerts (once per closed signal bar)InpAlPopupfalsePopup alert
Alerts (once per closed signal bar)InpAlPushfalsePush notification to your phone (Tools → Options → Notifications)
Alerts (once per closed signal bar)InpAlMailfalseEmail (Tools → Options → Email)
Alerts (once per closed signal bar)InpAlSoundfalseSound
Alerts (once per closed signal bar)InpAlSoundFile"alert.wav"Sound file (MT5 Sounds folder)
PanelInpPaneltrueShow the last-signal panel
PanelInpPanelCornerCORNER_LEFT_UPPERPanel corner
PanelInpPanelX10Panel horizontal offset, px
PanelInpPanelY25Panel vertical offset, px
PanelInpPanelFont9Panel font size

Signals

QQE gives a Buy signal when in the default "phase change" mode, the smoothed RSI breaks above the upper band and QQE turns to its rising phase (label "QQE phase up") and a Sell signal when the smoothed RSI breaks below the lower band and QQE turns to its falling phase (label "QQE phase down"). It does not repaint: signals are confirmed only on bar close.

  • Buy ▲: default "phase change" mode: the smoothed RSI breaks above the upper band and QQE turns to its rising phase (label "QQE phase up").
  • Sell ▼: the smoothed RSI breaks below the lower band and QQE turns to its falling phase (label "QQE phase down").
  • "Cross 50" mode (InpMode = 1): buy when the smoothed RSI crosses above 50 ("QQE crossed above 50"), sell when it crosses below 50 ("QQE crossed below 50").
  • Only on a closed bar. The bar that is still forming never carries an arrow, so a signal, once drawn, does not move or disappear (no repainting).
  • The arrow sits on the signal bar. If you act on it, the entry is the open of the next bar.
  • Each arrow has a short reason label. Optional lines show the entry (close of the signal bar), a suggested SL (ATR(14) × 1.5) and a suggested TP (2R).
  • Confluence: every signal gets a 0–7 score (higher-timeframe trend, momentum, volatility, volume, session, news, spread); by default only signals scoring 4/7 or more are shown (MT5 version).
  • Bar odds (MT5 version): ▲ buy % under and ▼ sell % over each bar, every bar treated as a hypothetical 1:1 trade, coloured against the real break-even (spread included); numbers exist only for XAUUSD H1 at default inputs, elsewhere "–".
  • MT5 alerts (popup, push, email, sound; each one switchable) fire once per signal bar. The Pine version has an alertcondition for Buy and one for Sell.
  • A small corner panel shows the last signal, its price, SL, TP, time and how many bars ago it fired.

Suggested SL = ATR(14) × 1.5; suggested TP = 2 × the SL distance (1:2 risk-reward). The trend, volatility, session and signal-spacing filters are all off by default.

Chart labels and the info panel default to Vietnamese; set InpSigLang to English in the inputs.

Alerts

Yes. QQE has built-in alerts: MT5 – pop-up, push notification, email, sound; TradingView – alert conditions for Create Alert.

Buffers for Expert Advisors

Yes. The MT5 version of QQE exposes its plots as indicator buffers that an EA can read with iCustom and 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 – Buffers for Expert Advisors
BufferContent
0Buy: anything other than EMPTY_VALUE means a buy signal on that bar (the value is where the arrow is drawn)
1Sell: anything other than EMPTY_VALUE means a sell signal on that bar
2Suggested SL (price)
3Suggested TP (price)
4Entry: close of the signal bar
5Filter: 1 = do not trade / stop trading, 0 = allowed
6Confluence score 0–7 on the signal bar
7Win rate % of the signal's group (design period)
8Sample size of that group (EMPTY under 30)
9 / 11Buy % / sell % of the bar (hypothetical 1:1 trade)
10 / 12Samples behind the buy % / sell %
13Lean: +1 / −1 = side of the latest raw signal
14 / 15Confluence score of the buy / sell side on that bar
16Smoothed RSI
17Trailing line

Read shift 1 (the bar that just closed) when a new bar opens. Every input group takes one parameter slot in iCustom; calling it with no parameters uses the defaults.

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) { /* buy, SL = sl[0], TP = tp[0] */ }

Pine: hidden plots Buy signal, Sell signal (1/0), Signal SL, Signal TP, Signal entry (Data Window), for strategies or webhooks.

Timeframes and markets

QQE runs on any chart timeframe. Its calculation reads the chart timeframe or a fixed timeframe (for example D1 or a higher timeframe), as described under Features.

Limitations

QQE is an analysis tool, not a trading system. Its documented limitations are listed below.

  • SL/TP are ATR-based suggestions only; they ignore spread, fees, slippage and news.

Technical signals, not pre-registered/validated; not investment advice.

Pine Script code

Paste the whole script into the Pine Editor on TradingView.

DinexQQESig.pine · 16,970 lines
//@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 ----

QQE FAQ

QQE is free, runs on MT5 and TradingView and does not place trades.

Is QQE free?

Yes. QQE is free to download from this page with no sign-up, and the download includes the full source code.

Which platforms does QQE run on?

QQE is available for MetaTrader 5 (MQL5) and TradingView (Pine Script v6).

Does QQE give buy and sell signals?

QQE gives a Buy signal when in the default "phase change" mode, the smoothed RSI breaks above the upper band and QQE turns to its rising phase (label "QQE phase up") and a Sell signal when the smoothed RSI breaks below the lower band and QQE turns to its falling phase (label "QQE phase down"). It does not repaint: signals are confirmed only on bar close.

Does QQE have alerts?

Yes. QQE has built-in alerts: MT5 – pop-up, push notification, email, sound; TradingView – alert conditions for Create Alert.

Can an EA read QQE?

Yes. The MT5 version of QQE exposes its plots as indicator buffers that an EA can read with iCustom and 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.

Which timeframes does QQE work on?

QQE runs on any chart timeframe. Its calculation reads the chart timeframe or a fixed timeframe (for example D1 or a higher timeframe), as described under Features.

Does QQE place trades?

No. It is a read-only indicator: it only reads market data and shows the result on the chart or writes it to a file. The source contains no calls that open, close or modify orders.

How do I install QQE?

Download the .zip and follow the step-by-step installation guide for MT5 and TradingView: https://indicators.dinexspace.com/install-guide/

Does QQE repaint its signals?

No. Signals only print on closed bars. In the XAUUSD H1 check, 1,723/1,723 live signals matched a full recalculation of the history.

Measured win rates (backtest)

Measured

Out of sample on H1: 2 of 21 symbols above break-even after costs.

Swipe sideways to see every timeframe.

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

No data: HK50, KOSPI

Swipe sideways to see every timeframe.

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

No data: HK50, KOSPI

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

What counts as a win

  • W1: take profit before stop loss. Stop loss = 1.5 × ATR(14) Wilder of the signal bar; shown take profit = 1 × stop loss (1:1). Entry is at the signal bar close. Buy pays the spread at entry; sell pays it at exit. If stop loss and take profit occur in the same M15 bar, count a loss. No result within 200 bars is not counted.
  • W2 direction after 5, 10 and 20 bars is measured too.
  • Default inputs require confluence ≥ 4/7.
  • In sample: first bar to 2023-12-31; out of sample: 2024-01-01 to 2026-11-16.
  • Costs: Real spread of an ECN-type MT5 account, no commission.
  • Data source: MT5 tick data (BNB: Binance spot).
  • Cells with fewer than 30 signals show –.

TradingView H4/D1 bars may follow the exchange time zone of the TradingView symbol, not the MT5 server time (UTC) used for the measurement; sessions and the H4 trend may differ on the Pine version. Same signals on TradingView not checked yet.

Arrows show measured rates for each market.

What this version adds

  • Standard QQE versions on MT5 or TradingView do not show a measured win rate for their signals.
  • Every arrow shows its measured win rate, e.g. "Buy 1:1 49% (n=2038)" on XAUUSD H1 buys. Measured on 20 MT5 symbols + BNB, M15 to D1, in and out of sample.
  • Signals on closed bars only; 7-factor confluence score, by default only signals scoring 4/7 or more.
  • ATR-based SL/TP suggestions, per-bar odds, standard buffers for EAs, one alert per closed bar.
  • On gold: GII panel and an optional GII side filter (off by default: GII is not validated yet).

Past test statistics are not a promise of future results.

More in this category

All Momentum indicators

Chande Momentum

Momentum · Indicator

The Chande Momentum Oscillator with an optional moving average. Use it when you want a momentum gauge with clear upper and lower bounds.

FreeMT5Measured

Connors RSI

Momentum · Indicator

The average of three parts: RSI, up/down streak length and percent rank of the change. Use it for short-term mean-reversion trading.

FreeMT5Measured

Coppock Curve

Momentum · Indicator

A coloured histogram built from long and short rates of change. Use it to read long-term momentum from its sign and slope.

FreeMT5Measured