Ok have a working script to filter for MACD Weekly and MACD Daily scans" thanks.
Not sure of the logic behind having two separate scripts for a. stock filter, and b. graphic signal, as the one script seems to do both presently (graphic symbols saved as overlay F key with additional technical indicators).
Filter scan for weekly data MACD 100 (about equal to a MACD 260 Daily data):
{------------------------------------------------}
{Macd 1 Long 100,50-30}
MACD1:= mov(C, 100, E) - mov(C, 50, E);
MACD1sig := mov(MACD1, 30, E);
MACD1hist := (MACD1-MACD1sig);
{Macd 2 Medium 50, 24-18}
MACD2:= mov(C, 50, E) - mov(C, 24, E);
MACD2sig := mov(MACD2, 18, E);
MACD2hist := (MACD2-MACD2sig);
MACD3:= mov(C, 12, E) - mov(C, 26, E);
MACD3sig := mov(MACD3, 9, E);
MACD3hist := (MACD3-MACD3sig);
{Alert: Macd Medium Main crosses signal line, M1 histogram rising x nos bars }
MACD2_xUP := Cross(MACD2sig, MACD2)
AND (MACD1hist>REF(MACD1hist,-2)
AND MOV(CLOSE,21,S) * MOV(VOLUME,21,S) >= 50000);
{ Alert signal holds signal TRUE for 5 bars or whatever number you choose}
Alert_MACD2 := Alert (MACD2_xUP, 5);
{ Testing the output contents }
Alert_MACD2;
{------------------------------------------------}
And Daily data MACD 260:
{------------------------------------------------}
{Macd 1 Long 260,120-90}
MACD1:= mov(C, 260, W) - mov(C, 120, W);
MACD1sig := mov(MACD1, 90, W);
MACD1hist := (MACD1-MACD1sig);
{Macd 2 Medium 100, 50-30}
MACD2:= mov(C, 100, E) - mov(C, 50, E);
MACD2sig := mov(MACD2, 30, E);
{Alert: Macd Medium Main crosses signal line, M1 histogram rising x nos bars }
MACD2_xUP := Cross(MACD2sig, MACD2)
AND (MACD1hist>REF(MACD1hist,-2)
AND MOV(CLOSE,21,S) * MOV(VOLUME,21,S) >= 50000);
{ Alert signal holds signal TRUE for 5 bars or whatever number you choose}
Alert_MACD2 := Alert (MACD2_xUP, 5);
{ Testing the output contents }
Alert_MACD2;
{------------------------------------------------}
But when I attempt a fast MACD "turning up by 2 bars or so from running down" (below zero) script to run on the above MACD scan results watch list, nothing seems to work:
(I take it the MACD greater than MACD 1 bar back means the indicator is rising no falling) as the MACD index is greater as it falls lower than zero and above zero?
I'll be using this indicator / histogram turning state quite a lot so would like to know how the code should read.
{------------------------------------------------}
MACD3:= mov(C, 12, E) - mov(C, 50, E);
MACD3sig := mov(MACD3, 25, E);
MACD3hist := (MACD3sig-MACD3);
MACD3_UP:= (MACD3 <0 AND MACD3 > REF(MACD3,-1) AND (MACD3,-1 < REF(MACD3,-2)));
{Alert: Macd Fast turning up, hold x nos of bars }
Alert_MACD3 := Alert (MACD3_UP, 3);
{ Testing the output contents }
Alert_MACD3;
{------------------------------------------------}
OUTPUT= -> There is no function defined. Please define your function with valid arguments