Trend EA
0 replies
Jan Bolek
1 week ago #294001
Hi everyone,
I have an interesting trend strategy for daily charts here, and I need some help putting it together in SQX. It is based on a combination of several technical indicators.
Important note right off the bat: The Slope Direction Line and Accelerator (AC) are custom indicators, but both are available directly in the SQX CodeBase, so they can be easily imported.
I have the basic rules, but I need some help translating them into SQX blocks. Additionally, I want to add ADX and ATR filters to avoid entering during choppy markets.
Here is the exact definition of the basic rules:
1. Indicators Used (Timeframe D1)
Slope Direction Line: (Custom indicator available in SQX CodeBase)
Awesome Oscillator (AO)
Accelerator Oscillator (AC): (Custom indicator available in SQX CodeBase)
Stochastic: (5, 3, 3)
Parabolic SAR: (0.03, 0.2)
2. Entry Conditions for LONG
Entries are always executed on the OPEN of the next bar, once a closed candle meets ALL of the following conditions:
AC: rising (green histogram in the platform).
AO: rising (green histogram in the platform).
Stochastic: Main line (K) is above the Signal line (D) – both are pointing up, ideally below the 80 level.
Slope line: rising (blue line in the platform).
PSAR: dot is located below the candle.
3. Entry Conditions for SHORT
Entries are executed on the OPEN of the next bar after meeting all of the following:
AC: falling (red histogram).
AO: falling (red histogram).
Stochastic: Main line (K) is below the Signal line (D) – both are pointing down, ideally above the 20 level.
Slope line: falling (red line).
PSAR: dot is located above the candle.
4. Exits (Stop Loss and Profit Target)
Initial Stop Loss: Set to the current value of the Parabolic SAR indicator.
Trailing Stop Loss: The SL is moved when the AO changes color. For example, in a LONG position, if the AO changes from green to red (the histogram starts falling), the SL is trailed just below the LOW of that specific candle.
Profit Target: The original strategy uses a rather specific formula to calculate the TP distance:
For LONG: TP = (CLOSE – LOW) / 2
For SHORT: TP = (HIGH – CLOSE) / 2
5. My Adjustments – Filters to Add
I would like to improve this basic logic in SQX and test it with additional filters, which is where I need some help:
ADX Filter: I want to condition the entry so that the market must be in a strong trend (e.g., ADX > 20 or 25).
ATR Filter: I would like to use ATR either to filter out low-volatility markets (only trade when ATR > X pips), or ideally, replace the original weird TP formula with a target based on an ATR multiple.
Does anyone have an idea how to elegantly set up the Trailing SL condition based on the AO color change (rising/falling) in SQX? And how to properly configure those CodeBase indicators in Custom Blocks? Also, what would be the best way to incorporate the ADX/ATR filters so it makes sense on D1 charts?
Thanks in advance for any advice or templates!