Index | Recent Threads | Who's Online | Search

New Thread
This topic has been viewed 62 times and has 1 reply
sevensisters
MACD turnaround point

Hi all,

I would like to screen for stocks which recently had a turnaround in the MACD signal (see arrow in attachment).

To do this I need to create a formula which gives me the day (bars ago) in last 15 trading days with the lowest MACDD signal value, but not the value itself.

To get the lowest value itself I would simply use LoopMin
LoopMin("MACDD(12,26,1,CTR)",15)


But what I am after is the CTR when this lowest value occurs, which fulfills the following condition:

MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR+1) AND MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR-1)

Does anybody know how I can implement this in a loop and get the CTR as answer, like
Eval(condition with loop, CTR,0)

Best regards,
Florian

Attachment Capture.JPG (29184 bytes) (Download count: 31)


Jan 17, 2020 2:47:35 AM       
sevensisters
Re: MACD turnaround point

cool I think I cracked the nut...
LoopMax("Eval(MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR+1) AND MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR-1),CTR,0)",15,1)

For the screener I use...
Universe(SP500)
SetVar(@minMACD,LoopMin("MACDD(12,26,1,CTR)",15))
SetVar(@turnbar,LoopMax("Eval(MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR+1) AND MACDD(12,26,1,CTR)<MACDD(12,26,1,CTR-1),CTR,0)",15,1))
@turnbar<7 AND @turnbar>2 AND @minMACD<0 //Turnaround between 3-6 bars ago with negative MACD value at that bar

For the S&P500 this returns 28 stocks as of today.

These criteria define the universe for a trading strategy. Next one can create some buy and sell signals (as shown for WDC in the fundamental chart below) and finally implement it into a model....

Attachment Capture1.JPG (74489 bytes) (Download count: 30)


Attachment Capture2.JPG (120243 bytes) (Download count: 30)


Jan 17, 2020 3:20:09 AM       
Edit 1 times, last edit by sevensisters at Jan 17, 2020 3:29:36 AM