anhnguyen14
Active Member
- 24,376
- 30,840
Haha, mình loss rùi, đã nâng vốn lên loss level 3 (11 unit)3 nến win nha bác keke![]()
Haha, mình loss rùi, đã nâng vốn lên loss level 3 (11 unit)3 nến win nha bác keke![]()
mong là lệnh level 3 này winHaha, mình loss rùi, đã nâng vốn lên loss level 3 (11 unit)
Hihi, tk chịu đc đến 5 level lận ámong là lệnh level 3 này win![]()
cang đến level cao mà win thì lợi nhuận càng cao kekeHihi, tk chịu đc đến 5 level lận á![]()
// BO - Woodies CCI - Backtesting
// © inno14
//@version=4
strategy("BO - Woodies CCI - Backtesting")
//strategy.risk.max_intraday_loss(1, strategy.cash)
// === INPUT PERIOD OF TIME ===
Date = input(true, title = "=== Date Option ===")
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromYear = input(defval = 2020, title = "From Year", minval = 2017)
ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToYear = input(defval = 9999, title = "To Year", minval = 2017)
// === DATE RANGE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
// === Trading Time ===
CTimeDvM = input(true, title = "=== Trading Time ===")
Time_zone = input(7,title="Time Zone")
FromHourDvM = input(defval = 07, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 30, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM = input(defval = 18, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 00, title = "To Minute", minval = 00, maxval = 59)
GMT_FHDvM=FromHourDvM<Time_zone?FromHourDvM-Time_zone+24:FromHourDvM-Time_zone
GMT_THDvM=ToHourDvM<Time_zone?ToHourDvM-Time_zone+24:ToHourDvM-Time_zone
fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM))
fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM))
thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM))
tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM))
WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM
t0_DvM = time(timeframe.period, WorkingHourDvM)
htrtime = input(true,title="Highlight Trading Time")
bgcolor(htrtime? t0_DvM? color.gray : na:na, title="Trading Time", transp=90)
//
//fh_ott= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM))
//fm_ott= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM))
//th_ott= fh_ott
//tm_ott= (FromMinuteDvM+5<10?"0"+tostring(FromMinuteDvM+5):tostring(FromMinuteDvM+5))
//trading_time_open = fh_ott+fm_ott+"-"+th_ott+tm_ott
//t1 = time(timeframe.period, trading_time_open)
//Woodies CCI
woodies_tt=input(true,title="=== Woodies CCI ===")
cciTurboLength = input(title="CCI Turbo Length", type=input.integer, defval=6, minval=3, maxval=1400)
cci14Length = input(title="CCI 14 Length", type=input.integer, defval=14, minval=7, maxval=2000)
source = close
cciTurbo = cci(source, cciTurboLength)
cci14 = cci(source, cci14Length)
last5IsDown = cci14[5] < 0 and cci14[4] < 0 and cci14[3] < 0 and cci14[2] < 0 and cci14[1] < 0
last5IsUp = cci14[5] > 0 and cci14[4] > 0 and cci14[3] > 0 and cci14[2] > 0 and cci14[1] > 0
histogramColor = last5IsUp ? color.green : last5IsDown ? color.red : cci14 < 0 ? color.gray : color.gray
//Plot Woodies CCI
plot(cci14, title="CCI Histogram", color=histogramColor, style=plot.style_histogram, linewidth=2, transp=40)
plot(0, title="Zero Line", color=cciTurbo>100?color.blue:cciTurbo<-100?color.red:color.navy, style=plot.style_line, linewidth=6, transp=20)
hline(200, title="Hundred Line", color=color.black, linestyle=hline.style_dotted)
hline(-200, title="Minus Line", color=color.black, linestyle=hline.style_dotted)
//Plot lingreg CCI14
linreg_cci14=linreg(cci14, 5, 0)
plot(linreg_cci14, color=color.aqua, linewidth=4)
//
ext_linreg=input(120,title="Extreme Level")
//peak & top
peak_cci=
linreg_cci14[2]>linreg_cci14[3] and linreg_cci14[1]>linreg_cci14[2] and linreg_cci14[0]<linreg_cci14[1] and linreg_cci14[1]>ext_linreg
bott_cci=
linreg_cci14[2]<linreg_cci14[3] and linreg_cci14[1]<linreg_cci14[2] and linreg_cci14[0]>linreg_cci14[1] and linreg_cci14[1]<-ext_linreg
peak_cci_1=
linreg_cci14[2]>linreg_cci14[3] and linreg_cci14[1]>linreg_cci14[2] and linreg_cci14[0]<linreg_cci14[1]
bott_cci_1=
linreg_cci14[2]<linreg_cci14[3] and linreg_cci14[1]<linreg_cci14[2] and linreg_cci14[0]>linreg_cci14[1]
//
fil_len=input(3,title="Filter Length")
top_ext=highest(cci14,fil_len)
bot_ext=lowest(cci14,fil_len)
//2. Stochastic
stoch_tt=input(true,title="=== Stochastic ===")
stoch_K=input(14,title="K periods")
stoch_D=input(1,title="D periods")
stoch_S=input(5,title="S periods")
stoch_Top=input(80,title="Top Extreme")
stoch_Bot=input(20,title="Bot Extreme")
STOCH(src,perK,perD,perS) =>
K = perK
D = perD
smooth = perS
hh = highest(high, K)
ll = lowest(low, K)
k = sma((src - ll) / (hh - ll) * 100, smooth)
d = sma(k, D)
STOCH=k
stoch_Sig = STOCH(close,stoch_K,stoch_D,stoch_S)
//Put signal
x1=
peak_cci
and cci14[1]==top_ext
and linreg_cci14[1]>valuewhen(peak_cci_1,linreg_cci14[1],1)
and close>low[1]
and cciTurbo<100
and cci14<linreg_cci14
and stoch_Sig[1]>stoch_Top
//Call signal
y1=
bott_cci
and cci14[1]==bot_ext
and linreg_cci14[1]<valuewhen(bott_cci_1,linreg_cci14[1],1)
and close<high[1]
and cciTurbo>-100
and cci14>linreg_cci14
and stoch_Sig[1]<stoch_Bot
no_orders =
not strategy.opentrades
//Function
xTech=
x1
and no_orders
yTech=
y1
and no_orders
//Plot Analyzing Signals
//hline1=hline(-1.2*300)
hline2=hline(-1.6*300)
hline0=hline(0)
sigtext=
xTech?"Put signal":yTech?"Call signal":
"Backtesting From: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)+" To: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
+ " * Trading Time From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
sig_col=xTech?color.new(color.red,10):yTech?color.new(color.blue,10):color.new(color.navy,10)
label_sig_text = label.new(bar_index[0], -1.5*300, text=sigtext, style=label.style_none, textcolor=sig_col, size=size.large)
label.delete(label_sig_text[1])
//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech and window() and t0_DvM?-1.2*300:na
CallSignal= yTech and window() and t0_DvM?-1.2*300:na
//plot(PutSignal, title='Put Signal', style=plot.style_columns, color=color.red, offset=1, transp=0)
//plot(CallSignal, title='Call Signal', style=plot.style_columns, color=color.blue, offset=1, transp=0)
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.large)
//plotchar(PutSignal, title='Put', char="◉", text="Put", location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.small)
//plotchar(CallSignal, title='Call', char="◉", text="Call", location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.small)
//Backtesting
exp_tt=input(true,"Expiry Option By Bars")
exp_val=input(6,"Number of Bars")
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM)
strategy.close_all(when=barssince(xTech)==exp_val or barssince(yTech)==exp_val)
//EOF
tks bác nhiều, con này về số lệnh và hiệu suất cũng ko bằng con phiên bản số 4 trong máy mình (tại cũng ko biết gọi tên sao).@Trương Nhật chạy con EJ IDC M5 nhé
=== 1 tháng ===Mã:// BO - Woodies CCI - Backtesting // © inno14 //@version=4 strategy("BO - Woodies CCI - Backtesting") //strategy.risk.max_intraday_loss(1, strategy.cash) // === INPUT PERIOD OF TIME === Date = input(true, title = "=== Date Option ===") FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31) FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12) FromYear = input(defval = 2020, title = "From Year", minval = 2017) ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31) ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12) ToYear = input(defval = 9999, title = "To Year", minval = 2017) // === DATE RANGE === start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window window() => time >= start and time <= finish ? true : false // create function "within window of time" // === Trading Time === CTimeDvM = input(true, title = "=== Trading Time ===") Time_zone = input(7,title="Time Zone") FromHourDvM = input(defval = 07, title = "From Hour", minval = 00, maxval = 23) FromMinuteDvM = input(defval = 30, title = "From Minute", minval = 00, maxval = 59) ToHourDvM = input(defval = 18, title = "To Hour", minval = 00, maxval = 23) ToMinuteDvM = input(defval = 00, title = "To Minute", minval = 00, maxval = 59) GMT_FHDvM=FromHourDvM<Time_zone?FromHourDvM-Time_zone+24:FromHourDvM-Time_zone GMT_THDvM=ToHourDvM<Time_zone?ToHourDvM-Time_zone+24:ToHourDvM-Time_zone fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM)) fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM)) thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM)) tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM)) WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM t0_DvM = time(timeframe.period, WorkingHourDvM) htrtime = input(true,title="Highlight Trading Time") bgcolor(htrtime? t0_DvM? color.gray : na:na, title="Trading Time", transp=90) // //fh_ott= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM)) //fm_ott= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM)) //th_ott= fh_ott //tm_ott= (FromMinuteDvM+5<10?"0"+tostring(FromMinuteDvM+5):tostring(FromMinuteDvM+5)) //trading_time_open = fh_ott+fm_ott+"-"+th_ott+tm_ott //t1 = time(timeframe.period, trading_time_open) //Woodies CCI woodies_tt=input(true,title="=== Woodies CCI ===") cciTurboLength = input(title="CCI Turbo Length", type=input.integer, defval=6, minval=3, maxval=1400) cci14Length = input(title="CCI 14 Length", type=input.integer, defval=14, minval=7, maxval=2000) source = close cciTurbo = cci(source, cciTurboLength) cci14 = cci(source, cci14Length) last5IsDown = cci14[5] < 0 and cci14[4] < 0 and cci14[3] < 0 and cci14[2] < 0 and cci14[1] < 0 last5IsUp = cci14[5] > 0 and cci14[4] > 0 and cci14[3] > 0 and cci14[2] > 0 and cci14[1] > 0 histogramColor = last5IsUp ? color.green : last5IsDown ? color.red : cci14 < 0 ? color.gray : color.gray //Plot Woodies CCI plot(cci14, title="CCI Histogram", color=histogramColor, style=plot.style_histogram, linewidth=2, transp=40) plot(0, title="Zero Line", color=cciTurbo>100?color.blue:cciTurbo<-100?color.red:color.navy, style=plot.style_line, linewidth=6, transp=20) hline(200, title="Hundred Line", color=color.black, linestyle=hline.style_dotted) hline(-200, title="Minus Line", color=color.black, linestyle=hline.style_dotted) //Plot lingreg CCI14 linreg_cci14=linreg(cci14, 5, 0) plot(linreg_cci14, color=color.aqua, linewidth=4) // ext_linreg=input(120,title="Extreme Level") //peak & top peak_cci= linreg_cci14[2]>linreg_cci14[3] and linreg_cci14[1]>linreg_cci14[2] and linreg_cci14[0]<linreg_cci14[1] and linreg_cci14[1]>ext_linreg bott_cci= linreg_cci14[2]<linreg_cci14[3] and linreg_cci14[1]<linreg_cci14[2] and linreg_cci14[0]>linreg_cci14[1] and linreg_cci14[1]<-ext_linreg peak_cci_1= linreg_cci14[2]>linreg_cci14[3] and linreg_cci14[1]>linreg_cci14[2] and linreg_cci14[0]<linreg_cci14[1] bott_cci_1= linreg_cci14[2]<linreg_cci14[3] and linreg_cci14[1]<linreg_cci14[2] and linreg_cci14[0]>linreg_cci14[1] // fil_len=input(3,title="Filter Length") top_ext=highest(cci14,fil_len) bot_ext=lowest(cci14,fil_len) //2. Stochastic stoch_tt=input(true,title="=== Stochastic ===") stoch_K=input(14,title="K periods") stoch_D=input(1,title="D periods") stoch_S=input(5,title="S periods") stoch_Top=input(80,title="Top Extreme") stoch_Bot=input(20,title="Bot Extreme") STOCH(src,perK,perD,perS) => K = perK D = perD smooth = perS hh = highest(high, K) ll = lowest(low, K) k = sma((src - ll) / (hh - ll) * 100, smooth) d = sma(k, D) STOCH=k stoch_Sig = STOCH(close,stoch_K,stoch_D,stoch_S) //Put signal x1= peak_cci and cci14[1]==top_ext and linreg_cci14[1]>valuewhen(peak_cci_1,linreg_cci14[1],1) and close>low[1] and cciTurbo<100 and cci14<linreg_cci14 and stoch_Sig[1]>stoch_Top //Call signal y1= bott_cci and cci14[1]==bot_ext and linreg_cci14[1]<valuewhen(bott_cci_1,linreg_cci14[1],1) and close<high[1] and cciTurbo>-100 and cci14>linreg_cci14 and stoch_Sig[1]<stoch_Bot no_orders = not strategy.opentrades //Function xTech= x1 and no_orders yTech= y1 and no_orders //Plot Analyzing Signals //hline1=hline(-1.2*300) hline2=hline(-1.6*300) hline0=hline(0) sigtext= xTech?"Put signal":yTech?"Call signal": "Backtesting From: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)+" To: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear) + " * Trading Time From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM) sig_col=xTech?color.new(color.red,10):yTech?color.new(color.blue,10):color.new(color.navy,10) label_sig_text = label.new(bar_index[0], -1.5*300, text=sigtext, style=label.style_none, textcolor=sig_col, size=size.large) label.delete(label_sig_text[1]) //plot Signal putcol = xTech? color.red : na callcol = yTech? color.blue : na PutSignal= xTech and window() and t0_DvM?-1.2*300:na CallSignal= yTech and window() and t0_DvM?-1.2*300:na //plot(PutSignal, title='Put Signal', style=plot.style_columns, color=color.red, offset=1, transp=0) //plot(CallSignal, title='Call Signal', style=plot.style_columns, color=color.blue, offset=1, transp=0) plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.large) plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.large) //plotchar(PutSignal, title='Put', char="◉", text="Put", location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.small) //plotchar(CallSignal, title='Call', char="◉", text="Call", location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.small) //Backtesting exp_tt=input(true,"Expiry Option By Bars") exp_val=input(6,"Number of Bars") strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM) strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM) strategy.close_all(when=barssince(xTech)==exp_val or barssince(yTech)==exp_val) //EOF
![]()
Cái chiến lược này chính là tay RSI mà mình từng đề cập với vĩnh đó, hehe, hàng backtest của vĩnh đây, trend hồi yếu mới ngon, chứ nó hồi hơi mạnh 1 chút là toanyes huhu nửa đêm nghe tin buồn quá bác ơi... https://facenim.blogspot.com/2020/03/chien-luoc-hai-hanh-lang.html?m=1 cái này lâu rồi nhưng mà e test trên mt4 thấy winrate cũng đk bác ạ cơ mà ít lệnh lắm k biet bác code dk k
// BO - RSI - Backtesting
// © inno14
//@version=4
strategy("BO - RSI - Backtesting")
//strategy.risk.max_intraday_loss(1, strategy.cash)
// === INPUT PERIOD OF TIME ===
Date = input(true, title = "=== Date Option ===")
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromYear = input(defval = 2020, title = "From Year", minval = 2017)
ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToYear = input(defval = 9999, title = "To Year", minval = 2017)
// === DATE RANGE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
// === Trading Time ===
CTimeDvM = input(true, title = "=== Trading Time ===")
Time_zone = input(7,title="Time Zone")
FromHourDvM = input(defval = 05, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM = input(defval = 04, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 59, title = "To Minute", minval = 00, maxval = 59)
GMT_FHDvM=FromHourDvM<Time_zone?FromHourDvM-Time_zone+24:FromHourDvM-Time_zone
GMT_THDvM=ToHourDvM<Time_zone?ToHourDvM-Time_zone+24:ToHourDvM-Time_zone
fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM))
fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM))
thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM))
tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM))
WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM
t0_DvM = time(timeframe.period, WorkingHourDvM)
htrtime = input(true,title="Highlight Trading Time")
bgcolor(htrtime? t0_DvM? color.gray : na:na, title="Trading Time", transp=90)
//MA
ma_tt=input(true,"=== Exponential Moving Average Option ===")
ma_len=input(2,title="EMA Length")
ma=ema(close,ma_len)
ma_col=ma[0]>ma[1]?color.new(color.green,0):ma[0]<ma[1]?color.new(color.red,0):color.gray
ma_flat=100
plot(ma_flat,title="Moving Average Trend Flat", color=ma_col, linewidth=10)
//RSI
rsi_tt=input(true,"=== RSI Option ===")
rsi_len=input(3,title="RSI Length")
rsi_top1=input(60,title="Top Line 1")
rsi_top2=input(53,title="Top Line 2")
rsi_bot1=input(47,title="Bottom Line 1")
rsi_bot2=input(40,title="Bottom Line 2")
rsi=rsi(close,rsi_len)
rsi_col=color.new(color.aqua,15)
plot(rsi, title="RSI", color=rsi_col, style=plot.style_line, linewidth=2)
hline100=hline(100)
hline0=hline(0)
rsi_top1_line=hline(rsi_top1)
rsi_top2_line=hline(rsi_top2)
fil_col_top=color.new(color.red,45)
fill(rsi_top1_line,rsi_top2_line, color=fil_col_top, title="Top Band")
rsi_bot1_line=hline(rsi_bot1)
rsi_bot2_line=hline(rsi_bot2)
fil_col_bot=color.new(color.green,45)
fill(rsi_bot1_line,rsi_bot2_line, color=fil_col_bot, title="Bottom Band")
//Put signal
x1=
ma[0]>ma[1]
and crossover(rsi[0],40) and rsi[0]<=47
and close>open
//Call signal
y1=
ma[0]<ma[1]
and crossunder(rsi[0],60) and rsi[0]>=53
and close<open
no_orders =
not strategy.opentrades
//Function
xTech=
x1
and no_orders
yTech=
y1
and no_orders
//Plot Analyzing Signals
//hline1=hline(-1.2*100)
hline2=hline(-1.2*100)
//hline0=hline(0)
sigtext=
xTech?"Put signal":yTech?"Call signal":
"Backtesting From: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)+" To: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
+ " * Trading Time From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
sig_col=xTech?color.new(color.red,10):yTech?color.new(color.blue,10):color.new(color.navy,10)
label_sig_text = label.new(bar_index[0], -0.8*100, text=sigtext, style=label.style_none, textcolor=sig_col, size=size.large)
label.delete(label_sig_text[1])
//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech and window() and t0_DvM?-0.5*100:na
CallSignal= yTech and window() and t0_DvM?-0.5*100:na
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.large)
//Backtesting
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM)
strategy.close_all(when=barstate.isnew)
//exp_tt=input(true,"Expiry Option By Bars")
//exp_val=input(6,"Number of Bars")
//strategy.close_all(when=barssince(xTech)==exp_val or barssince(yTech)==exp_val)
//EOF
Con đó dùng tín hiệu phân kỳ, cứ gọi nó laf woodies phân kỳ. Mà phân kỳ thì bạn biết rồi đó, chuỗi loss của nó dài lê thê luôn, cái mình quan tâm bây giờ là chuỗi loss dài hay ngắn, chứ hiệu suất đã là quá khứ rùitks bác nhiều, con này về số lệnh và hiệu suất cũng ko bằng con phiên bản số 4 trong máy mình (tại cũng ko biết gọi tên sao).
Hết tháng 3 là mình theo dõi con đó gần đc 3 tháng. Có điều tháng 3 đang hơi tệ![]()
ua, cũng là 1 hướng điCon đó dùng tín hiệu phân kỳ, cứ gọi nó laf woodies phân kỳ. Mà phân kỳ thì bạn biết rồi đó, chuỗi loss của nó dài lê thê luôn, cái mình quan tâm bây giờ là chuỗi loss dài hay ngắn, chứ hiệu suất đã là quá khứ rùi![]()
code này bị lỗi gi ý bác ạ e k thêm zô chart dk huhuCái chiến lược này chính là tay RSI mà mình từng đề cập với vĩnh đó, hehe, hàng backtest của vĩnh đây, trend hồi yếu mới ngon, chứ nó hồi hơi mạnh 1 chút là toan
Mã:// BO - RSI - Backtesting // © inno14 //@version=4 strategy("BO - RSI - Backtesting") //strategy.risk.max_intraday_loss(1, strategy.cash) // === INPUT PERIOD OF TIME === Date = input(true, title = "=== Date Option ===") FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31) FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12) FromYear = input(defval = 2020, title = "From Year", minval = 2017) ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31) ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12) ToYear = input(defval = 9999, title = "To Year", minval = 2017) // === DATE RANGE === start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window window() => time >= start and time <= finish ? true : false // create function "within window of time" // === Trading Time === CTimeDvM = input(true, title = "=== Trading Time ===") Time_zone = input(7,title="Time Zone") FromHourDvM = input(defval = 05, title = "From Hour", minval = 00, maxval = 23) FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59) ToHourDvM = input(defval = 04, title = "To Hour", minval = 00, maxval = 23) ToMinuteDvM = input(defval = 59, title = "To Minute", minval = 00, maxval = 59) GMT_FHDvM=FromHourDvM<Time_zone?FromHourDvM-Time_zone+24:FromHourDvM-Time_zone GMT_THDvM=ToHourDvM<Time_zone?ToHourDvM-Time_zone+24:ToHourDvM-Time_zone fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM)) fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM)) thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM)) tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM)) WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM t0_DvM = time(timeframe.period, WorkingHourDvM) htrtime = input(true,title="Highlight Trading Time") bgcolor(htrtime? t0_DvM? color.gray : na:na, title="Trading Time", transp=90) //MA ma_tt=input(true,"=== Exponential Moving Average Option ===") ma_len=input(2,title="EMA Length") ma=ema(close,ma_len) ma_col=ma[0]>ma[1]?color.new(color.green,0):ma[0]<ma[1]?color.new(color.red,0):color.gray ma_flat=100 plot(ma_flat,title="Moving Average Trend Flat", color=ma_col, linewidth=10) //RSI rsi_tt=input(true,"=== RSI Option ===") rsi_len=input(3,title="RSI Length") rsi_top1=input(60,title="Top Line 1") rsi_top2=input(53,title="Top Line 2") rsi_bot1=input(47,title="Bottom Line 1") rsi_bot2=input(40,title="Bottom Line 2") rsi=rsi(close,rsi_len) rsi_col=color.new(color.aqua,15) plot(rsi, title="RSI", color=rsi_col, style=plot.style_line, linewidth=2) hline100=hline(100) hline0=hline(0) rsi_top1_line=hline(rsi_top1) rsi_top2_line=hline(rsi_top2) fil_col_top=color.new(color.red,45) fill(rsi_top1_line,rsi_top2_line, color=fil_col_top, title="Top Band") rsi_bot1_line=hline(rsi_bot1) rsi_bot2_line=hline(rsi_bot2) fil_col_bot=color.new(color.green,45) fill(rsi_bot1_line,rsi_bot2_line, color=fil_col_bot, title="Bottom Band") //Put signal x1= ma[0]>ma[1] and crossover(rsi[0],40) and rsi[0]<=47 and close>open //Call signal y1= ma[0]<ma[1] and crossunder(rsi[0],60) and rsi[0]>=53 and close<open no_orders = not strategy.opentrades //Function xTech= x1 and no_orders yTech= y1 and no_orders //Plot Analyzing Signals //hline1=hline(-1.2*100) hline2=hline(-1.2*100) //hline0=hline(0) sigtext= xTech?"Put signal":yTech?"Call signal": "Backtesting From: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)+" To: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear) + " * Trading Time From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM) sig_col=xTech?color.new(color.red,10):yTech?color.new(color.blue,10):color.new(color.navy,10) label_sig_text = label.new(bar_index[0], -0.8*100, text=sigtext, style=label.style_none, textcolor=sig_col, size=size.large) label.delete(label_sig_text[1]) //plot Signal putcol = xTech? color.red : na callcol = yTech? color.blue : na PutSignal= xTech and window() and t0_DvM?-0.5*100:na CallSignal= yTech and window() and t0_DvM?-0.5*100:na plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.large) plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.large) //Backtesting strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM) strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM) strategy.close_all(when=barstate.isnew) //exp_tt=input(true,"Expiry Option By Bars") //exp_val=input(6,"Number of Bars") //strategy.close_all(when=barssince(xTech)==exp_val or barssince(yTech)==exp_val) //EOF
Lỗi viết hoa lệnh ema ở dòng 43. Đã sửac
code này bị lỗi gi ý bác ạ e k thêm zô chart dk huhu
// BO - RSI - Backtesting
// © inno14
//@version=4
strategy("BO - RSI - Backtesting")
//strategy.risk.max_intraday_loss(1, strategy.cash)
// === INPUT PERIOD OF TIME ===
Date = input(true, title = "=== Date Option ===")
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
FromYear = input(defval = 2020, title = "From Year", minval = 2017)
ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToYear = input(defval = 9999, title = "To Year", minval = 2017)
// === DATE RANGE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
// === Trading Time ===
CTimeDvM = input(true, title = "=== Trading Time ===")
Time_zone = input(7,title="Time Zone")
FromHourDvM = input(defval = 05, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM = input(defval = 04, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 59, title = "To Minute", minval = 00, maxval = 59)
GMT_FHDvM=FromHourDvM<Time_zone?FromHourDvM-Time_zone+24:FromHourDvM-Time_zone
GMT_THDvM=ToHourDvM<Time_zone?ToHourDvM-Time_zone+24:ToHourDvM-Time_zone
fhDvM= (GMT_FHDvM<10?"0"+tostring(GMT_FHDvM):tostring(GMT_FHDvM))
fmDvM= (FromMinuteDvM<10?"0"+tostring(FromMinuteDvM):tostring(FromMinuteDvM))
thDvM= (GMT_THDvM<10?"0"+tostring(GMT_THDvM):tostring(GMT_THDvM))
tmDvM= (ToMinuteDvM<10?"0"+tostring(ToMinuteDvM):tostring(ToMinuteDvM))
WorkingHourDvM = fhDvM+fmDvM+"-"+thDvM+tmDvM
t0_DvM = time(timeframe.period, WorkingHourDvM)
htrtime = input(true,title="Highlight Trading Time")
bgcolor(htrtime? t0_DvM? color.gray : na:na, title="Trading Time", transp=90)
//MA
ma_tt=input(true,"=== Exponential Moving Average Option ===")
ma_len=input(2,title="EMA Length")
ma=ema(close,ma_len)
ma_col=ma[0]>ma[1]?color.new(color.green,0):ma[0]<ma[1]?color.new(color.red,0):color.gray
ma_flat=100
plot(ma_flat,title="Moving Average Trend Flat", color=ma_col, linewidth=10)
//RSI
rsi_tt=input(true,"=== RSI Option ===")
rsi_len=input(3,title="RSI Length")
rsi_top1=input(60,title="Top Line 1")
rsi_top2=input(53,title="Top Line 2")
rsi_bot1=input(47,title="Bottom Line 1")
rsi_bot2=input(40,title="Bottom Line 2")
rsi=rsi(close,rsi_len)
rsi_col=color.new(color.aqua,15)
plot(rsi, title="RSI", color=rsi_col, style=plot.style_line, linewidth=2)
hline100=hline(100)
hline0=hline(0)
rsi_top1_line=hline(rsi_top1)
rsi_top2_line=hline(rsi_top2)
fil_col_top=color.new(color.red,45)
fill(rsi_top1_line,rsi_top2_line, color=fil_col_top, title="Top Band")
rsi_bot1_line=hline(rsi_bot1)
rsi_bot2_line=hline(rsi_bot2)
fil_col_bot=color.new(color.green,45)
fill(rsi_bot1_line,rsi_bot2_line, color=fil_col_bot, title="Bottom Band")
//Put signal
x1=
ma[0]>ma[1]
and crossover(rsi[0],40) and rsi[0]<=47
and close>open
//Call signal
y1=
ma[0]<ma[1]
and crossunder(rsi[0],60) and rsi[0]>=53
and close<open
no_orders =
not strategy.opentrades
//Function
xTech=
x1
and no_orders
yTech=
y1
and no_orders
//Plot Analyzing Signals
//hline1=hline(-1.2*100)
hline2=hline(-1.2*100)
//hline0=hline(0)
sigtext=
xTech?"Put signal":yTech?"Call signal":
"Backtesting From: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)+" To: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
+ " * Trading Time From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
sig_col=xTech?color.new(color.red,10):yTech?color.new(color.blue,10):color.new(color.navy,10)
label_sig_text = label.new(bar_index[0], -0.8*100, text=sigtext, style=label.style_none, textcolor=sig_col, size=size.large)
label.delete(label_sig_text[1])
//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech and window() and t0_DvM?-0.5*100:na
CallSignal= yTech and window() and t0_DvM?-0.5*100:na
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=color.red, textcolor=color.black, offset=1, transp=0, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=color.blue, textcolor=color.black, offset=1, transp=0, size=size.large)
//Backtesting
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM)
strategy.close_all(when=barstate.isnew)
//exp_tt=input(true,"Expiry Option By Bars")
//exp_val=input(6,"Number of Bars")
//strategy.close_all(when=barssince(xTech)==exp_val or barssince(yTech)==exp_val)
//EOF
Đây là lỗi của diễn đàn, diễn đàn tự động viết hoa chữ EMA của mình, vĩnh tìm đến dòng 43 và sửa lại EMA thành ema nha.c
code này bị lỗi gi ý bác ạ e k thêm zô chart dk huhu
yes thank bác kekeĐây là lỗi của diễn đàn, diễn đàn tự động viết hoa chữ EMA của mình, vĩnh tìm đến dòng 43 và sửa lại EMA thành ema nha.
Còn đây là code bộ 6 nến từ M1->H4, ko biết phải dùng thế nào nên chưa viết backtest, vĩnh xem có ý tưởng gì koyes thank bác keke![]()
// MTF Bar's Direction
// © anhnguyen14
//@version=4
study("MTF Bar's Direction")
//Bar Function
Bar_High(res) =>
security(syminfo.tickerid,res,(high-open))
Bar_Low(res) =>
security(syminfo.tickerid,res,(low-open))
Bar_Body(res) =>
security(syminfo.tickerid,res,(close-open))
h0=hline(0)
//Bar M1
M1_High=Bar_High("1")
M1_Low=Bar_Low("1")
M1_Body=Bar_Body("1")
//Bar M5
M5_High=Bar_High("5")
M5_Low=Bar_Low("5")
M5_Body=Bar_Body("5")
//Bar M15
M15_High=Bar_High("15")
M15_Low=Bar_Low("15")
M15_Body=Bar_Body("15")
//Bar M30
M30_High=Bar_High("30")
M30_Low=Bar_Low("30")
M30_Body=Bar_Body("30")
//Bar H1
M60_High=Bar_High("60")
M60_Low=Bar_Low("60")
M60_Body=Bar_Body("60")
//Bar H4
M240_High=Bar_High("240")
M240_Low=Bar_Low("240")
M240_Body=Bar_Body("240")
//Bar Color
wick_col=color.gray
up_col=color.new(color.lime,0)
dn_col=color.new(color.black,0)
body_M1_col=
M1_Body>0?up_col:M1_Body<0?dn_col:color.gray
body_M5_col=
M5_Body>0?up_col:M5_Body<0?dn_col:color.gray
body_M15_col=
M15_Body>0?up_col:M15_Body<0?dn_col:color.gray
body_M30_col=
M30_Body>0?up_col:M30_Body<0?dn_col:color.gray
body_M60_col=
M60_Body>0?up_col:M60_Body<0?dn_col:color.gray
body_M240_col=
M240_Body>0?up_col:M240_Body<0?dn_col:color.gray
y_loc=1.2*max(M1_High, M5_High, M15_High, M30_High, M60_High, M240_High)
//Plot MTF Bar
M1_location=input(15,title="Bar M1 Location")
plot(M1_High, title="M1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1)
plot(M1_Low, title="M1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1)
plot(M1_Body, title="M1 Body", color=body_M1_col, linewidth=0, style=plot.style_columns, offset=-M1_location, show_last=1)
label_M1=label.new(bar_index[M1_location], y_loc, text="M1", style=label.style_none)
label.delete(label_M1[1])
M5_location=input(12,title="Bar M5 Location")
plot(M5_High, title="M5 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1)
plot(M5_Low, title="M5 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1)
plot(M5_Body, title="M5 Body", color=body_M5_col, linewidth=0, style=plot.style_columns, offset=-M5_location, show_last=1)
label_M5=label.new(bar_index[M5_location], y_loc, text="M5", style=label.style_none)
label.delete(label_M5[1])
M15_location=input(9,title="Bar M15 Location")
plot(M15_High, title="M15 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1)
plot(M15_Low, title="M15 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1)
plot(M15_Body, title="M15 Body", color=body_M15_col, linewidth=0, style=plot.style_columns, offset=-M15_location, show_last=1)
label_M15=label.new(bar_index[M15_location], y_loc, text="M15", style=label.style_none)
label.delete(label_M15[1])
M30_location=input(6,title="Bar M30 Location")
plot(M30_High, title="M30 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1)
plot(M30_Low, title="M30 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1)
plot(M30_Body, title="M30 Body", color=body_M30_col, linewidth=0, style=plot.style_columns, offset=-M30_location, show_last=1)
label_M30=label.new(bar_index[M30_location], y_loc, text="M30", style=label.style_none)
label.delete(label_M30[1])
M60_location=input(3,title="Bar H1 Location")
plot(M60_High, title="H1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1)
plot(M60_Low, title="H1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1)
plot(M60_Body, title="H1 Body", color=body_M60_col, linewidth=0, style=plot.style_columns, offset=-M60_location, show_last=1)
label_M60=label.new(bar_index[M60_location], y_loc, text="H1", style=label.style_none)
label.delete(label_M60[1])
M240_location=input(0,title="Bar H4 Location")
plot(M240_High, title="H4 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1)
plot(M240_Low, title="H4 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1)
plot(M240_Body, title="H4 Body", color=body_M240_col, linewidth=0, style=plot.style_columns, offset=M240_location, show_last=1)
label_M240=label.new(bar_index[M240_location], y_loc, text="H4", style=label.style_none)
label.delete(label_M240[1])
//EOF
e cung k rõ nữa tác giả chiến thuật có nói kêt hợp với cản... còn e thấy vào thời gian mở nến h4 thì tất cả các nến đều đồng màu mà con woodies vẫn ngon nên e k nghĩ tới các chiến thuật khác keke hàng của bác vẫn là ok nhất màCòn đây là code bộ 6 nến từ M1->H4, ko biết phải dùng thế nào nên chưa viết backtest, vĩnh xem có ý tưởng gì ko
Mã:// MTF Bar's Direction // © anhnguyen14 //@version=4 study("MTF Bar's Direction") //Bar Function Bar_High(res) => security(syminfo.tickerid,res,(high-open)) Bar_Low(res) => security(syminfo.tickerid,res,(low-open)) Bar_Body(res) => security(syminfo.tickerid,res,(close-open)) h0=hline(0) //Bar M1 M1_High=Bar_High("1") M1_Low=Bar_Low("1") M1_Body=Bar_Body("1") //Bar M5 M5_High=Bar_High("5") M5_Low=Bar_Low("5") M5_Body=Bar_Body("5") //Bar M15 M15_High=Bar_High("15") M15_Low=Bar_Low("15") M15_Body=Bar_Body("15") //Bar M30 M30_High=Bar_High("30") M30_Low=Bar_Low("30") M30_Body=Bar_Body("30") //Bar H1 M60_High=Bar_High("60") M60_Low=Bar_Low("60") M60_Body=Bar_Body("60") //Bar H4 M240_High=Bar_High("240") M240_Low=Bar_Low("240") M240_Body=Bar_Body("240") //Bar Color wick_col=color.gray up_col=color.new(color.lime,0) dn_col=color.new(color.black,0) body_M1_col= M1_Body>0?up_col:M1_Body<0?dn_col:color.gray body_M5_col= M5_Body>0?up_col:M5_Body<0?dn_col:color.gray body_M15_col= M15_Body>0?up_col:M15_Body<0?dn_col:color.gray body_M30_col= M30_Body>0?up_col:M30_Body<0?dn_col:color.gray body_M60_col= M60_Body>0?up_col:M60_Body<0?dn_col:color.gray body_M240_col= M240_Body>0?up_col:M240_Body<0?dn_col:color.gray y_loc=1.2*max(M1_High, M5_High, M15_High, M30_High, M60_High, M240_High) //Plot MTF Bar M1_location=input(15,title="Bar M1 Location") plot(M1_High, title="M1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1) plot(M1_Low, title="M1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1) plot(M1_Body, title="M1 Body", color=body_M1_col, linewidth=0, style=plot.style_columns, offset=-M1_location, show_last=1) label_M1=label.new(bar_index[M1_location], y_loc, text="M1", style=label.style_none) label.delete(label_M1[1]) M5_location=input(12,title="Bar M5 Location") plot(M5_High, title="M5 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1) plot(M5_Low, title="M5 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1) plot(M5_Body, title="M5 Body", color=body_M5_col, linewidth=0, style=plot.style_columns, offset=-M5_location, show_last=1) label_M5=label.new(bar_index[M5_location], y_loc, text="M5", style=label.style_none) label.delete(label_M5[1]) M15_location=input(9,title="Bar M15 Location") plot(M15_High, title="M15 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1) plot(M15_Low, title="M15 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1) plot(M15_Body, title="M15 Body", color=body_M15_col, linewidth=0, style=plot.style_columns, offset=-M15_location, show_last=1) label_M15=label.new(bar_index[M15_location], y_loc, text="M15", style=label.style_none) label.delete(label_M15[1]) M30_location=input(6,title="Bar M30 Location") plot(M30_High, title="M30 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1) plot(M30_Low, title="M30 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1) plot(M30_Body, title="M30 Body", color=body_M30_col, linewidth=0, style=plot.style_columns, offset=-M30_location, show_last=1) label_M30=label.new(bar_index[M30_location], y_loc, text="M30", style=label.style_none) label.delete(label_M30[1]) M60_location=input(3,title="Bar H1 Location") plot(M60_High, title="H1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1) plot(M60_Low, title="H1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1) plot(M60_Body, title="H1 Body", color=body_M60_col, linewidth=0, style=plot.style_columns, offset=-M60_location, show_last=1) label_M60=label.new(bar_index[M60_location], y_loc, text="H1", style=label.style_none) label.delete(label_M60[1]) M240_location=input(0,title="Bar H4 Location") plot(M240_High, title="H4 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1) plot(M240_Low, title="H4 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1) plot(M240_Body, title="H4 Body", color=body_M240_col, linewidth=0, style=plot.style_columns, offset=M240_location, show_last=1) label_M240=label.new(bar_index[M240_location], y_loc, text="H4", style=label.style_none) label.delete(label_M240[1]) //EOF
Mình thấy cái này hay hay, bổ sung thời gian đóng nến để vĩnh dễ quan sát tìm ý tưởnge cung k rõ nữa tác giả chiến thuật có nói kêt hợp với cản... còn e thấy vào thời gian mở nến h4 thì tất cả các nến đều đồng màu mà con woodies vẫn ngon nên e k nghĩ tới các chiến thuật khác keke hàng của bác vẫn là ok nhất mà
// MTF Bar's Direction
// © anhnguyen14
//@version=4
study("MTF Bar's Direction")
//Bar Function
Bar_High(res) =>
security(syminfo.tickerid,res,(high-open))
Bar_Low(res) =>
security(syminfo.tickerid,res,(low-open))
Bar_Body(res) =>
security(syminfo.tickerid,res,(close-open))
h0=hline(0)
//Bar M1
M1_High=Bar_High("1")
M1_Low=Bar_Low("1")
M1_Body=Bar_Body("1")
//Bar M5
M5_High=Bar_High("5")
M5_Low=Bar_Low("5")
M5_Body=Bar_Body("5")
//Bar M15
M15_High=Bar_High("15")
M15_Low=Bar_Low("15")
M15_Body=Bar_Body("15")
//Bar M30
M30_High=Bar_High("30")
M30_Low=Bar_Low("30")
M30_Body=Bar_Body("30")
//Bar H1
M60_High=Bar_High("60")
M60_Low=Bar_Low("60")
M60_Body=Bar_Body("60")
//Bar H4
M240_High=Bar_High("240")
M240_Low=Bar_Low("240")
M240_Body=Bar_Body("240")
//Bar Color
wick_col=color.gray
up_col=color.new(color.lime,0)
dn_col=color.new(color.black,0)
body_M1_col=
M1_Body>0?up_col:M1_Body<0?dn_col:color.gray
body_M5_col=
M5_Body>0?up_col:M5_Body<0?dn_col:color.gray
body_M15_col=
M15_Body>0?up_col:M15_Body<0?dn_col:color.gray
body_M30_col=
M30_Body>0?up_col:M30_Body<0?dn_col:color.gray
body_M60_col=
M60_Body>0?up_col:M60_Body<0?dn_col:color.gray
body_M240_col=
M240_Body>0?up_col:M240_Body<0?dn_col:color.gray
y_loc=1.2*max(M1_High, M5_High, M15_High, M30_High, M60_High, M240_High)
//Time Left
// Calculate hours, minutes, and seconds till close
timeLeft = barstate.isrealtime ?
(time_close - timenow) / 1000 :
na
secondsLeft = timeLeft % 60
M1_minutesLeft = 0
M5_minutesLeft = security(syminfo.tickerid,"5",floor((timeLeft % 3600) / 60))
M15_minutesLeft = security(syminfo.tickerid,"15",floor((timeLeft % 3600) / 60))
M30_minutesLeft = security(syminfo.tickerid,"30",floor((timeLeft % 3600) / 60))
M60_minutesLeft = security(syminfo.tickerid,"60",floor((timeLeft % 3600) / 60))
M240_minutesLeft = security(syminfo.tickerid,"240",floor((timeLeft % 3600) / 15))
sig_col=color.new(color.navy,0)
//Plot MTF Bar
M1_location=input(15,title="Bar M1 Location")
plot(M1_High, title="M1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1)
plot(M1_Low, title="M1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M1_location, show_last=1)
plot(M1_Body, title="M1 Body", color=body_M1_col, linewidth=0, style=plot.style_columns, offset=-M1_location, show_last=1)
M1_sigtext="M1<"+tostring(M1_minutesLeft)+":"+tostring(secondsLeft)
label_M1=label.new(bar_index[M1_location], y_loc, text=M1_sigtext, style=label.style_none)
label.delete(label_M1[1])
M5_location=input(12,title="Bar M5 Location")
plot(M5_High, title="M5 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1)
plot(M5_Low, title="M5 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M5_location, show_last=1)
plot(M5_Body, title="M5 Body", color=body_M5_col, linewidth=0, style=plot.style_columns, offset=-M5_location, show_last=1)
M5_sigtext="M5<"+tostring(M5_minutesLeft)+":"+tostring(secondsLeft)
label_M5=label.new(bar_index[M5_location], y_loc, text=M5_sigtext, style=label.style_none)
label.delete(label_M5[1])
M15_location=input(9,title="Bar M15 Location")
plot(M15_High, title="M15 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1)
plot(M15_Low, title="M15 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M15_location, show_last=1)
plot(M15_Body, title="M15 Body", color=body_M15_col, linewidth=0, style=plot.style_columns, offset=-M15_location, show_last=1)
M15_sigtext="M15<"+tostring(M15_minutesLeft)+":"+tostring(secondsLeft)
label_M15=label.new(bar_index[M15_location], y_loc, text=M15_sigtext, style=label.style_none)
label.delete(label_M15[1])
M30_location=input(6,title="Bar M30 Location")
plot(M30_High, title="M30 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1)
plot(M30_Low, title="M30 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M30_location, show_last=1)
plot(M30_Body, title="M30 Body", color=body_M30_col, linewidth=0, style=plot.style_columns, offset=-M30_location, show_last=1)
M30_sigtext="M30<"+tostring(M30_minutesLeft)+":"+tostring(secondsLeft)
label_M30=label.new(bar_index[M30_location], y_loc, text=M30_sigtext, style=label.style_none)
label.delete(label_M30[1])
M60_location=input(3,title="Bar H1 Location")
plot(M60_High, title="H1 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1)
plot(M60_Low, title="H1 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=-M60_location, show_last=1)
plot(M60_Body, title="H1 Body", color=body_M60_col, linewidth=0, style=plot.style_columns, offset=-M60_location, show_last=1)
M60_sigtext="H1<"+tostring(M60_minutesLeft)+":"+tostring(secondsLeft)
label_M60=label.new(bar_index[M60_location], y_loc, text=M60_sigtext, style=label.style_none)
label.delete(label_M60[1])
M240_location=input(0,title="Bar H4 Location")
plot(M240_High, title="H4 High", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1)
plot(M240_Low, title="H4 Low", color=wick_col, linewidth=1, style=plot.style_histogram, offset=M240_location, show_last=1)
plot(M240_Body, title="H4 Body", color=body_M240_col, linewidth=0, style=plot.style_columns, offset=M240_location, show_last=1)
M240_sigtext="H4<"+tostring(M240_minutesLeft)+":"+tostring(secondsLeft)
label_M240=label.new(bar_index[M240_location], y_loc, text=M240_sigtext, style=label.style_none)
label.delete(label_M240[1])
//EOF
We get it, advertisements are annoying!
Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.
Tất cả nội dung trên website này đều vì mục đích cung cấp thông tin và không phải lời khuyên đầu tư.
Tại Việt Nam, giao dịch CFD forex có các rủi ro nhất định, trong đó bao gồm rủi ro về pháp lý. Độc giả nên tìm hiểu kỹ trước khi đưa ra quyết định tham gia.