JustUncleL

Open Close Cross Strategy R5 revised by JustUncleL

This revision is an open Public release, with just some minor changes. It is a revision of the Strategy "Open Close Cross Strategy R2" originally published by @JayRogers.

*** USE AT YOUR OWN RISK ***
JayRogers : "There are drawing/painting issues in pinescript when working across resolutions/timeframes that I simply cannot fix here.. I will not be putting any further effort into developing this until such a time when workarounds become available."
NOTE: Re-painting has not been observed with the default set up, nor with Alternate resolution multiplier up to 5.

Description:
Strategy based around Open-Close Moving Average Crossovers optionally from a higher time frame.

Setup:
  • I have generally found that setting the strategy resolution to 3-5x that of the chart you are viewing tends to yield the best results, regardless of which MA option you may choose (if any) BUT can cause a lot of false positives - be aware of this. JustUncleL: using one of the Smoothed MA helps reduce false positives.
  • Don't aim for perfection. Just aim to get a reasonably snug fit with the O-C band, with good runs of green and red. JustUncleL: using SMMA (8 to 10) gives a good fit.
  • Option to either use basic open and close series data, or pick your poison with a wide array of MA types.
  • Optional Stop Loss and Target Profit for damage mitigation if desired (can be toggled on/off)
  • Positions get taken automatically following a crossover - which is why it's better to set the resolution of the script greater than that of your chart, so that the trades get taken sooner rather than later.
  • If you make use of the stops/target profit, be sure to take your time tweaking the values. Cutting it too fine will cost you profits but keep you safer, while letting them loose could lead to more draw down than you can handle.

Revsion R5 Changes by JustUncleL
  • Corrected cross over calculations, sometimes gave false signals.
  • Corrected Alternate Time calculation to allow for Daily,Weekly and Monthly charts.
  • Open Public release.

Revision R4 By JustUncleL
  • Change the way the Alternate resolution in selected, use a Multiplier of the base Time Frame instead, this makes it easy to switch between base time frames.
  • Added TMA and SSMA moving average options. But DEMA is still giving the best results.
  • Using "calc_on_every_tick=false" ensures results between back testing and real time are similar.
  • Added Option to Disable the coloring of the bars.
  • Updated default settings.

R3 Changes by JustUncleL:
  • Returned a simplified version of the open/close channel, it shows strength of current trend.
  • Added Target Profit Option.
  • Added option to reduce the number of historical bars, overcomes the too many trades limit error.
  • Simplified the strategy code.
  • Removed Trailing Stop option, not required and in my option does not work well in Trading View, it also gives false and unrealistic performance results in back testing.

R2 Changes by @JayRogers:
  • Simplified and cleaned up plotting, now just shows a Moving Average derived from the average of open/close.
  • Tried very hard to alleviate painting issues caused by referencing alternate resolution.

Phát hành các Ghi chú: R5.1 Changes by JustUncleL
  • Upgraded to Version 3 Pinescript compliance.
  • Added option to select Trade type (Long, Short, Both or None)
  • Added bar colouring work around patch.
  • Some code corrections and changes to improve efficiency.

NOTE: To enable non-Repainting mode set "Delay Open/Close MA" to 1 or more, but expect the reported performance to drop dramatically.
Phát hành các Ghi chú: Bug fix
Correction on SuperSmooth MA calculation.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
JustUncleL

Bình luận

ıt makes re paint on default setup 30 min on eur usd
+1 Phản hồi
JustUncleL senaugurr
@senaugurr, This indicator does repaint, that was stated in the release notes.
+1 Phản hồi
jrm-007 JustUncleL
@JustUncleL,

This is real hard work and a great script. I have a question. Would taking a trade after the closing of the candle and selecting a higher timeframe, of say 1 hour, help avoid repainting issues completely?
Thanks
Phản hồi
JustUncleL jrm-007
@jrm-007, Higher time-frames do appear to have less re-paints. Personally when I traded this script before the re-painting was never a concern as I used other indicators, sorry I don't remember which ones, to confirm the signal. To me the signals are just heads up alerts.
+4 Phản hồi
jrm-007 JustUncleL
@JustUncleL,

Thank you for your reply. Let me tell you that I have been trading using your script and I don't use any other indicators. Your script is one of the most ingenious and profitable strategies I have ever come across.

Sadly, one of the things bothering me is the repaint issue. Sometimes signals just disappear which is somewhat acceptable. The other issue is that an entry/exit price changes to the "open" price after the completion of the current candle. So the end result calculates based on the "open" prices of the candles (where the signal was generated) rather than the actual prices when the buy/sell at the crossover. So I have a couple of questions regarding this:

1. How do I minimize the effects of repaint without altering the script? I know you have a no-repaint version but it doesn't appear to be as accurate as this one. I mean, your script generates an entry signal based on a crossover. So how do I make sure this crossover has actually happened on the chart?

2. Is it possible to alter the script so that it avoids calculations of the end results based on the open prices of the candles but rather calculates based on the actual pries at crossover?
+8 Phản hồi
i'm just trying to do this script in mql5, but i don't understand how it make these smma, how are made the calculations about them? sorry if had any fault in the message, i don't speak english very well.
Thanks for this great script and for share this for the community.
Phản hồi
Would it be possible to make this strategy for MT5? Bovespa has a 15 minute delay here at Tradingview.
Phản hồi
JustUncleL lucasbira
@lucasbira, Sorry no, I do not code for the Mt4/5 platform.
Phản hồi
lucasbira JustUncleL
@JustUncleL, Could you explain to me how is the crossing of the MA? Is the long multiplied by that I parameterize in MA?
Phản hồi
Hello!
For convenience, you can change the line of code 167 and 168, then Stop-loss and Take-profit will be in percent, not in ticks.

167: TP = tpPoints > 0 ? floor(tpPoints/100*strategy.position_avg_price/syminfo.mintick) : na
168: SL = slPoints > 0 ? floor(tpPoints/100*strategy.position_avg_price/syminfo.mintick) : na

Perhaps this will be useful to you.
Thanks for the open script!
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Cách thức hoạt động Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất