rianchi

ADX strategy with NASDAQ 30-minutes timeframe

Category: Strategies By: rianchi Created: January 8, 2026, 1:14 PM
January 8, 2026, 1:14 PM
Strategies
7 Comments
ADX strategy with NASDAQ 30-minutes timeframe

Good morning, I am grateful to this community for the wealth of ideas it provides. As a token of my gratitude, I am posting my first humble contribution: a strategy based simply on the ADX indicator and applied to the 30-minute Nasdaq index (but it can be adapted to other indices by optimising k, u, stop loss and gain). It only operates in the first part of the week and closes on Thursday. Comments and advice are welcome. Thank you.

Here is the code:

//nasdaq 30 minuti
DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate

// Condizioni per entrare su posizioni long

K=16
u=26
n=1
s=7
indicator1 = DIplus[s] (CLOSE)
indicator2 = DIminus[s](close)
c3 = (ADX[s]>K)
c5 = INDICATOR1 crosses over u
c2= indicator1>u
c6= adx[s] crosses over k
finestra= (dayofweek=1 or dayofweek=2 or dayofweek=3)

IF ((c3 and c5) or( c6 and c2)) and finestra THEN
BUY n CONTRACT AT MARKET
ENDIF

if currentdayofweek=4 and time >= 175000 THEN
Sell n contract at market
Endif

// Stop e target

SET STOP pLOSS 600
SET TARGET pPROFIT 200

 

Download
Filename: ADX-strategy-with-NASDAQ-M30.itf
Downloads: 132
rianchi
rianchi Junior
Developer by day, aspiring writer by night. Still compiling my bio... Error 404: presentation not found.
Author’s Profile

Comments

Musiar
8 months ago
#

Thank you for sharing your strategy: I dare to change it a bit, adding the complete trailing stop code function and expressing the trailing as % from Close, considering the long time period for simulation. Check it and feel free to test it for other TF or index.

The optimization was done with a minimum drawdown request

 

//nasdaq 30 minuti PROREALCODE

DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate

 

// Condizioni per entrare su posizioni long

 

//trailing stop

trailingstop = 0.42*Close/100

 

//resetting variables when no trades are on market

if not onmarket then

MAXPRICE = 0

MINPRICE = close

priceexit = 0

endif

 

 

K=16

u=26

n=1

s=7

indicator1 = DIplus[s] (CLOSE)

indicator2 = DIminus[s](close)

c3 = (ADX[s]>K)

c5 = INDICATOR1 crosses over u

c2= indicator1>u

c6= adx[s] crosses over k

finestra= (dayofweek=1 or dayofweek=2 or dayofweek=3)

 

IF ((c3 and c5) or( c6 and c2)) and finestra THEN

BUY n CONTRACT AT MARKET

ENDIF

 

if currentdayofweek=4 and time >= 175000 THEN

Sell n contract at market

Endif

 

//case LONG order

if longonmarket then

MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade

if MAXPRICE-tradeprice(1)>=trailingstop then //if the MFE is higher than the trailingstop then

priceexit = MAXPRICE-trailingstop //set the exit price at the MFE - trailing stop price level

endif

endif

 

//exit on trailing stop price levels

if onmarket and priceexit>0 then

EXITSHORT AT priceexit STOP

SELL AT priceexit STOP

endif

rianchi
7 months ago
#

Grazie per la tua condivisione. La strategia migliora nettamente con il tuo trailing. Non è così scontato: il trailing stop migliora nettamente il tasso di vincita ma sempre a scapito del rapporto rischio/rendimento. Non sempre ne vale la pena, questa volta si.

Nicolas
8 months ago
#

Thanks for sharing. Much appreciated 👍

ncdo
8 months ago
#

I think this strategy would perform better with dynamic stop-loss and take-profit settings. Would it be possible to include those?

Nicolas
8 months ago
#

Yes sure, add your query as a new topic in forum. Thanks 👍

ncdo
8 months ago
#

Great strategy.

The default SL/TP levels are slightly high for my risk tolerance.

I’ve adjusted mine to SL: 125 and TP: 275 for better results.

Do you have a recommended configuration for shorting/downtrends?

superfalcio
8 months ago
#

Thank you very much for the strategy,

i will appreciate a different stop loss and target setting:

SET STOP pLOSS 400 SET TARGET pPROFIT 600

ProRealCode ProRealCode
Loading...