vDr78

--vdr 1min Open-Close v1.2 (Long-Short-Edition)

1797 vues
193
1797 4
New features:
- only longs or only shorts
- using stoploss
Supprimer des scripts favoris Ajouter aux scripts favoris
//@version=2
strategy("--vdr 1min Open-Close v1.2 (Long-Short-Edition)", overlay=true, calc_on_every_tick=true, calc_on_order_fills=true)

//GER30->1MIN->3.46;5MIN->4.43(1.94);1h->11.09(4.24)
//1 Min 3.82- Very good, 4.53, 9.96; 5 Min->14.96: 5MIN-> 6.36(2.54)
// find out the offset for S&P and Dow Jones as well. for USOIL 0.201

//DJ 1MIN:7.6/0.6 15MIN 11.5/0.1

offset = input(6.47, minval=0.01, step=0.1)
offset_to_close = input(0.01, minval=0.001, step=0.1)


showLongs   = input(title="Show longs", type=bool, defval=true)
showShorts  = input(title="Show shorts", type=bool, defval=true)
useStopLoss = input(title="Use Stop Losses", type=bool, defval=false)
sl = input(24, minval=0.0, step=1)


from_year=input(2016, minval=2000, maxval=2020)
from_month=input(3, minval=1, maxval=12)
from_day=input(1, minval=1, maxval=31)

to_year=input(2016, minval=2007, maxval=2020)
to_month=input(12, minval=1, maxval=12)
to_day=input(31, minval=1, maxval=31)

in_time()=> (time >= (timestamp(from_year, from_month, from_day, 00, 00)) and time < (timestamp(to_year, to_month, to_day, 00, 00)))

//Choose your close condition :)
closeLongV1  = (open-close)>offset_to_close or (close-open)<offset_to_close
closeLongV2  = (open-close)>offset_to_close and (open-low)>(high-close)
closeLongV3  = (open-close)>0 or (close-open)<offset_to_close

closeShortV1 = (close-open)>offset_to_close or (open-close) <offset_to_close
closeShortV2 = (close-open)>offset_to_close and (close-low)>(high-open)
closeShortV3 = (close-open)>0 or (open-close) <offset_to_close

closeLongV4  = (open-close)>offset_to_close
closeShortV4 = (close-open)>offset_to_close

openLong = in_time() and (close-open)>offset
openShort= in_time() and (open-close)>offset

if(showLongs)
    strategy.entry("LONG", strategy.long, when= openLong)
    strategy.close("LONG",  when = closeLongV4 and not openShort)
    strategy.exit("xL", from_entry="LONG",  loss=sl, when = useStopLoss)
if(showShorts)
    strategy.entry("SHORT", strategy.short, when =openShort)
    strategy.close("SHORT", when = closeShortV4 and not openLong)
    strategy.exit("xS", from_entry="SHORT",  loss=sl, when = useStopLoss)

Hello, I'm getting a no data result, could some please assist me?
Répondre
Does that work on a real account? Is there a forward test?
+2 Répondre
Very nice work!
+1 Répondre
Accueil Filtre d'actions Filtre Forex Filtre Crypto Calendrier économique Comment ça marche Caractéristiques du graphique Prix Règles de conduite Modérateurs Solutions site web & courtier Widgets Solutions de cartographie Centre d'aide Demande de fonctionnalité Blog & News Questions Fréquentes Wiki Twitter
Profil Paramètres du Profil Compte et Facturation TradingView Coins Mes tickets au support Centre d'aide Idées Publiées Suiveurs Suivi Messages privés dialogue en ligne Se Déconnecter