//@version=4 //This strategy is developed for heikin ashi charting //This strategy is loaded with APIBRIDGE supported alert configuration strategy("Heikin Ashi Strategy on normal candles", shorttitle="HA Strategy", overlay=true) //havalues haopen=0.0 haclose=0.0 hahigh=0.0 halow=0.0 haclose := (open + high + low + close) / 4 haopen := na(haopen[1]) ? (open + close) / 2 : (haopen[1] + haclose[1]) / 2 hahigh := max(high, max(haopen, haclose)) halow := min(low, min(haopen, haclose)) //INPUTS // Medium Fast MA - type, source, length ma_type = input(defval="EMA", title="MA Type: ", options=["SMA", "EMA"]) ma_len = input(defval=6, title="MA - Length", minval=1) ma_src = haclose id = input(false,title="TRADE ONLY INTRADAY") s=input(title="INTRA DAY TRADE SESSION",type=input.session,defval="0915-1450") st=time(timeframe.period,s) e=input(title="END SESSION",type=input.session,defval="1515-1520") et=time(timeframe.period,e) ut=input(defval=false,title="USE TARGET") us=input(defval=false,title="USE STOPLOSS") tar=input(defval=10.0,title="TARGET IN RS") stop=input(defval=7.0,title="STOP LOSS IN RS") tar:=tar/syminfo.mintick stop:=stop/syminfo.mintick quant=input(title="Trade Quantity",defval=1) lxse="TYPE: LX" + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) + " :TYPE:SE " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) sxle="TYPE: SX" + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) + " :TYPE:LE " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) le="TYPE:LE " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) lx="TYPE:LX " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) se="TYPE:SE " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) sx="TYPE:SX " + " :SYMBOL: " + syminfo.ticker + " :QTY: " + tostring(quant) // === FUNCTIONS variant(type, src, len) => type=="SMA" ? sma(src,len):ema(src,len) // === Moving Average ma_series = variant(ma_type,ma_src,ma_len) plot(ma_series, title="MA Plot", linewidth=2,join=true, transp=10) long=haclose>haopen and crossover(haclose[1],ma_series) short=haclose