Ideas Scripts Chart Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# Vdub FX Sniper VX3 / Strategy

28426 75
Original coding

*Modified signal generator

```//@version=2
//╭╮╱╱╭╮╭╮╱╱╭╮
//┃╰╮╭╯┃┃┃╱╱┃┃
//╰╮┃┃╭┻╯┣╮╭┫╰━┳╮╭┳━━╮
//╱┃╰╯┃╭╮┃┃┃┃╭╮┃┃┃┃━━┫
//╱╰╮╭┫╰╯┃╰╯┃╰╯┃╰╯┣━━┃
//╱╱╰╯╰━━┻━━┻━━┻━━┻━━╯
//╭━━━┳╮╱╱╱╱╱╱╱╭╮
//┃╭━╮┃┃╱╱╱╱╱╱╱┃┃
//┃┃╱╰┫╰━┳━━┳━╮╭━╮╭━━┫┃
//┃┃╱╭┫╭╮┃╭╮┃╭╮┫╭╮┫┃━┫┃
//┃╰━╯┃┃┃┃╭╮┃┃┃┃┃┃┃┃━┫╰╮
//╰━━━┻╯╰┻╯╰┻╯╰┻╯╰┻━━┻━╯
//━╯
// http://www.vdubus.co.uk/
strategy(title='Vdub FX SniperVX3 / Strategy  v3', shorttitle='Vdub_FX_SniperVX3_Strategy', overlay=true, pyramiding=0, initial_capital=1000, currency=currency.USD)

//Candle body resistance Channel-----------------------------//
len = 34
src = input(close, title="Candle body resistance Channel")
out = sma(src, len)
last8h = highest(close, 13)
lastl8 = lowest(close, 13)
bearish = cross(close,out) == 1 and falling(close, 1)
bullish = cross(close,out) == 1 and rising(close, 1)
channel2=input(false, title="Bar Channel On/Off")
ul2=plot(channel2?last8h:last8h==nz(last8h[1])?last8h:na, color=black, linewidth=1, style=linebr, title="Candle body resistance level top", offset=0)
ll2=plot(channel2?lastl8:lastl8==nz(lastl8[1])?lastl8:na, color=black, linewidth=1, style=linebr, title="Candle body resistance level bottom", offset=0)
//fill(ul2, ll2, color=black, transp=95, title="Candle body resistance Channel")

//-----------------Support and Resistance
RST = input(title='Support / Resistance length:', type=integer, defval=10)
RSTT = valuewhen(high >= highest(high, RST), high, 0)
RSTB = valuewhen(low <= lowest(low, RST), low, 0)
RT2 = plot(RSTT, color=RSTT != RSTT[1] ? na : red, linewidth=1, offset=+0)
RB2 = plot(RSTB, color=RSTB != RSTB[1] ? na : green, linewidth=1, offset=0)

//--------------------Trend colour ema------------------------------------------------//
src0 = close, len0 = input(13, minval=1, title="EMA 1")
ema0 = ema(src0, len0)
direction = rising(ema0, 2) ? +1 : falling(ema0, 2) ? -1 : 0
plot_color = direction > 0  ? lime: direction < 0 ? red : na
plot(ema0, title="EMA", style=line, linewidth=1, color = plot_color)

//-------------------- ema 2------------------------------------------------//
src02 = close, len02 = input(21, minval=1, title="EMA 2")
ema02 = ema(src02, len02)
direction2 = rising(ema02, 2) ? +1 : falling(ema02, 2) ? -1 : 0
plot_color2 = direction2 > 0  ? lime: direction2 < 0 ? red : na
plot(ema02, title="EMA Signal 2", style=line, linewidth=1, color = plot_color2)

//=============Hull MA//
show_hma = input(false, title="Display Hull MA Set:")
hma_src = input(close, title="Hull MA's Source:")
hma_base_length = input(8, minval=1, title="Hull MA's Base Length:")
hma_length_scalar = input(5, minval=0, title="Hull MA's Length Scalar:")
hullma(src, length)=>wma(2*wma(src, length/2)-wma(src, length), round(sqrt(length)))
plot(not show_hma ? na : hullma(hma_src, hma_base_length+hma_length_scalar*6), color=black, linewidth=2, title="Hull MA")

//============ signal Generator ==================================//
Piriod=input('720')
ch1 = security(tickerid, Piriod, open)
ch2 = security(tickerid, Piriod, close)
longCondition = crossover(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
if (longCondition)
shortCondition = crossunder(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
if (shortCondition)
strategy.entry("SELL", strategy.short)

///////////////////////////////////////////////////////////////////////////////////////////```
Looks great, is it repainting? Looks almost too good! Anyways I think you should add a stop loss to the strategy ;)
Hausky
I haven't tested this out fully as yet. The signal generated work well together with the Rejection spike strategy integrated into the system

vdubus
If I change the input settings, it does not change anything in the signals... I wanted to have more signals (for stocks), intraday signals, with current settings , there is a signal every few days. Is there a way to make the change of settings work on the strategy signal generating? Thank you.
vdubus
@vdubus,
How do I install this script?
Hausky
Yes, this strategy repaints, same as the popular ANN strategy by Sirolf2009. It uses future data from a higher time frame which vdubus named "signal generator". I was stunned by the performance and looked at the code. The backtest results were too good to be true :)

Besides this issue that the backtest data isn't reliable due to the repainting, I assume that this strategy still performs very good in live trading. Thanks for sharing this strategy with everyone, vdubus!
ChartArt
@ChartArt, Yep. All this strategy does is buy if the close price is higher than the open price, and sell if the close price is lower than the open price. Because of the way Tradingview implements custom timeframes, all the strategy is doing is comparing open/close values that are known at the BEGINNING of the interval, so the results are completely worthless. I wrote my own strategy just like this that gets even better results, it's only 4 lines long lol.
zmm20
Glenn_Guitarist
Hausky
GoodJob!!! Can i see more signals on m5 timeframe?
Evgenich
Have a play with the period time frame currently set at 720. For a m5 id say change it to 240, 120 or even 60 mins
vdubus
Thank you. Good luck
I think it is repainting, cause I just had a long signal, and 1 hour later it is gone :/
Hausky
Hausky
The buy signal is marked with a green arrow, and is now gone as you see
Hausky
the signal generated are a simple cross over, I have noticed it disappearing also,, but it is also my understanding that TV indicators don't exact;y re- paint so my best assumption is the cross over wasn't conclusive. May also help by refreshing the page.
vdubus
They repaint. Always. As soon as you use a higher time-frame you have repainting. Because the MTF close is never known ... until the close. The Tradingview backtest engine can only use the final close of a higher time-frame, where as when using it live it always repaints. I had a great idea for a system last year until I had to learn this repainting made my idea too unreliable in live-trading.
ChartArt
@ChartArt, what is it meant by 'repaint'?
Hausky
Also help if you have another form of indication when building up a case for entry
vdubus
give me template
rishi12
@rishi12, You unscrupulous scammers pumped my money
vdubus
Nice one @vdubus, could you please share this one? :) how can I set this up as well?
The strategy is written in 6 lines of code. the rest is not used. Men disagree is the same as
for period 720
YaroslavG
The signal are inconsistent as with the original indicator that this strategy has been applied to but should give you a basic idea of the performance. Thank you
vdubus
I understand your idea. Thank you!
Repainting
This strategy is invalid. It uses data from the NEXT 12 hours and then it decides to go long if the next 12 hours market will go up, and short if the next 12 hours the market will go down.
If you paint the ch1 and ch2 series you'll understand why some signals disappear and why the statistics are so incredible.
Nice try, but it doesn't work. :-(
doremisolla
yes please don't trade the signal alone without doing you own analysis
doremisolla
Vdubus is this true? It looks very impressive but wasn't aware that signals change in history. Thanks
This is amazing! Keep up the great work!
can you make this into an ea for mt4? or is there anyway to atleast get this indicator on mt4?
please get back to me, i love this thing!!!! fantastic job vdubus
has anyone figured out how to code a strategy that closes a position at the end of everyday?
Zack_The_Lego
PUT THIS 2 LINES AT THE FIRST LINES OF THE CODE
stopalltime=hour
stopmintime=minute

PUT THIS LINE AT THE END OF YOUR CODE:
strategy.close_all(when=stopalltime>14 and stopmintime>50) //no swing command , CHANGE IT TO THE DESIRED TIME (14:50) ...
ZoharCho
@ZoharCho,

Ooooh,.....Did I need that.

Thank you,

Very newbei
Is there any reason why the BUY and SELL markers have stopped drawing properly? Example: http://i.imgur.com/rsD86Nl.png
scarf
Did you set your chart to use percentages?
I have created a ticket about the repainting issue, Please upvote it so that it might actually get fixed: https://getsatisfaction.com/tradingview/topics/strategies-and-indicators-are-repainting
sirolf2009
I have already stated not to trade the signals they are unreliable to trade by themselves. this is not a tradingview issue more the indicator it's self. I have no intention of updating this strategy
vdubus
If you can't trade the signals doesn't that make this an indicator and not a strategy?
your strategy seems working great on 15min crude oil and silver,
its not working on daily,
seems that it works on futures with round the clock trading and
have certain period of hours during the day which have very thin
volume
rcchong
You need to change the Period input from 720 mins to something higher. 720 is 12 hours so won't work properly on a higher timeframe (which is 24 hours, obviously)
Hi my name is repaint.

Piriod=input('720')
ch1 = security(tickerid, Piriod, open)
ch2 = security(tickerid, Piriod, close)
longCondition = crossover(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
if (longCondition)
shortCondition = crossunder(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
if (shortCondition)
strategy.entry("SELL", strategy.short)
UrbiGT
How do I remove and test the strategy without repainting?
Yes, looks great!
VDUBUS a question: the signals appears in realtime (last candle) or upon a past one? In other words: the strategy have some "candle delay?"
morphinestyle
yes please VDUBUS, clarify the way your system repaints. How many candles (or time) after the signal we can consider it definitive?
Hello vdubus. I tried to copy the script and paste it to the pine editor, but it gives me an error message. Please help. Thank you. Eddie122275@gmail.com
EduardoCuevas
It's easier to click the share icon and choose 'Make It Mine': http://i.imgur.com/VelLhUA.png
hi. is this a repaint?
how do i apply this on mt4?
Why the signal is lost
Hi.. do you have the MT4 or 5 version?
This works very accurate in Weekly chart. The only strategy that predicts future level buy or sell level using Zone Analysis.
Anybody with Mr mani pine script should please share it.
My email is jeffumu@yahoo.co.uk
Great script !
I would like to understand how the security is calculated function is calculated. Unfortunatelly the doc doesn't show the implementation (https://www.tradingview.com/study-script-reference/#fun_security). Do you know where I could find more information on how to calculate the security function ?

I would like to make this function in javascript.
Comment removed.
VinobaPrinson
which software u using present mt4 ? or ..
Hi, why does the signal come after 3 bars? what can i do to make it work?
Сможешь объяснить как работать по ней?
Nikolay480909
@Nikolay480909, Не питай излишних иллюзий к скрипту, сигналы перерисовываются.
what the moving averages 9 and 18?
As many other people have said, the strategy is invalid. It uses future data to make trade decisions - i.e. the close value is known at the beginning of the tick to determine the trade for that tick -

longCondition = crossover(security(tickerid, Piriod, close),security(tickerid, Piriod, open))
shortCondition = crossunder(security(tickerid, Piriod, close),security(tickerid, Piriod, open))

So gives no useful data when used realtime, aka repaints
I am new to Trading View.I copied the programme onto Pine but it does not accept it.A message comes up saying try adding @version 2, but this is already on there.Could you please suggest what to do.Thanks.
nosense, too nice to be true. The code use 720 future data in order to decide the position.
fake
https://www.youtube.com/watch?v=l9st2vhD4MU&t=218s some one tell me which script is this video one
VessiBoki169
@VessiBoki169, why don't ask Mr mani of london ? He seems to like stealing peoples scripts and selling them as his own.
vdubus
@vdubus, that why i ask you i don`t want to pay him.Any one know about that please tell me
is there anyway to deal with repaint?
Hi vdubus

Kind Regards
Lucas
WHY would anybody make a strategy, that scammes itself?? I spent 2 days and nights working with this scam... I bet some people even used it for real and lost their money. Wouldnt be surprised if somebody would be calling for a persecution... Now this is the last drop! There is no easy way in trading, back to the real work and I will never use anything made by anybody else than me personally... this sucks, really...
SoulBot
This script is junk. It uses the close of a future 8H bar in the strategy. It is not live, it knows information not available 7 hours in advance for the backtesting. Please understand this. You should immediately question a backtest that looks like that kind of performance.
mortdiggiddy
@mortdiggiddy First of all these lines, with "Period" spelled incorrectly,

Piriod=input('720')
ch1 = security(tickerid, Piriod, open)
ch2 = security(tickerid, Piriod, close) // <----
longCondition = crossover(security(tickerid, Piriod, close),security(tickerid, Piriod, open))

The 3rd line with the arrow, the backtest study will "know" the closing price of the 8HR bar. There are ways around this but this strategy is complete crap. This is similar to that crap ANN Strategy out there. It knows information ahead of time in the back test study, since the close of a previous 8HR bar is known to the database well in advance.
mortdiggiddy
@mortdiggiddy, fully agree. i don't understand why its win rate is 90!!! It should be 100%!! If the pair is going up then it published a signal that 8 Hrs ago you should buy!! just funny but very sad how many likes this strategy appreciates.
Thank you very much.
Regards
<3
You people should know this is too good to be true. LMAO change the version at the top to say //@version=3 and you will see the results instantly become very negative.
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter