// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © yashp1334 //@version=4 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © yashp1334 //@version=4 // Pivot Boss is based on the work of Frank Ochoa @ www.pivotboss.com // Converted to Pinescript from Easy Language by DavidR. // Summary: // Creates one indicator with three exponential moving averages based off the central pivot point // which assists you in trading pure price action using floor pivots. // This also helps you to avoid getting chopped up during price confluence. // Parameters: // ShortEMA – Number of periods used to calculate the short term moving average. // MedEMA – Number of periods used to calculate the medium term moving average. // LongEMA – Number of periods used to calculate the long term moving average. // How to use: // When T-Line cross Green Short EMA it can be used for scalping. // When Short EMA pulls back to Medium EMA you can buy more or sell more depending on // without having to exit your position prematurely before trend direction changes. // This can also be used as position entry points to make sure you are getting the best possible price. // When T-Line, Short EMA and Medium EMA cross over Long EMA you go long or short. strategy(title="Pivot Boss 4 EMA", shorttitle="Pivot Boss 4 EMA", overlay=true) src = close TLineEMA = input(8, minval=1, title="Trigger Line") ShortEMA = input(13, minval=1, title="Short EMA") MedEMA = input(34, minval=1, title="Medium EMA") LongEMA = input(55, minval=1, title="Long EMA") fPivot = ((high + low + close)/3) TLine = ema(close, TLineEMA) fShortEMA = ema(fPivot, ShortEMA) fMedEMA = ema(fPivot, MedEMA) fLongEMA = ema(fPivot, LongEMA) buySignal = crossover(TLine,fShortEMA) sellSignal = crossunder(fShortEMA,fLongEMA) plot(TLine, color=color.yellow, title="T-Line EMA", linewidth=2) plot(fShortEMA, color=color.green, title="Short EMA", linewidth=2) plot(fMedEMA, color=color.gray, title="Medium EMA", linewidth=2) plot(fLongEMA, color=color.maroon, title="Long EMA", linewidth=2) //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) quant=input(title="Trade Quantity",defval=1) //adding stoploss and target option 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 //setting automated alerts required by apibridge 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) if(buySignal and st and strategy.position_size==0) strategy.entry("BUY",strategy.long,comment=le) if(sellSignal and st and strategy.position_size==0) strategy.entry("SELL",strategy.short,comment=se) if(buySignal and st and strategy.position_size!=0) strategy.entry("BUY",strategy.long,comment=sxle) if(sellSignal and st and strategy.position_size!=0) strategy.entry("SELL",strategy.short,comment=lxse) if(ut==true and us==false) strategy.exit(id="LX",from_entry="BUY",profit=tar,comment=lx) strategy.exit(id="SX",from_entry="SELL",profit=tar,comment=sx) if(us==true and ut==false) strategy.exit(id="LX",from_entry="BUY",loss=stop,comment=lx) strategy.exit(id="SX",from_entry="SELL",loss=stop,comment=sx) if(ut==true and us==true) strategy.exit(id="LX",from_entry="BUY",profit=tar,loss=stop,comment=lx) strategy.exit(id="SX",from_entry="SELL",profit=tar,loss=stop,comment=sx) strategy.close(id="BUY",when=et,comment=lx) strategy.close(id="SELL",when=et,comment=sx)