study("[blackcat] L3 Super Best Cost Line", overlay=true, max_bars_back=5000, max_labels_count=500)
//functions xrf(values, length) => r_val = float(na) if length >= 1 for i = 0 to length by 1 if na(r_val) or not na(values) r_val := values r_val r_val
//定义典型价格wcx wcx = (2*high + low + high + open/2) / 4.5 //3根K线中最高点 hh = highest(high,3) //3根K线中最低点 ll = lowest(low,3) //高点创新高并且典型价格上涨 ch1 = (hh > xrf(hh,1) and wcx>xrf(wcx,1)) //低点创新低并且典型价格下跌 ch2 = (ll < xrf(ll,1) and wcx<xrf(wcx,1)) //向上突破K线回溯索引值 k3 = barssince(ch1) //向下突破K线回溯索引值 k4 = barssince(ch2) //最近有向上突破或者创新高并且不能有创新低 k5 = (k3<k4 or ch1) and not(ch2) //最近有向下突破或者创新低并且不能有创新高 k6 = (k3>k4 or ch2) and not(ch1) //如果向上突破则取最低价作为退出准则(跟踪止损放飞利润),否则取开始向前期低点(做多止损位) zc = iff(hh>xrf(hh,1) and wcx>xrf(wcx,1),ll,xrf(ll,barssince(hh>xrf(hh,1) and wcx>xrf(wcx,1)))) //如果向下突破则取最高价作为推出准则(跟踪止损放飞利润),否则取开始向前期高点 (做空止损位,A股不需要) yl = iff(ll<xrf(ll,1) and wcx<xrf(wcx,1),hh,xrf(hh,barssince(ll<xrf(ll,1) and wcx<xrf(wcx,1)))) //如果向上突破,则按算法生成止损退出价格 bcl = iff(k5,zc,yl)
long = (crossover(wcx,bcl) and direction < 0) or (direction[1]>0 and direction<0) xlong = crossunder(wcx,bcl) and direction < 0 or (direction[1]<0 and direction>0) short = (crossover(wcx,bcl) and direction > 0) or (direction[1]<0 and direction>0) xshort = crossunder(wcx,bcl) and direction > 0 and not xlong and not long
Avoid losing contact!Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq 防止失联,请立即行动,加入本猫聊天群: discord.com/invite/ZTGpQJq
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.