Tìm cơ hội cược BO với Trend line

Tìm cơ hội cược BO với Trend line

Tìm cơ hội cược BO với Trend line
Alert của con HOD & LOD nếu có anh em nào muốn dùng :D
Mã:
// BO - Asia M5 HOD & LOD Alert
// © inno14
//@version=4
study("BO - Asia M5 HOD & LOD Alert", overlay=true)
//HOD & LOD
hod=high[1]==highest(high,108)
lod=low[1]==lowest(low,108)
plot(ema(close,1440),title="Week's EMA",color=color.lime,linewidth=2)
//Put signal
x1=
       crossover(close,valuewhen(hod,high[1],0))
       and close<ema(close,1440)


//Call signal
y1=
       crossunder(close,valuewhen(lod,low[1],0))
       and close>ema(close,1440)


//Function
xTech=
       x1
     
   

yTech=
       y1
     

//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech?high:na
CallSignal= yTech?low:na
plotshape(PutSignal, title='Put Alert', text="Put Alert", style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(CallSignal, title='Call Alert', text="Call Alert", style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(PutSignal, title='Put Entry', text="Put", style=shape.arrowdown, location=location.abovebar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)
plotshape(CallSignal, title='Call Entry', text="Call", style=shape.arrowup, location=location.belowbar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)

//plot Result
result_put =
       xTech[1] and close<open[0]?1:
       xTech[1] and close>open[0]?-1:
       xTech[1] and close==open[0]?0:
       na
result_call =
       yTech[1] and close>open[0]?1:
       yTech[1] and close<open[0]?-1:
       yTech[1] and close==open[0]?0:
       na

win_trade =
       result_put == 1
       or
       result_call == 1
       ?close:na
loss_trade =
       result_put == -1
       or
       result_call == -1
       ?close:na
draw_trade =
       result_put == 0
       or
       result_call == 0
       ?close:na
plotshape(win_trade, title='Win trade', text="Win trade", style=shape.labeldown, location=location.bottom, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(loss_trade, title='Loss trade', text="Loss trade", style=shape.labeldown, location=location.bottom, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(draw_trade, title='Draw trade', text="Draw trade", style=shape.labeldown, location=location.bottom, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
//Alert
mms1="Signal alert"
mms2="Put alert"
mms3="Call alert"
PutAlert=
       (xTech)
     
CallAlert=
       (yTech)
     

alertcondition(PutAlert or CallAlert, title="Signal alert", message=mms1)
alertcondition(PutAlert, title="Put alert", message=mms2)
alertcondition(CallAlert, title="Call alert", message=mms3)
//EOF
@Trương Nhật bác backtest giúp ae code này với ạ hjhj thanks bác
 
 
@Trương Nhật bác backtest giúp ae code này với ạ hjhj thanks bác
EU: tháng 3 từ ngày 23
upload_2020-5-8_22-2-10.png

UJ:
upload_2020-5-8_22-2-51.png

EJ:
upload_2020-5-8_22-3-16.png
 
 
@vĩnh0902 @Trương Nhật quà mới, bạn Nhật cho cái thống kê 10000 bars thì ngon :D
=== Hiệu suất ===
chrome_2020-05-09_11-05-58.png

=== Alert ===
Mã:
// BO - Extreme Level with Alert
// © inno14
//@version=4
study("BO - Extreme Level with Alert", overlay=true)
//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
      
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
      
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
      
resistance=highest(high[1],extreme_level)
support=lowest(low[1],extreme_level)
res_col=resistance==resistance[1]?color.new(color.navy,0):color.new(color.navy,100)
sup_col=support==support[1]?color.new(color.navy,0):color.new(color.navy,100)
plot(resistance,title="Resistance",color=res_col,linewidth=2)
plot(support,title="Support",color=sup_col,linewidth=2)
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not x1[1]
       and not x1[2]
       and not x1[3]
       and not y1[1]
       and not y1[2]
       and not y1[3]

//Function
xTech=
       x1 and no_orders
      
    

yTech=
       y1  and no_orders
      

//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech?high:na
CallSignal= yTech?low:na
plotshape(PutSignal, title='Put Alert', text="Put Alert", style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(CallSignal, title='Call Alert', text="Call Alert", style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(PutSignal, title='Put Entry', text="Put 3 bars", style=shape.arrowdown, location=location.abovebar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)
plotshape(CallSignal, title='Call Entry', text="Call 3 bars", style=shape.arrowup, location=location.belowbar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)

//plot Result
result_put =
       xTech[3] and close<open[2]?1:
       xTech[3] and close>open[2]?-1:
       xTech[3] and close>open[2]?0:
       na
result_call =
       yTech[3] and close>open[2]?1:
       yTech[3] and close<open[2]?-1:
       yTech[3] and close<open[2]?0:
       na

win_trade =
       result_put == 1
       or
       result_call == 1
       ?close:na
loss_trade =
       result_put == -1
       or
       result_call == -1
       ?close:na
draw_trade =
       result_put == 0
       or
       result_call == 0
       ?close:na 
plotshape(win_trade, title='Win trade', text="Win trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(loss_trade, title='Loss trade', text="Loss trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(draw_trade, title='Draw trade', text="Draw trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
//Alert
mms1="Signal alert"
mms2="Put alert"
mms3="Call alert"
PutAlert=
       (xTech)
      
CallAlert=
       (yTech)
      

alertcondition(PutAlert or CallAlert, title="Signal alert", message=mms1)
alertcondition(PutAlert, title="Put alert", message=mms2)
alertcondition(CallAlert, title="Call alert", message=mms3)
//EOF
=== Backtest ===
Mã:
// BO - Extreme Level
// © inno14
//@version=4
strategy("BO - Extreme Level")
// === INPUT PERIOD OF TIME ===
Date   = input(true, title = "=== Date Option ===")
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 5, 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 = 7, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM   = input(defval = 16, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 0, 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.white : na:na, title="Trading Time", transp=0)
hlinep200=hline(200)
hlinem200=hline(-200)

//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
      
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
      
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
      
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not strategy.opentrades

//Function
xTech=
       (x1
       and no_orders)
      

yTech=
       (y1
       and no_orders)
      

sumtrades=strategy.losstrades[0]+strategy.wintrades[0]
losstrades=strategy.losstrades[0]
wintrades=strategy.wintrades[0]
//Fibonacci Money Management
fibo_tt=input(true,title="=== Fibonacci Money Management ===")
take_profit=input(300,title="Take profit = wintrades - losstrades =")
//Bid level
current_bid_lv=
       losstrades == 0 and wintrades == 0?1:
       losstrades-wintrades == -1?1:
       losstrades>0 and (losstrades-wintrades == 0)?2:
       losstrades-wintrades == 1?3:
       losstrades-wintrades == 2?5:
       losstrades-wintrades == 3?8:
       losstrades-wintrades == 4?13:
       losstrades-wintrades == 5?21:
       losstrades-wintrades == 6?34:
       1
bid_level=current_bid_lv
take_profit_val = wintrades - losstrades
//Plot Analyzing Signals
//hline1=hline(-1.2*300)
hline2=hline(-1.6*300)
hline0=hline(0)
sigtext=
       xTech?"Put signal"+ " * Current Bid Level: " + tostring(bid_level):yTech?"Call signal"+ " * Current Bid Level: " + tostring(bid_level):
       "Backtesting From date: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)
       + " To date: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
       + " * From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
       + " * Take profit: " + tostring(wintrades-losstrades)+"/"+tostring(take_profit)
       + " * Bid Level: " + tostring(bid_level)
      
      

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 Color Panel of Finobacci Money Management
fib_sigtext=
       "Color Panel of Finobacci Money Management"
      
fib_sig_col=color.new(color.navy,10)
label_fib_sig_text = label.new(bar_index[5], 250, text=fib_sigtext, style=label.style_none, textcolor=fib_sig_col, size=size.large)
label.delete(label_fib_sig_text[1])
fib_put=50
fib_col=-150

fib_put_lv1=color.new(color.red,0)
plotshape(fib_put, title='Put Lv1', text="Put Lv1", style=shape.circle, location=location.absolute, color=fib_put_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)
fib_call_lv1=color.new(color.blue,0)
plotshape(fib_col, title='Call Lv1', text="Call Lv1", style=shape.circle, location=location.absolute, color=fib_call_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)

fib_put_lv2=color.new(color.red,10)
plotshape(fib_put, title='Put Lv2', text="Put Lv2", style=shape.circle, location=location.absolute, color=fib_put_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)
fib_call_lv2=color.new(color.blue,10)
plotshape(fib_col, title='Call Lv2', text="Call Lv2", style=shape.circle, location=location.absolute, color=fib_call_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)

fib_put_lv3=color.new(color.orange,0)
plotshape(fib_put, title='Put Lv3', text="Put Lv3", style=shape.circle, location=location.absolute, color=fib_put_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)
fib_call_lv3=color.new(color.green,0)
plotshape(fib_col, title='Call Lv3', text="Call Lv3", style=shape.circle, location=location.absolute, color=fib_call_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)

fib_put_lv5=color.new(color.orange,10)
plotshape(fib_put, title='Put Lv5', text="Put Lv5", style=shape.circle, location=location.absolute, color=fib_put_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)
fib_call_lv5=color.new(color.green,10)
plotshape(fib_col, title='Call Lv5', text="Call Lv5", style=shape.circle, location=location.absolute, color=fib_call_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)

fib_put_lv8=color.new(color.maroon,0)
plotshape(fib_put, title='Put Lv8', text="Put Lv8", style=shape.circle, location=location.absolute, color=fib_put_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)
fib_call_lv8=color.new(color.lime,0)
plotshape(fib_col, title='Call Lv8', text="Call Lv8", style=shape.circle, location=location.absolute, color=fib_call_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)

fib_put_lv13=color.new(color.maroon,10)
plotshape(fib_put, title='Put Lv13', text="Put Lv13", style=shape.circle, location=location.absolute, color=fib_put_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)
fib_call_lv13=color.new(color.lime,10)
plotshape(fib_col, title='Call Lv13', text="Call Lv13", style=shape.circle, location=location.absolute, color=fib_call_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)

fib_put_lv21=color.new(color.olive,0)
plotshape(fib_put, title='Put Lv21', text="Put Lv21", style=shape.circle, location=location.absolute, color=fib_put_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)
fib_call_lv21=color.new(color.yellow,0)
plotshape(fib_col, title='Call Lv21', text="Call Lv21", style=shape.circle, location=location.absolute, color=fib_call_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)

fib_put_lv34=color.new(color.olive,10)
plotshape(fib_put, title='Put Lv34', text="Put Lv34", style=shape.circle, location=location.absolute, color=fib_put_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
fib_call_lv34=color.new(color.yellow,10)
plotshape(fib_col, title='Call Lv34', text="Call Lv34", style=shape.circle, location=location.absolute, color=fib_call_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
//plot Signal
PutSignal= xTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
CallSignal= yTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
putcol =
       PutSignal ?
       bid_level==1? color.new(color.red,0):
       bid_level==2? color.new(color.red,10):
       bid_level==3? color.new(color.orange,0):
       bid_level==5? color.new(color.orange,10):
       bid_level==8? color.new(color.maroon,0):
       bid_level==13? color.new(color.maroon,10):
       bid_level==21? color.new(color.olive,0):
       bid_level==34? color.new(color.olive,10):
       color.new(color.red,0): na
callcol =
       CallSignal ?
       bid_level==1? color.new(color.blue,0):
       bid_level==2? color.new(color.blue,10):
       bid_level==3? color.new(color.green,0):
       bid_level==5? color.new(color.green,10):
       bid_level==8? color.new(color.lime,0):
       bid_level==13? color.new(color.lime,10):
       bid_level==21? color.new(color.yellow,0):
       bid_level==34? color.new(color.yellow,10):
       color.new(color.blue,0): na
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=putcol, textcolor=color.black, offset=1, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=callcol, textcolor=color.black, offset=1, size=size.large)

//Backtesting
exp_tt=input(true,"Expiry Option By Bars")
exp_val=input(3,"Number of Bars")
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.close_all(when=exp_val==1?barstate.isnew:barssince(xTech)==exp_val or exp_val==1?barstate.isnew:barssince(yTech)==exp_val)
//strategy.close_all(when=barstate.isnew)
//EOF
 
 
Chỉnh sửa lần cuối:
@vĩnh0902 @Trương Nhật quà mới, bạn Nhật cho cái thống kê 10000 bars thì ngon :D
=== Hiệu suất ===
chrome_2020-05-09_11-05-58.png

=== Alert ===
Mã:
// BO - Extreme Level with Alert
// © inno14
//@version=4
study("BO - Extreme Level with Alert", overlay=true)
//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
     
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
     
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
     
resistance=highest(high[1],extreme_level)
support=lowest(low[1],extreme_level)
res_col=resistance==resistance[1]?color.new(color.navy,0):color.new(color.navy,100)
sup_col=support==support[1]?color.new(color.navy,0):color.new(color.navy,100)
plot(resistance,title="Resistance",color=res_col,linewidth=2)
plot(support,title="Support",color=sup_col,linewidth=2)
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not x1[1]
       and not x1[2]
       and not x1[3]
       and not y1[1]
       and not y1[2]
       and not y1[3]

//Function
xTech=
       x1 and no_orders
     
   

yTech=
       y1  and no_orders
     

//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech?high:na
CallSignal= yTech?low:na
plotshape(PutSignal, title='Put Alert', text="Put Alert", style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(CallSignal, title='Call Alert', text="Call Alert", style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(PutSignal, title='Put Entry', text="Put 3 bars", style=shape.arrowdown, location=location.abovebar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)
plotshape(CallSignal, title='Call Entry', text="Call 3 bars", style=shape.arrowup, location=location.belowbar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)

//plot Result
result_put =
       xTech[3] and close<open[2]?1:
       xTech[3] and close>open[2]?-1:
       xTech[3] and close>open[2]?0:
       na
result_call =
       yTech[3] and close>open[2]?1:
       yTech[3] and close<open[2]?-1:
       yTech[3] and close<open[2]?0:
       na

win_trade =
       result_put == 1
       or
       result_call == 1
       ?close:na
loss_trade =
       result_put == -1
       or
       result_call == -1
       ?close:na
draw_trade =
       result_put == 0
       or
       result_call == 0
       ?close:na
plotshape(win_trade, title='Win trade', text="Win trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(loss_trade, title='Loss trade', text="Loss trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(draw_trade, title='Draw trade', text="Draw trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
//Alert
mms1="Signal alert"
mms2="Put alert"
mms3="Call alert"
PutAlert=
       (xTech)
     
CallAlert=
       (yTech)
     

alertcondition(PutAlert or CallAlert, title="Signal alert", message=mms1)
alertcondition(PutAlert, title="Put alert", message=mms2)
alertcondition(CallAlert, title="Call alert", message=mms3)
//EOF
=== Backtest ===
Mã:
// BO - Extreme Level
// © inno14
//@version=4
strategy("BO - Extreme Level")
// === INPUT PERIOD OF TIME ===
Date   = input(true, title = "=== Date Option ===")
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 5, 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 = 7, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM   = input(defval = 16, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 0, 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.white : na:na, title="Trading Time", transp=0)
hlinep200=hline(200)
hlinem200=hline(-200)

//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
     
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
     
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
     
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not strategy.opentrades

//Function
xTech=
       (x1
       and no_orders)
     

yTech=
       (y1
       and no_orders)
     

sumtrades=strategy.losstrades[0]+strategy.wintrades[0]
losstrades=strategy.losstrades[0]
wintrades=strategy.wintrades[0]
//Fibonacci Money Management
fibo_tt=input(true,title="=== Fibonacci Money Management ===")
take_profit=input(300,title="Take profit = wintrades - losstrades =")
//Bid level
current_bid_lv=
       losstrades == 0 and wintrades == 0?1:
       losstrades-wintrades == -1?1:
       losstrades>0 and (losstrades-wintrades == 0)?2:
       losstrades-wintrades == 1?3:
       losstrades-wintrades == 2?5:
       losstrades-wintrades == 3?8:
       losstrades-wintrades == 4?13:
       losstrades-wintrades == 5?21:
       losstrades-wintrades == 6?34:
       1
bid_level=current_bid_lv
take_profit_val = wintrades - losstrades
//Plot Analyzing Signals
//hline1=hline(-1.2*300)
hline2=hline(-1.6*300)
hline0=hline(0)
sigtext=
       xTech?"Put signal"+ " * Current Bid Level: " + tostring(bid_level):yTech?"Call signal"+ " * Current Bid Level: " + tostring(bid_level):
       "Backtesting From date: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)
       + " To date: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
       + " * From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
       + " * Take profit: " + tostring(wintrades-losstrades)+"/"+tostring(take_profit)
       + " * Bid Level: " + tostring(bid_level)
     
     

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 Color Panel of Finobacci Money Management
fib_sigtext=
       "Color Panel of Finobacci Money Management"
     
fib_sig_col=color.new(color.navy,10)
label_fib_sig_text = label.new(bar_index[5], 250, text=fib_sigtext, style=label.style_none, textcolor=fib_sig_col, size=size.large)
label.delete(label_fib_sig_text[1])
fib_put=50
fib_col=-150

fib_put_lv1=color.new(color.red,0)
plotshape(fib_put, title='Put Lv1', text="Put Lv1", style=shape.circle, location=location.absolute, color=fib_put_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)
fib_call_lv1=color.new(color.blue,0)
plotshape(fib_col, title='Call Lv1', text="Call Lv1", style=shape.circle, location=location.absolute, color=fib_call_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)

fib_put_lv2=color.new(color.red,10)
plotshape(fib_put, title='Put Lv2', text="Put Lv2", style=shape.circle, location=location.absolute, color=fib_put_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)
fib_call_lv2=color.new(color.blue,10)
plotshape(fib_col, title='Call Lv2', text="Call Lv2", style=shape.circle, location=location.absolute, color=fib_call_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)

fib_put_lv3=color.new(color.orange,0)
plotshape(fib_put, title='Put Lv3', text="Put Lv3", style=shape.circle, location=location.absolute, color=fib_put_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)
fib_call_lv3=color.new(color.green,0)
plotshape(fib_col, title='Call Lv3', text="Call Lv3", style=shape.circle, location=location.absolute, color=fib_call_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)

fib_put_lv5=color.new(color.orange,10)
plotshape(fib_put, title='Put Lv5', text="Put Lv5", style=shape.circle, location=location.absolute, color=fib_put_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)
fib_call_lv5=color.new(color.green,10)
plotshape(fib_col, title='Call Lv5', text="Call Lv5", style=shape.circle, location=location.absolute, color=fib_call_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)

fib_put_lv8=color.new(color.maroon,0)
plotshape(fib_put, title='Put Lv8', text="Put Lv8", style=shape.circle, location=location.absolute, color=fib_put_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)
fib_call_lv8=color.new(color.lime,0)
plotshape(fib_col, title='Call Lv8', text="Call Lv8", style=shape.circle, location=location.absolute, color=fib_call_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)

fib_put_lv13=color.new(color.maroon,10)
plotshape(fib_put, title='Put Lv13', text="Put Lv13", style=shape.circle, location=location.absolute, color=fib_put_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)
fib_call_lv13=color.new(color.lime,10)
plotshape(fib_col, title='Call Lv13', text="Call Lv13", style=shape.circle, location=location.absolute, color=fib_call_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)

fib_put_lv21=color.new(color.olive,0)
plotshape(fib_put, title='Put Lv21', text="Put Lv21", style=shape.circle, location=location.absolute, color=fib_put_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)
fib_call_lv21=color.new(color.yellow,0)
plotshape(fib_col, title='Call Lv21', text="Call Lv21", style=shape.circle, location=location.absolute, color=fib_call_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)

fib_put_lv34=color.new(color.olive,10)
plotshape(fib_put, title='Put Lv34', text="Put Lv34", style=shape.circle, location=location.absolute, color=fib_put_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
fib_call_lv34=color.new(color.yellow,10)
plotshape(fib_col, title='Call Lv34', text="Call Lv34", style=shape.circle, location=location.absolute, color=fib_call_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
//plot Signal
PutSignal= xTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
CallSignal= yTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
putcol =
       PutSignal ?
       bid_level==1? color.new(color.red,0):
       bid_level==2? color.new(color.red,10):
       bid_level==3? color.new(color.orange,0):
       bid_level==5? color.new(color.orange,10):
       bid_level==8? color.new(color.maroon,0):
       bid_level==13? color.new(color.maroon,10):
       bid_level==21? color.new(color.olive,0):
       bid_level==34? color.new(color.olive,10):
       color.new(color.red,0): na
callcol =
       CallSignal ?
       bid_level==1? color.new(color.blue,0):
       bid_level==2? color.new(color.blue,10):
       bid_level==3? color.new(color.green,0):
       bid_level==5? color.new(color.green,10):
       bid_level==8? color.new(color.lime,0):
       bid_level==13? color.new(color.lime,10):
       bid_level==21? color.new(color.yellow,0):
       bid_level==34? color.new(color.yellow,10):
       color.new(color.blue,0): na
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=putcol, textcolor=color.black, offset=1, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=callcol, textcolor=color.black, offset=1, size=size.large)

//Backtesting
exp_tt=input(true,"Expiry Option By Bars")
exp_val=input(3,"Number of Bars")
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.close_all(when=exp_val==1?barstate.isnew:barssince(xTech)==exp_val or exp_val==1?barstate.isnew:barssince(yTech)==exp_val)
//strategy.close_all(when=barstate.isnew)
//EOF
hom nay bac trade code nay a bac
 
 
@vĩnh0902 @Trương Nhật quà mới, bạn Nhật cho cái thống kê 10000 bars thì ngon :D
=== Hiệu suất ===
chrome_2020-05-09_11-05-58.png

=== Alert ===
Mã:
// BO - Extreme Level with Alert
// © inno14
//@version=4
study("BO - Extreme Level with Alert", overlay=true)
//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
     
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
     
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
     
resistance=highest(high[1],extreme_level)
support=lowest(low[1],extreme_level)
res_col=resistance==resistance[1]?color.new(color.navy,0):color.new(color.navy,100)
sup_col=support==support[1]?color.new(color.navy,0):color.new(color.navy,100)
plot(resistance,title="Resistance",color=res_col,linewidth=2)
plot(support,title="Support",color=sup_col,linewidth=2)
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not x1[1]
       and not x1[2]
       and not x1[3]
       and not y1[1]
       and not y1[2]
       and not y1[3]

//Function
xTech=
       x1 and no_orders
     
   

yTech=
       y1  and no_orders
     

//plot Signal
putcol = xTech? color.red : na
callcol = yTech? color.blue : na
PutSignal= xTech?high:na
CallSignal= yTech?low:na
plotshape(PutSignal, title='Put Alert', text="Put Alert", style=shape.labeldown, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(CallSignal, title='Call Alert', text="Call Alert", style=shape.labelup, location=location.absolute, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(PutSignal, title='Put Entry', text="Put 3 bars", style=shape.arrowdown, location=location.abovebar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)
plotshape(CallSignal, title='Call Entry', text="Call 3 bars", style=shape.arrowup, location=location.belowbar, color=color.aqua, textcolor=color.black, offset=1, transp=2, size=size.large)

//plot Result
result_put =
       xTech[3] and close<open[2]?1:
       xTech[3] and close>open[2]?-1:
       xTech[3] and close>open[2]?0:
       na
result_call =
       yTech[3] and close>open[2]?1:
       yTech[3] and close<open[2]?-1:
       yTech[3] and close<open[2]?0:
       na

win_trade =
       result_put == 1
       or
       result_call == 1
       ?close:na
loss_trade =
       result_put == -1
       or
       result_call == -1
       ?close:na
draw_trade =
       result_put == 0
       or
       result_call == 0
       ?close:na
plotshape(win_trade, title='Win trade', text="Win trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(loss_trade, title='Loss trade', text="Loss trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
plotshape(draw_trade, title='Draw trade', text="Draw trade", style=shape.labeldown, location=location.abovebar, color=color.yellow, textcolor=color.new(color.black,0), offset=0, transp=5, size=size.tiny)
//Alert
mms1="Signal alert"
mms2="Put alert"
mms3="Call alert"
PutAlert=
       (xTech)
     
CallAlert=
       (yTech)
     

alertcondition(PutAlert or CallAlert, title="Signal alert", message=mms1)
alertcondition(PutAlert, title="Put alert", message=mms2)
alertcondition(CallAlert, title="Call alert", message=mms3)
//EOF
=== Backtest ===
Mã:
// BO - Extreme Level
// © inno14
//@version=4
strategy("BO - Extreme Level")
// === INPUT PERIOD OF TIME ===
Date   = input(true, title = "=== Date Option ===")
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromMonth = input(defval = 5, 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 = 7, title = "From Hour", minval = 00, maxval = 23)
FromMinuteDvM = input(defval = 00, title = "From Minute", minval = 00, maxval = 59)
ToHourDvM   = input(defval = 16, title = "To Hour", minval = 00, maxval = 23)
ToMinuteDvM = input(defval = 0, 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.white : na:na, title="Trading Time", transp=0)
hlinep200=hline(200)
hlinem200=hline(-200)

//Extreme
extreme_level=input(72,title="Extreme level")
//Trend
d_high1=security(syminfo.tickerid, "D", high[1])
d_low1=security(syminfo.tickerid, "D", low[1])
d_high2=security(syminfo.tickerid, "D", high[2])
d_low2=security(syminfo.tickerid, "D", low[2])

uptrend=
       d_high1>d_high2
       and d_low1>d_low2
     
dntrend=
       d_high1<d_high2
       and d_low1<d_low2
     
toprev1=
       crossover(close,highest(high[1],extreme_level))

botrev1=
       crossunder(close,lowest(low[1],extreme_level))
     
//Put signal
x1=
       dntrend?toprev1:
       na

//Call signal
y1=
       uptrend?botrev1:
       na


no_orders =
       not strategy.opentrades

//Function
xTech=
       (x1
       and no_orders)
     

yTech=
       (y1
       and no_orders)
     

sumtrades=strategy.losstrades[0]+strategy.wintrades[0]
losstrades=strategy.losstrades[0]
wintrades=strategy.wintrades[0]
//Fibonacci Money Management
fibo_tt=input(true,title="=== Fibonacci Money Management ===")
take_profit=input(300,title="Take profit = wintrades - losstrades =")
//Bid level
current_bid_lv=
       losstrades == 0 and wintrades == 0?1:
       losstrades-wintrades == -1?1:
       losstrades>0 and (losstrades-wintrades == 0)?2:
       losstrades-wintrades == 1?3:
       losstrades-wintrades == 2?5:
       losstrades-wintrades == 3?8:
       losstrades-wintrades == 4?13:
       losstrades-wintrades == 5?21:
       losstrades-wintrades == 6?34:
       1
bid_level=current_bid_lv
take_profit_val = wintrades - losstrades
//Plot Analyzing Signals
//hline1=hline(-1.2*300)
hline2=hline(-1.6*300)
hline0=hline(0)
sigtext=
       xTech?"Put signal"+ " * Current Bid Level: " + tostring(bid_level):yTech?"Call signal"+ " * Current Bid Level: " + tostring(bid_level):
       "Backtesting From date: "+tostring(FromDay)+"/"+tostring(FromMonth)+"/"+tostring(FromYear)
       + " To date: "+tostring(ToDay)+"/"+tostring(ToMonth)+"/"+tostring(ToYear)
       + " * From: "+tostring(FromHourDvM)+":"+tostring(FromMinuteDvM)+" To "+tostring(ToHourDvM)+":"+tostring(ToMinuteDvM)
       + " * Take profit: " + tostring(wintrades-losstrades)+"/"+tostring(take_profit)
       + " * Bid Level: " + tostring(bid_level)
     
     

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 Color Panel of Finobacci Money Management
fib_sigtext=
       "Color Panel of Finobacci Money Management"
     
fib_sig_col=color.new(color.navy,10)
label_fib_sig_text = label.new(bar_index[5], 250, text=fib_sigtext, style=label.style_none, textcolor=fib_sig_col, size=size.large)
label.delete(label_fib_sig_text[1])
fib_put=50
fib_col=-150

fib_put_lv1=color.new(color.red,0)
plotshape(fib_put, title='Put Lv1', text="Put Lv1", style=shape.circle, location=location.absolute, color=fib_put_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)
fib_call_lv1=color.new(color.blue,0)
plotshape(fib_col, title='Call Lv1', text="Call Lv1", style=shape.circle, location=location.absolute, color=fib_call_lv1, textcolor=color.black, offset=-9, size=size.normal, show_last=2)

fib_put_lv2=color.new(color.red,10)
plotshape(fib_put, title='Put Lv2', text="Put Lv2", style=shape.circle, location=location.absolute, color=fib_put_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)
fib_call_lv2=color.new(color.blue,10)
plotshape(fib_col, title='Call Lv2', text="Call Lv2", style=shape.circle, location=location.absolute, color=fib_call_lv2, textcolor=color.black, offset=-8, size=size.normal, show_last=2)

fib_put_lv3=color.new(color.orange,0)
plotshape(fib_put, title='Put Lv3', text="Put Lv3", style=shape.circle, location=location.absolute, color=fib_put_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)
fib_call_lv3=color.new(color.green,0)
plotshape(fib_col, title='Call Lv3', text="Call Lv3", style=shape.circle, location=location.absolute, color=fib_call_lv3, textcolor=color.black, offset=-7, size=size.normal, show_last=2)

fib_put_lv5=color.new(color.orange,10)
plotshape(fib_put, title='Put Lv5', text="Put Lv5", style=shape.circle, location=location.absolute, color=fib_put_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)
fib_call_lv5=color.new(color.green,10)
plotshape(fib_col, title='Call Lv5', text="Call Lv5", style=shape.circle, location=location.absolute, color=fib_call_lv5, textcolor=color.black, offset=-6, size=size.normal, show_last=2)

fib_put_lv8=color.new(color.maroon,0)
plotshape(fib_put, title='Put Lv8', text="Put Lv8", style=shape.circle, location=location.absolute, color=fib_put_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)
fib_call_lv8=color.new(color.lime,0)
plotshape(fib_col, title='Call Lv8', text="Call Lv8", style=shape.circle, location=location.absolute, color=fib_call_lv8, textcolor=color.black, offset=-5, size=size.normal, show_last=2)

fib_put_lv13=color.new(color.maroon,10)
plotshape(fib_put, title='Put Lv13', text="Put Lv13", style=shape.circle, location=location.absolute, color=fib_put_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)
fib_call_lv13=color.new(color.lime,10)
plotshape(fib_col, title='Call Lv13', text="Call Lv13", style=shape.circle, location=location.absolute, color=fib_call_lv13, textcolor=color.black, offset=-4, size=size.normal, show_last=2)

fib_put_lv21=color.new(color.olive,0)
plotshape(fib_put, title='Put Lv21', text="Put Lv21", style=shape.circle, location=location.absolute, color=fib_put_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)
fib_call_lv21=color.new(color.yellow,0)
plotshape(fib_col, title='Call Lv21', text="Call Lv21", style=shape.circle, location=location.absolute, color=fib_call_lv21, textcolor=color.black, offset=-3, size=size.normal, show_last=2)

fib_put_lv34=color.new(color.olive,10)
plotshape(fib_put, title='Put Lv34', text="Put Lv34", style=shape.circle, location=location.absolute, color=fib_put_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
fib_call_lv34=color.new(color.yellow,10)
plotshape(fib_col, title='Call Lv34', text="Call Lv34", style=shape.circle, location=location.absolute, color=fib_call_lv34, textcolor=color.black, offset=-2, size=size.normal, show_last=2)
//plot Signal
PutSignal= xTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
CallSignal= yTech and window() and t0_DvM and take_profit_val<take_profit?-1.2*300:na
putcol =
       PutSignal ?
       bid_level==1? color.new(color.red,0):
       bid_level==2? color.new(color.red,10):
       bid_level==3? color.new(color.orange,0):
       bid_level==5? color.new(color.orange,10):
       bid_level==8? color.new(color.maroon,0):
       bid_level==13? color.new(color.maroon,10):
       bid_level==21? color.new(color.olive,0):
       bid_level==34? color.new(color.olive,10):
       color.new(color.red,0): na
callcol =
       CallSignal ?
       bid_level==1? color.new(color.blue,0):
       bid_level==2? color.new(color.blue,10):
       bid_level==3? color.new(color.green,0):
       bid_level==5? color.new(color.green,10):
       bid_level==8? color.new(color.lime,0):
       bid_level==13? color.new(color.lime,10):
       bid_level==21? color.new(color.yellow,0):
       bid_level==34? color.new(color.yellow,10):
       color.new(color.blue,0): na
plotshape(PutSignal, title='Put', text="Put", style=shape.circle, location=location.absolute, color=putcol, textcolor=color.black, offset=1, size=size.large)
plotshape(CallSignal, title='Call', text="Call", style=shape.circle, location=location.absolute, color=callcol, textcolor=color.black, offset=1, size=size.large)

//Backtesting
exp_tt=input(true,"Expiry Option By Bars")
exp_val=input(3,"Number of Bars")
strategy.entry("Call", strategy.long, when=yTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.entry("Put", strategy.short, when=xTech and window() and t0_DvM and take_profit_val<take_profit)
strategy.close_all(when=exp_val==1?barstate.isnew:barssince(xTech)==exp_val or exp_val==1?barstate.isnew:barssince(yTech)==exp_val)
//strategy.close_all(when=barstate.isnew)
//EOF
10k bar á bác
upload_2020-5-11_9-6-16.png
 
 
10k bar á bác
upload_2020-5-11_9-6-16.png
Cảm ơn bạn Nhật nha, con này còn thêm 1 vấn đề là xác định extreme level mỗi ngày nữa mới hoàn thiện đc chiến lược, extreme level có định chỉ để tham khảo thui, mà phần chọn extreme level mỗi ngày mình vẫn chưa có ý tưởng nào hay, nên hiện tại cứ chạy theo hiệu suất của ngày hôm trước :)
 
 
giống cái setup kiệt sức của hubba kiệt sức trong barry ý bác
Thì tất cả các chiêu BO của mình đều bị ảnh hưởng bởi hubba mà, con extreme này dùng đỉnh đáy 2 ngày qua khứ gần nhất để xác định trend. Uptrend là đỉnh>đỉnh, đáy>đáy, Dntrend là đỉnh<đỉnh, đáy<đáy. Sau đó giả định ngày hôm nay vẫn còn động lượng sót lại của quá khứ do hiệu ứng fomo. Cược theo xu hướng quá khứ tại các cản mạnh :D
 
 

BÌNH LUẬN MỚI NHẤT

AdBlock Detected

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.

Back
Bên trên

Miễn trừ trách nhiệm

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.