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