vDr78

--vdr 1min Open-Close v1.1

760 5 70
offset_to_close : some fixes
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
strategy("--vdr 1min Open-Close", 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

offset = input(6.36, minval=0.01, step=0.1)
offset_to_close = input(2.54, minval=0.001, step=0.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
closeLongV4  = (open-close)>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
closeShortV4 = (close-open)>offset_to_close

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

strategy.entry("LONG", strategy.long, when= openLong)
strategy.close("LONG",  when = closeLongV4 and not openShort)
strategy.entry("SHORT", strategy.short, when =openShort)
strategy.close("SHORT", when = closeShortV4 and not openLong)
"C:\Program Files\Java\jdk1.8.0_66\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_66\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_66\jre\lib\rt.jar;C:\work\projects\Optimizer\target\classes;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ReadCsv
-----------------------------------------------------------------------------------------
csvFileName = GER301.csv
result = OptimizedResult{parameters=Parameters{offset=8.01, offsetToClose=0.01}, profit=56.10000000000218, trades=126, avg,trade=0.4452380952381126}
result.getAvgPosititveProfit() = 5.165873015873028
result.getMaxLoss() = -27.0
-----------------------------------------------------------------------------------------
csvFileName = GER305.csv
result = OptimizedResult{parameters=Parameters{offset=0.22, offsetToClose=0.01}, profit=562.0000000000255, trades=494, avg,trade=1.1376518218623997}
result.getAvgPosititveProfit() = 7.225708502024314
result.getMaxLoss() = -56.0
-----------------------------------------------------------------------------------------
csvFileName = GER3015.csv
result = OptimizedResult{parameters=Parameters{offset=29.98, offsetToClose=0.01}, profit=354.2000000000007, trades=141, avg,trade=2.5120567375886576}
result.getAvgPosititveProfit() = 16.53333333333334
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER3030.csv
result = OptimizedResult{parameters=Parameters{offset=0.97, offsetToClose=0.01}, profit=2715.0000000000036, trades=687, avg,trade=3.9519650655021885}
result.getAvgPosititveProfit() = 17.35997088791849
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER3060.csv
result = OptimizedResult{parameters=Parameters{offset=29.71, offsetToClose=0.01}, profit=2367.5, trades=385, avg,trade=6.14935064935065}
result.getAvgPosititveProfit() = 21.936363636363637
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER30240.csv
result = OptimizedResult{parameters=Parameters{offset=12.2, offsetToClose=0.01}, profit=10988.0, trades=710, avg,trade=15.476056338028169}
result.getAvgPosititveProfit() = 30.335211267605633
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER301440.csv
result = OptimizedResult{parameters=Parameters{offset=0.01, offsetToClose=0.01}, profit=19417.5, trades=891, avg,trade=21.792929292929294}
result.getAvgPosititveProfit() = 37.9320987654321
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER3010080.csv
result = OptimizedResult{parameters=Parameters{offset=0.15, offsetToClose=0.01}, profit=23832.0, trades=417, avg,trade=57.15107913669065}
result.getAvgPosititveProfit() = 74.12949640287769
result.getMaxLoss() = -20.0
-----------------------------------------------------------------------------------------
csvFileName = GER3043200.csv
result = OptimizedResult{parameters=Parameters{offset=7.02, offsetToClose=0.01}, profit=19280.0, trades=82, avg,trade=235.1219512195122}
result.getAvgPosititveProfit() = 251.21951219512195
result.getMaxLoss() = -20.0

Process finished with exit code 0
Reply
I think you did a great job on this system. I tested the original system on Friday with USOIL using .25 and .005 offsets on a 30 min chart. The opens did not repaint, but I received a close long signal on the next candle after the most recent long signal, which later disappeared and plotted higher around 39.50 price point. Was the fix for this issue? How exactly is the close signal calculated? Is it on candle open as well, or shall I wait until candle close to see if the close signal is valid. Your guidance would be much appreciated.
Reply
nice system. how far back has it been backtested?
Reply
vDr78 yashvij
read here:
Reply
yashvij vDr78
Thanks. How do I load your custom system onto my chart? I have clicked on favourite button but does not appear?
Reply
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体
台灣
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out