-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TradingView #2
Comments
This code the es best strategy `// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ //@Version=5 //minutes = input.int(45, title = "Max minutes to exit", minval = 0, maxval = 240) stopPer = input(10, title='Stop Loss %') / 100 //vwap start //plot(close) var float running_ph = na running_ph := running_ph if point_ph if point_pl plot(running_ph, title = 'R', style = plot.style_circles, linewidth = 1,color=color.red, offset = -point_rb) plot(running_pl, title = 'S', style = plot.style_circles, linewidth = 1,color=color.blue,offset = -point_rb) var bool is_strong_buy = false //vwap end // logic buy sell improve start Cto = -0.4 * 0.4 * 0.4 * i6 + c3 * i5 + c4 * i4 + c5 * i3 var bool is_cross_up = false if ta.crossover(ema3, Cto) and barstate.isconfirmed //condition Long & Short short = (close < Cto and close[1] > Cto[1] and close < close[1] or close[1] < Cto[1] and close < close[1] and close [1] > close[2] and close < ema3) and barstate.isconfirmed ? true : false // logic buy sell improvate end rsi = ta.rsi(close, 3) longStop = strategy.position_avg_price * (1 - stopPer) //plot(VWAP, color=color.yellow) ema48 = ta.wma(close, 48) close10 = request.security(symbol=syminfo.tickerid, timeframe="12", expression=close, lookahead=barmerge.lookahead_on) wma10_11 = ta.wma(close, 4) wma10_48 = ta.wma(close, 9) close8 = request.security(symbol=syminfo.tickerid, timeframe="11", expression=close, lookahead=barmerge.lookahead_on) wma8_11 = ta.wma(close, 3) wma8_48 = ta.wma(close, 8) ///////////// up10m = false if close10 > wma_10_11 down8m = false ////logic volume start // Basic Volume Calcs // // BEAR Moving Average Calculation // BEAR Moving Average Calculation // // ma dif // // example vf_absolute = vf_dif > 0 ? vf_dif : vf_dif * (-1) // Volume Spikes // // Color Calcs // ////logic volume end // super trend start f_supertrend() =>
st_tsl = f_supertrend() buy= close >= st_tsl buy_trend = buy1[1] > sell1[1] ? true : false buy2= ta.barssince(sell) // ema cross start oc = math.abs(open[1]-close[1]) is_out_up = false // ema cross end // trend strong start wma48 = ta.wma(close, 48) wma200 = ta.wma(close, 200) crossUpWMA13 = ta.crossover(close, wma13) and barstate.isconfirmed crossUpWMA13_48 = ta.crossover(wma13, wma48) and barstate.isconfirmed var price_wmacrossup_arr = array.new_float() if crossUpWMA48_200 var bool isUpTrend = false if crossUpWMA13 and isUpTrend == false if crossDownWMA13 and isDownTrend == false var int trendUp = 0 if isUpTrend if isDownTrend // clone start bullVolume = bullPower / (bullPower + bearPower) * volume delta = bullVolume - bearVolume deltagood = cvd > cvdMa // clone end // sideway start low1d = request.security(symbol=syminfo.tickerid, timeframe="60", expression=low, lookahead=barmerge.lookahead_on) avg = (close[10] + close[9] + close[8] + close[7] + close[6] +close[5] + close[4] + close[3] + close[2] + close[1])/10 start_long = wma13 > wma48 and wma13 > avg and avg > wma48 and (ta.crossover(wma13, wma48) and close > wma13 and close > wma48 or close > wma13 and ta.crossover(close, wma48) or close > wma48 and ta.crossover(close, wma13) or close[1] > wma13 and ta.crossover(wma13[1], wma200[1])) // sideway end bottomsupport = running_pl and close > running_pl and close > close[1] and rsi > rsi[1] + 8 bigdrop = rsi + 8 < rsi[1] and close > ema48 and running_ph and close < running_ph is_cross_res = ta.crossover(close, running_ph) and close > wma13 and wma13 > wma48 var bool is_long = false longCondition = (buy_trend and up10m and is_cross_res or up10m and buy_trend and (start_long or close*1.05 > wma13 and rsi > rsi[1] + 6 or rsi > rsi[1] + 8 and long or is_cross_up and bottomsupport and is_strong_buy or bottomsupport)) and barstate.isconfirmed not_close_long = up10m and not down8m var int cnt_time_long = 0 if longCondition if is_long shortCondition = down8m and (close*0.94 < wma13 and rsi + 8 < rsi[1] or rsi + 8 < rsi[1] and short or is_br or bigdrop and is_strong_sell) and barstate.isconfirmed var int cnt_time_short = 0 if shortCondition if is_short
//////////// var bool wma13_wma48_up = false if crossUpWMA13_48 if crossDownWMA13_48 if is_short and wma13_wma48_down or wma13 < wma48 and math.abs(wma13-wma48) < 0.008 or down8m if is_long and wma13_wma48_up or wma13 > wma48 and math.abs(wma13-wma48) < 0.005 or wma13 < wma48 and wma13 < wma13[1] sideway_call = wma13 < wma48 and math.abs(wma13-wma48) < 0.005 if up10m and down8m or sideway_call or sideway_put /////////// // close by macd start plotshape(is_cross_macd_short ? low : na, title="Less", style=shape.diamond, location=location.absolute, color=color.yellow, size=size.tiny) //label.new(bar_index, low1d0.999, text=""+str.format("{0}", math.abs(wma13-wma48)), textcolor=color.yellow, style=label.style_triangleup, size=size.tiny) plotshape(down8m ? low1d0.998: na, title="No Short", style=shape.xcross, location=location.absolute, color=color.yellow, size=size.tiny) plotshape(up10m and is_cross_res? low: na, title="Go Strong", style=shape.xcross, location=location.absolute, color=color.orange, size=size.tiny) // close by macd end // exit long when has a short signal and otherwise if not keep_long and is_long and high[2]*1.001 >= running_ph and (high[1] < running_ph and close[1] < running_ph or high[2] > high[1] and high[1] > high) next_short = false if next_short[1] //if minutes > 0 and cnt_time_long > minutes and ta.crossunder(close, wma13) and barstate.isconfirmed if closelong closeshort = (down8m and up10m and wma13 < wma48 and math.abs(wma13-wma48) > 0.01 or not down8m and (hist < 0 and hist > hist[1] or trendUp > 1 or profit_short or bottomsupport and not is_cross_down) or down8m[1] and not down8m) and barstate.isconfirmed next_long = false if next_long[1] //if is_short and low[2]*0.9999 <= running_pl and low[1] > running_pl and close[1] > running_pl and low[3] > low[2] and low[2] < low[1] h = hour(time_close, 'UTC-8') hold_trade = h >= 0 and h < 6 or h == 6 and m <= 30 if longCondition //and not hold_trade // change param rsi + 4 //if minutes > 0 and cnt_time_short > minutes and ta.crossover(close, wma13) and barstate.isconfirmed if closeshort if(strategy.position_size > 0) if(strategy.position_size > 0) |
download all types of premium tradingview indicators codes available on telegram - https://t.me/tradingview_premium_indicator |
When I put it on tradingview it doesnt execute any of the trades, why this happen?
The text was updated successfully, but these errors were encountered: