SH's MArket Correction Prediction Strategy

Joined
Dec 3, 2006
Messages
18
Likes
28
Dear sh
a small contribution to ur strategy. an afl to count the number of days
_SECTION_BEGIN("total days");

SetBarsRequired(1000000,0);

function TotalDays()
{
yy = Year();
dy = DayOfYear();

leapyear = ( yy % 4 ) == 0 AND yy != 2000;

yearlen = IIf( leapyear, 366, 365 );

return yearlen * (yy - yy[ 0 ]) + (dy - dy[0]);
}

td = TotalDays();
dy = DayOfYear();

//Plot( td, "TotalDays", colorRed );
ts15dy=ValueWhen((L<=EMA(C,15) AND H>=EMA(C,15)),td);
ts34dy=ValueWhen((L<=EMA(C,34) AND H>=EMA(C,34)),td);
ts100dy=ValueWhen((L<=EMA(C,100) AND H>=EMA(C,100)),td);

Plot( td-ts15dy, "e-15 test Days", colorBlue );
Plot( td-ts34dy, "e-34 test Days", colorGreen );
Plot( td-ts100dy, "e-100 test Days", colorRed );
_SECTION_END();
hope this will help all. hope u will aprreciate this
vyasa
 

VJAY

Well-Known Member
Joined
Jun 16, 2008
Messages
8,338
Likes
16,566
Dear sh
a small contribution to ur strategy. an afl to count the number of days
_SECTION_BEGIN("total days");

SetBarsRequired(1000000,0);

function TotalDays()
{
yy = Year();
dy = DayOfYear();

leapyear = ( yy % 4 ) == 0 AND yy != 2000;

yearlen = IIf( leapyear, 366, 365 );

return yearlen * (yy - yy[ 0 ]) + (dy - dy[0]);
}

td = TotalDays();
dy = DayOfYear();

//Plot( td, "TotalDays", colorRed );
ts15dy=ValueWhen((L<=EMA(C,15) AND H>=EMA(C,15)),td);
ts34dy=ValueWhen((L<=EMA(C,34) AND H>=EMA(C,34)),td);
ts100dy=ValueWhen((L<=EMA(C,100) AND H>=EMA(C,100)),td);

Plot( td-ts15dy, "e-15 test Days", colorBlue );
Plot( td-ts34dy, "e-34 test Days", colorGreen );
Plot( td-ts100dy, "e-100 test Days", colorRed );
_SECTION_END();
hope this will help all. hope u will aprreciate this
vyasa
Dear vyasa,
Thanks and hats off to your contribution to this wonderfull method....can you abe to add to show as text for remaining days to touch ema's...at top of afl....
 
Joined
Dec 3, 2006
Messages
18
Likes
28
dear vjay
will this do?
Plot( td-ts15dy, "e-15 test Days max 42", colorBlue );
Plot( td-ts34dy, "e-34 test Days max 126", colorGreen );
Plot( td-ts100dy, "e-100 test Days max 196", colorRed );
paste this in the place of the plot section
vyasa
 

VJAY

Well-Known Member
Joined
Jun 16, 2008
Messages
8,338
Likes
16,566
dear vjay
will this do?
Plot( td-ts15dy, "e-15 test Days max 42", colorBlue );
Plot( td-ts34dy, "e-34 test Days max 126", colorGreen );
Plot( td-ts100dy, "e-100 test Days max 196", colorRed );
paste this in the place of the plot section
vyasa
Ahh too fast:)....yes now ok..thanks once again for your effort....:clap:
 
Joined
Dec 3, 2006
Messages
18
Likes
28
dear vjay,
see the result when all the three goes above 0.not only in nifty but in stocks also. still to research
trade only when all the three is above "0" and close the trade when any one is zero. this eliminates many whipsaws
vyasa
 
Last edited:

VJAY

Well-Known Member
Joined
Jun 16, 2008
Messages
8,338
Likes
16,566
dear vjay,
see the result when all the three goes above 0.not only in nifty but in stocks also. still to research
trade only when all the three is above "0" and close the trade when any one is zero.
vyasa
Dear vyasa,
please Can you eloberate it ?...:confused:
 

Visualize

Active Member
Joined
Mar 28, 2009
Messages
125
Likes
130
Dear sh
a small contribution to ur strategy. an afl to count the number of days

hope this will help all. hope u will aprreciate this
vyasa

Thanks for the code i've added the total days figure :

_SECTION_BEGIN("total days");

SetBarsRequired(1000000,0);

function TotalDays()
{
yy = Year();
dy = DayOfYear();

leapyear = ( yy % 4 ) == 0 AND yy != 2000;

yearlen = IIf( leapyear, 366, 365 );

return yearlen * (yy - yy[ 0 ]) + (dy - dy[0]);
}

td = TotalDays();
dy = DayOfYear();

//Plot( td, "TotalDays", colorRed );
ts15dy=ValueWhen((L<=EMA(C,15) AND H>=EMA(C,15)),td);
ts34dy=ValueWhen((L<=EMA(C,34) AND H>=EMA(C,34)),td);
ts100dy=ValueWhen((L<=EMA(C,100) AND H>=EMA(C,100)),td);

Plot( td-ts15dy, "15EMA Test Days(42)", colorGreen );
Plot( td-ts34dy, "34EMA Test Days(112-126)", colorBlue );
Plot( td-ts100dy,"100EMA Test Days(196)", colorRed );
_SECTION_END();
 
Joined
Jun 22, 2009
Messages
1,543
Likes
6,517
Hi Guys - I am guessing this is an Amibroker AFL ....

Can someone post a screenshot?

The problem is that I do not use amibroker (I am bad at computers to be honest and I need help from someone who can teach me how to install and use amibroker with AFLs...) :down:

If anyone has the time and patience to help me install amibroker (free version) and teach me how to use it ... I will be really greatful....

Cheers
SH
 

Similar threads

Broker Special Offers