//@version=5 strategy(title = "Hireandy EA1#", shorttitle = "HEA1808##chatgptfusion", initial_capital=10000, default_qty_type = strategy.percent_of_equity, overlay=true, calc_on_order_fills=true) //MA // Define fast and slow moving averages fast_length = input(9, title="Fast MA Length") slow_length = input(21, title="Slow MA Length") fast_ma = ta.sma(close, fast_length) slow_ma = ta.sma(close, slow_length) // Indicators RVGI len = input.float(5,"Length", minval=1) rvi = (ta.swma(close-open))/(ta.swma(high-low)) sig = ta.swma(rvi) plot(rvi, color=#008000, title="RVGI", linewidth = 2) plot(sig, color=#FF0000, title="Signal", linewidth = 2) crossunderBear = ta.crossunder(rvi, sig) and rvi < sig ? math.avg(rvi, sig) : na crossoverBull = ta.crossover(rvi, sig) and rvi > sig ? math.avg(rvi, sig) : na tf1h = input.timeframe("60") tf3h = input.timeframe("180") tf4h = input.timeframe("240") S1hrvgi=request.security(syminfo.tickerid,tf1h,crossunderBear) S1hrvgi_=request.security(syminfo.tickerid,tf1h,crossoverBull) S3hrvgi=request.security(syminfo.tickerid,tf3h,crossunderBear) S3hrvgi_=request.security(syminfo.tickerid,tf3h,crossoverBull) S4hrvgi=request.security(syminfo.tickerid,tf4h,crossunderBear) S4hrvgi_=request.security(syminfo.tickerid,tf4h,crossoverBull) alertcondition(crossunderBear, "Signal", "RVGI Bearish Trend") alertcondition(crossoverBull, "RVGI", "RVGI Bullish Trend") // Indicators WWV method = input(defval="ATR", title="Renko Assignment Method") methodvalue = input.float(5.0, "Value", minval=0.0) pricesource = input(defval="Close", title="Price Source") useClose = pricesource == "Close" useOpenClose = pricesource == "Open / Close" or useClose useTrueRange = input(defval="Auto", title="Use True Range instead of Volume") isOscillating = input(defval=false, title="Oscillating") vol = useTrueRange == "Always" or useTrueRange == "Auto" and na(volume) ? ta.tr : volume op = useClose ? close : open hi = useOpenClose ? close >= op ? close : op : high lo = useOpenClose ? close <= op ? close : op : low currclose = float(na) prevclose = nz(currclose,1) prevhigh = prevclose + methodvalue prevlow = prevclose - methodvalue currclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclose direction = int(na) direction := currclose > prevclose ? 1 : currclose < prevclose ? -1: nz(direction,1) directionHasChanged = ta.change(direction) != 0 directionIsUp = direction > 0 directionIsDown = direction < 0 tf2hwwv = input.timeframe("120") tf4hwwv = input.timeframe("240") tf1Dwwv = input.timeframe("1D") S2hwwv=request.security(syminfo.tickerid,tf2hwwv,directionIsDown) S2hwwv_=request.security(syminfo.tickerid,tf2hwwv,directionIsUp) S4hwwv=request.security(syminfo.tickerid,tf4hwwv,directionIsDown) S4hwwv_=request.security(syminfo.tickerid,tf4hwwv,directionIsUp) S1Dwwv=request.security(syminfo.tickerid,tf1Dwwv,directionIsDown) S1Dwwv_=request.security(syminfo.tickerid,tf1Dwwv,directionIsUp) // Indicators KDJ ilong = input(9, title="period") isig = input(3, title="signal") bcwsma(src, length, weight) => sum = 0.0 norm = 0.0 for i = 0 to length - 1 weightIndex = length - i sum := sum + src[i] * weightIndex * weight norm := norm + weightIndex * weight bcwsmaValue = sum / norm bcwsmaValue c = close h = ta.highest(high, ilong) l = ta.lowest(low,ilong) RSV = 100*((c-l)/(h-l)) pK = bcwsma(RSV, isig, 1) pD = bcwsma(pK, isig, 1) pJ = 30 crossunderBear1 = ta.crossunder(pJ, pK) and pJ < pK ? math.avg(pJ, pK) : na crossoverBull2 = ta.crossover(pJ, pK) and pJ > pK ? math.avg(pJ, pK) : na tf1hkdj = input.timeframe("60") tf3hkdj = input.timeframe("180") tf4hkdj = input.timeframe("240") tf1Dkdj = input.timeframe("1D") S1hkdj=request.security(syminfo.tickerid,tf1hkdj,crossunderBear1) S1hkdj_=request.security(syminfo.tickerid,tf1hkdj,crossoverBull2) S1hkdjpj=request.security(syminfo.tickerid,tf1hkdj,pJ) S1hkdjpj_=request.security(syminfo.tickerid,tf1hkdj,pJ) S3hkdj=request.security(syminfo.tickerid,tf3hkdj,crossunderBear1) S3hkdj_=request.security(syminfo.tickerid,tf3hkdj,crossoverBull2) S4hkdj=request.security(syminfo.tickerid,tf4hkdj,crossunderBear1) S4hkdj_=request.security(syminfo.tickerid,tf4hkdj,crossoverBull2) S1Dkdj=request.security(syminfo.tickerid,tf1Dkdj,crossunderBear1) S1Dkdj_=request.security(syminfo.tickerid,tf1Dkdj,crossoverBull2) alertcondition(crossunderBear1, "pK", "Bearish Trend") alertcondition(crossoverBull2, "pJ", "Bullish Trend") // Indicators WPR length = input(title="Length", defval=250) src = input(close, "Source") _pr(length) => max = ta.highest(length) min = ta.lowest(length) 100 * (src - max) / (max - min) percentR = 4.5 obPlot = hline(-20, title="Upper Band", color=#787B86) osPlot = hline(-80, title="Lower Band", color=#787B86) fill(obPlot, osPlot, title="Background", color=#787B89) plot(percentR, title="%R", color=#7E57C2) tf4hwpr = input.timeframe("240") tf1Dwpr = input.timeframe("1D") S4hwpr=request.security(syminfo.tickerid,tf4hwpr,percentR) S4hwpr_=request.security(syminfo.tickerid,tf4hwpr,-percentR) S1Dwpr=request.security(syminfo.tickerid,tf1Dwpr,percentR) S1Dwpr_=request.security(syminfo.tickerid,tf1Dwpr,-percentR) // SL & TP SL = 0.5 TP = 0.0190 longstop = strategy.position_avg_price * (1 - SL) longprofit = strategy.position_avg_price * (1 + TP) shortstop = strategy.position_avg_price * (1 + SL) shortprofit = strategy.position_avg_price * (1 - TP) // Entry conditions1 longCondition = S1Dwwv and (S4hrvgi or S3hrvgi) and (S4hkdj or S3hkdj) and (S4hwwv or S3hwwv or S2hwwv) and S1Dwpr and S4hwpr and S1hkdj if (longCondition) strategy.entry("Long", strategy.long) strategy.exit(id="Close", stop=longstop, limit=longprofit) // Entry conditions2 shortCondition = S1Dwwv_ and (S4hrvgi_ or S3hrvgi_) and (S4hkdj_ or S3hkdj_) and (S4hwwv_ or S3hwwv_ or S2hwwv_) and S1Dwpr_ and S4hwpr_ and S1hkdj_ if (shortCondition) strategy.entry("Short", strategy.short) strategy.exit(id="Close", stop=shortstop, limit=shortprofit) if strategy.position_avg_price < 0 strategy.exit(id="Close", stop=longstop, limit=longprofit) if strategy.position_avg_price > 0 strategy.exit(id="Close", stop=shortstop, limit=shortprofit)