tlpc = input.string(title="Alert", defval="PineConnector", options=["PineConnector", "Telegram"], tooltip="Go to alertatron to have alerts automatically sent to Telegram")
// Setting
ID = input("1234567890123", title="License ID (PineConnector)", group="Setting") risk = input.float(2, title="Risk per Trade %", group="Setting", step=0.5) typeSL = input.string(title="StopLoss", defval="ATR", options=["Swing", "ATR"], group="Setting") typeTP = input.string(title="TakeProfit", defval="R:R", options=["R:R", "Multiple Target"], group="Setting") trendA = input.string(title="Trend Indicator", defval="EMA", options=["EMA", "Superichi"], group="Setting") _x = input.bool(false, title="do not take too small positions", group="Setting", tooltip="This parameter is used to avoid positions that have a stoploss too close to the entry point and that the broker's spreads take all the gains") security = input.float(10, title="min of pips (00001.00)", group="Setting")
riskt = risk / 100 + 1
//Backtest Time Period
useDateFilter = input.bool(false, title="Filter Date Range of Backtest", group="Backtest Time Period") backtestStartDate = input.time(timestamp("1 June 2022"), title="Start Date", group="Backtest Time Period", tooltip="This start date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.") backtestEndDate = input.time(timestamp("1 July 2022"), title="End Date", group="Backtest Time Period", tooltip="This end date is in the time zone of the exchange " + "where the chart's instrument trades. It doesn't use the time " + "zone of the chart or of your computer.")
inTradeWindow = not useDateFilter or (time >= backtestStartDate and time < backtestEndDate)
//StopLoss
swingHighV = input.int(7, title="Swing High", group="Stop Loss", tooltip="Number of candles in which the parameter targets the highest") swingLowV = input.int(7, title="Swing Low", group="Stop Loss", tooltip="Number of candles in which the parameter targets the lowest point")
if nextTrend == 1 maxLowPrice := math.max(lowPrice, maxLowPrice)
if highma < maxLowPrice and close < nz(low[1], low) trend := 1 nextTrend := 0 minHighPrice := highPrice minHighPrice else minHighPrice := math.min(highPrice, minHighPrice)
if lowma > minHighPrice and close > nz(high[1], high) trend := 0 nextTrend := 1 maxLowPrice := lowPrice maxLowPrice
if trend == 0 if not na(trend[1]) and trend[1] != 0 up := na(down[1]) ? down : down[1] arrowUp := up - atr2 arrowUp else up := na(up[1]) ? maxLowPrice : math.max(maxLowPrice, up[1]) up atrHigh := up + dev atrLow := up - dev atrLow else if not na(trend[1]) and trend[1] != 1 down := na(up[1]) ? up : up[1] arrowDown := down + atr2 arrowDown else down := na(down[1]) ? minHighPrice : math.min(minHighPrice, down[1]) down atrHigh := down + dev atrLow := down - dev atrLow
ht = trend == 0 ? up : down
var color buyColor = color.blue var color sellColor = color.orange
float risk_long = na float risk_short = na float stopLoss = na float takeProfit1 = na float takeProfit2 = na float entry_price = na bool longcondition = na bool shortcondition = na
if trendA == "Superichi" longcondition := buySignal and close > senkouA[26] and senkouA[26] > senkouB[26] shortcondition := sellSignal and close < senkouA[26] and senkouA[26] < senkouB[26] if trendA == "EMA" longcondition := buySignal and close > ema shortcondition := sellSignal and close < ema