TradingView
SeaSide420
12 de Out de 2016 19:21

2BAR 

U.S. Dollar/Japanese YenFXCM

Descrição

Counts Bars,
After 2 Bars in same direction Entry on 3rd.
Its looking at 4H bar, but best viewed on 1h chart or less.
Comentários
PauloAMFaria
would it be possible for you to share the code with me?
SeaSide420
@PauloAMFaria,

//@version=2
// SEASIDE420 & ZenTrades
strategy("2BAR", overlay=true, default_qty_type=strategy.percent_of_equity, max_bars_back=720, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0)
longCondition = security(tickerid, '240', close)>security(tickerid, '240', close[1]) and security(tickerid, '240', close[2])>security(tickerid, '240', close[3])
if (longCondition)
strategy.entry("Long",strategy.long)
shortCondition = security(tickerid, '240', close)<security(tickerid, '240', close[1]) and security(tickerid, '240', close[2])<security(tickerid, '240', close[3])
if (shortCondition)
strategy.entry("Short",strategy.short)
slicken
@SeaSide420, code above does not work.. could you convert to pine v5 ?

i dont get this:
longCondition = security(tickerid, '240', close)>security(tickerid, '240', close) and security(tickerid, '240', close)>security(tickerid, '240', close)
=
close > close and close > close ?
raincolle
@slicken, The comment section does not show brackets, so that's why you don't see close > close(1) and close > close(2). Just replace ( ) with brackets, and retain the numerical values in brackets. That should fix it.
raincolle
@SeaSide420, There is something about this code that is inconsistent with your original. The results are different. Is it close > close(1) and close > close(2) for longs and the inverse of the same for shorts or what am I missing? The entries and back testing results differ noticeably.
SeaSide420
@raincolle, I tried to answer but "Message will be shown after moderation." appeared and im sure they will not allow anything i write as its often the truth about TV
SeaSide420
if the person running TV now was running it in 2016, this super simple strategy would not have made it past moderation. I was just experimenting, and sharing. These days i have much better strategies to publish but none make it past moderation. A new Website is coming soon, where i and others can publish their scripts with no moderation. I will share link, in time
Lsnfyds
@SeaSide420, It can't work ah? Is there a (1) or (2) or something for the bar count?
Lsnfyds
@Lsnfyds, oh i see thanks for your work
Mais