Q‑Trend ProOrder strategy (from TradingView) – multi‑timeframe

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #259846 quote
    betsonbetson
    Participant
    Senior

    DeepSeek AI helped me convert the Q‑Trend indicator from TradingView to a ProOrder strategy (ProRealTime). The code compiles and runs, but I’m not a programmer. I would really appreciate it if someone with ProRealTime expertise could review the logic and suggest improvements.

    About the strategy

    • Based on: Q‑Trend indicator – strong buy / strong sell signals only (open in outer 1/8 of the range over the last 5 bars).
    • Timeframes used:
    • 10‑minute confirmation (timeframe(10 minutes, updateonclose))
    • 5‑minute confirmation (timeframe(5 minutes, updateonclose))
    • Chart requirement: The strategy must be run on a 1‑minute chart because the code references higher timeframes inside timeframe() blocks. The base chart resolution must be the lowest timeframe used.
    • Entry: Only when both the 10‑min and 5‑min timeframes generate a strong buy (or strong sell) signal simultaneously.
    • Order accumulation: DEFPARAM CumulateOrders = true – the strategy can add contracts if multiple signals occur (but a cooldown is applied to prevent excessive stacking).
    • Exit: Currently exits when the opposite strong signal appears on both timeframes. No stop loss or profit target – pure signal‑based flip.
    • Filters included:
    • Cooldown – 10 bars between same‑direction entries (barindex - lastLongBar >= 10).
    • Zero‑bar exit protection – exits only when barindex > entryBar (prevents exit on the same bar as entry).

    What I’d like help with

    1. Logic correctness – Does this code correctly replicate the original Q‑Trend strong signals from TradingView?
    2. Exit strategies – The current exit (opposite strong signal) often exits too late. Are there better exits (e.g., trailing stop, ATR target, or exiting when the trend line changes direction – changeUp / changeDown)?
    3. Cumulative orders vs. flipping – Should I keep CumulateOrders = true or switch to false (flip positions) to reduce risk?
    4. Parameter optimisation – Recommended values for patrpmult, and cooldown when running on a 1‑minute chart with 10/5 min confirmations.
    5. Potential bugs – I sometimes see multiple entries on the same bar even with the cooldown. Is there a cleaner way to prevent this?

    The full ProRealTime code is below. Any feedback, improved version, or optimisation advice would be greatly appreciated.

    Thank you in advance!

    Screenshot-41.png Screenshot-41.png Screenshot-40.png Screenshot-40.png Q-Trend-Strategy.itf
    #259847 quote
    betsonbetson
    Participant
    Senior

    Performance observations

    • Best on: S&P 500 (ES, SPX) – the strategy captures trending moves well.
    • Other indices: Works reasonably well but with more whipsaws.
    • Main issue: High drawdown – the strategy often gives back profits during ranging or reversal periods.



    #259852 quote
    JSJS
    Participant
    Master

    Hi,

    The translated version of the Q-Trend indicator can be found in the library:

    https://www.prorealcode.com/prorealtime-indicators/q-trend/

    Iván González thanked this post
    #259854 quote
    betsonbetson
    Participant
    Senior

    Hi, thanks for the reply,

    I did looked into that code before, there is lot of difference between these codes, hence started a new thread hoping to improve . Any inputs will be appreciated.

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Q‑Trend ProOrder strategy (from TradingView) – multi‑timeframe


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
betson @betson Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by betsonbetson
5 months, 2 weeks ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/04/2026
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...