Scan "Weekly" and "daily" in Amibroker

#1
Hi
I would like to do a simple "Automatic Analysis" with Amibroker.
Basically I would like to get stocks where the "Weekly" MACD( 7, 28 ) > "Weekly" Signal( 7, 28, 7 ) and where the "Daily" StochK( 15, 5 ) cross over "Daily" StochD( 15, 5, 5 ).
So I wrote this

TimeFrameSet(inWeekly);
MACD( 7, 28 ) > Signal( 7, 28, 7 );
TimeFrameRestore();

Buy = Cross ( StochK( 15, 5 ) , StochD( 15, 5, 5 ) );

Sell = Cross (Signal( 10, 30, 10 ) , MACD( 10, 30 ) );

But results that I have obtained are not what I am looking for.
I probably did not write the right thing but if someboy could help me I would appreciate.
Thanks!
 

asnavale

Well-Known Member
#2
Hi
I would like to do a simple "Automatic Analysis" with Amibroker.
Basically I would like to get stocks where the "Weekly" MACD( 7, 28 ) > "Weekly" Signal( 7, 28, 7 ) and where the "Daily" StochK( 15, 5 ) cross over "Daily" StochD( 15, 5, 5 ).
So I wrote this

TimeFrameSet(inWeekly);
MACD( 7, 28 ) > Signal( 7, 28, 7 );
TimeFrameRestore();

Buy = Cross ( StochK( 15, 5 ) , StochD( 15, 5, 5 ) );

Sell = Cross (Signal( 10, 30, 10 ) , MACD( 10, 30 ) );

But results that I have obtained are not what I am looking for.
I probably did not write the right thing but if someboy could help me I would appreciate.
Thanks!
Hi,

You have not calculated MACD and Signal in Weekly timeframe.

TimeFrameSet(inWeekly);
MACD( 7, 28 ) > Signal( 7, 28, 7 );
TimeFrameRestore();


The above code does not calculate the values.

Modify the code as follows:

TimeFrameSet(inWeekly);
M = MACD( 7, 28 );
S = Signal( 7, 28, 7 );
TimeFrameRestore();
MW = Timeframeexpand(M. inWeekly);
SW = Timeframeexpand(S, inWeekly);

BUY = Cross ( StochK( 15, 5 ) , StochD( 15, 5, 5 ) );
SELL = MW > SW;


I am not sure to what extent your logic is correct. But the above code is as per your explanation.

-Anant
 

Similar threads