TradingView
SeaSide420
20 Th03 2019 06:17

tttdiff's HMA 

Tesla, Inc.NASDAQ

Mô tả

custom build:
HMA crossover
Trading hours option
backtest range option
Bình luận
Bhavith
can you please share source code sir
SeaSide420
//@version=3
strategy("tttdiff's HMA", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_order_fills= false, calc_on_every_tick=true, pyramiding=0)
kehh=input(title="Hull MA Length",type=integer,defval=50)
price = input( close )
ses = input("9:30-16:00", title="Trade Session", options=["00:00-24:00","9:30-16:00"])
eqSL = input(2000, title="Stop loss ($ of Equity)")
eqTP = input(2000, title="Take profit ($ of Equity)")
FromMonth = input(defval = 01, title = "From Month", minval = 1)
FromDay = input(defval = 01, title = "From Day", minval = 1)
FromYear = input(defval = 2019, title = "From Year", minval = 2014)
FromHour = 00//input(defval = 11, title = "From Hour", minval = 1)
ToMonth = input(defval = 12, title = "To Month", maxval = 12)
ToDay = input(defval = 27, title = "To Day", maxval = 31)
ToYear = input(defval = 2099, title = "To Year", minval = 2014)
ToHour = 00//input(defval = 11, title = "To Hour", minval = 1)
p=price
dayend = ses=="00:00-24:00"?hour==0 : hour==15 and (period=="1"?minute==58 : period=="3"?minute==54 : period=="5"?minute==50 : period=="15"? minute==30 : period=="30"? minute==0 : 1) //t[1] and na(t)//
daystart = ses=="00:00-24:00"? hour==0 : hour==9 and minute==30 //na(t[1]) and t//
timeCond = (time > timestamp(FromYear, FromMonth, FromDay, FromHour, 00)) and (time < timestamp(ToYear, ToMonth, ToDay, ToHour, 00))
a2ma=2*wma(p,round(kehh/2))
ama=wma(p,kehh)
adiff=a2ma-ama
sqn=round(sqrt(kehh))
a2ma1=2*wma(p[1],round(kehh/2))
ama1=wma(p[1],kehh)
adiff1=a2ma1-ama1
sqn1=round(sqrt(kehh))
a1=wma(adiff,sqn)
a2=wma(adiff1,sqn)
cc=a1<p?green:red
dd=plot(a1, style = line, color=black, linewidth = 1, title='HMA1')
ee=plot(a2, style = line, color=red, linewidth = 1, title='HMA2')
if (a1>a2 and timeCond)
strategy.entry("long", strategy.long, comment="Long")
if (a1<a2 and timeCond)
strategy.entry("short", strategy.short, comment="Short")
if (a1>a2 and timeCond)
strategy.entry("long", strategy.long, comment="Long", when=daystart)
if (a1<a2 and timeCond)
strategy.entry("short", strategy.short, comment="Short", when=daystart)
strategy.close_all(when=strategy.openprofit<-eqSL)
strategy.close_all(when=strategy.openprofit>eqTP)
strategy.close_all(when=dayend)
pureFriend65932
tiamo3733
Thank you for sharing.
Rohit_Shinde
looks interesting ...please make a indicator which shows supply demand zones
SeaSide420
@cryptotrade89, good idea, will do
Rohit_Shinde
@SeaSide420, bcoz every thing else is lagging ..market works only on supply demand structures
supply demand zone gives us a edge on market
SeaSide420
@cryptotrade89, i like the idea, i will do it next
Thêm nữa