Monthly High Low Exploration

Status
Not open for further replies.

amitrandive

Well-Known Member
#12
I am not sure what you mean past days scanning ?
Currently it scans only the last day available.
It can be used to scan all the quotes available.

If you run this can anytime on today's data , it will show you results of Today's date only.Can it be set to run on any date ?
 

jagankris

Well-Known Member
#13
Currently it scans only the last day available.
It can be used to scan all the quotes available.

If you run this can anytime on today's data , it will show you results of Today's date only.Can it be set to run on any date ?
The code is expected to pick last 13 months highs and compare them and give the output.It is not date specific.

Just run the below and pls check if it is picking the monthly highs correctly.
M1H to M13H - should have 13 monthly highs.

_SECTION_BEGIN("MonthlyHighExploration");

SetChartOptions( 0, chartShowArrows | chartShowDates );
TimeFrameSet( in5Monthly );
j=13;
i=0;
for( i = 1; i <= 13; i++ )
{
VarSet( "M"+i+"H", Ref( H, -j ) );
AddTextColumn(NumToStr(VarGet("M"+i+"H")), "M"+i+"H", 1.2,colorBlack,colorGrey50,-1);
J--;
}

j=2;
for( i = 1; i < 13; i++ )
{
VarSet( "M"+i+"High", IIf(VarGet("M"+j+"H") > VarGet("M"+i+"H"),1,0) );
j++;
}

Filter = 1 AND Status("lastbarinrange"); ;
for( i = 1; i < 13; i++ )
{
AddTextColumn(NumToStr(VarGet("M"+i+"High")), "M"+i+"High", 1.2,colorBlack,colorGrey50,-1);
}
_SECTION_END();
 

trash

Well-Known Member
#14
The code is expected to pick last 13 months highs and compare them and give the output.It is not date specific.

Just run the below and pls check if it is picking the monthly highs correctly.
M1H to M13H - should have 13 monthly highs.
Your code(s) are garbage. Just use the code in post #3 and you are done. Yours is completely off-base to post #1.




As for the OP ....
Seriously Amitrandive, what you not understand in post #3. Do you know what Varset and Varget mean?
You just have to fill in. What is the problem in doing so? It's like filling in colors in a 99% finished painting. An elementary school kid can do that.

So let's start with first loop:
You want to set variables MH1 to MH12 and variables ML1 to ML12. So what should be the names in the two VarSet lines first parameter of first loop and what variables has to be inserted in second parameter of Varset since you look for HHV and LLV? It's so easy.

From the AB manual
VarSet
- sets the value of dynamic variable Miscellaneous functions
(AFL 2.60)


SYNTAX VarSet( ''varname'', value )
RETURNS NUMBER
FUNCTION Sets the value of dynamic variable. Returns 1 on success, 0 on failure.
Dynamic variables are variables that are named dynamically, typically by creating a variable name from a static part and a variable part. The following example dynamically constructs the variable name from a variable prefix and a static suffix. Dynamic variables are always global.

EXAMPLE

Code:
for( i = 1; i < 10; i++ ) 
{ 
    VarSet( "C"+i, Ref( C, -i ) ); 
} 
 
// creates variables C1, C2, C3, C4, ...., C10 equal to Ref( C, -1 ), Ref( C, -2 ),   ..., Ref( C, -10 ) 
// respectively

Use trace if you do not understand what is happening in the AB manual loop

Code:
for( i = 1; i < 10; i++ ) 
{ 
    VarSet( "C"+i, Ref( C, -i ) );     
    _Trace( StrFormat( "VarGet call -> C%g = %1.2f -> stores Ref( C, -%g)", i, VarGet( "C" + i ), i ) );
}
Now adapt to post #3 first loop.. you want variables MH1 to MH12 and ML1 to ML12 which shall store HHVs and LLVs.


Finally step out of copy&pasting and think a little bit and learn how to fish.
 
Last edited:
#15
Guys need help:

I am a novice in Ami, but I have it installed and got NIFTY charts running.

Now I want some sorts of AFL (Like the above) to scan say BSE200 stocks and return an output something like Amit wants. What all I will need to do specially in terms of EOD database like where I can get that from? do we have free source for that etc.
 

jagankris

Well-Known Member
#17
Your code(s) are garbage. Just use the code in post #3 and you are done. Yours is completely off-base to post #1.
fish.
Dear All

I need an all Monthly high low exploration.
It should progressively put "Yes" after hitting a new month high every month.

At the time it hits 12 Month high it should show all the earlier columns as filled

Please see image to understand



Started with these lines

Code:
Mth  = Param("Month", 1, 1, 12);
MH1 =High>Ref(HHV(High,Mth),-1);
ML1= Low  < Ref(LLV(Low,Mth),-1);
Filter=MH1 OR ML1;
I need an all Monthly high low exploration.
It could be interpreted in 2 ways.

My understanding of the above stated requirement is

Case 1
I need an "all" Monthly high low exploration for the past 12 months.

Explore all the monthly highs/lows if a stock makes new monthly high it should put 1 else 0.

And

Case 2
It is different if the stated requirement is
to explore
I need an "all Monthly(all time) high low "" exploration.
ie all the stocks that are making new all time highs month on month with in the past 12 months.
Similarly for Lows.


And my code is intended for the first.

Your code(s) are garbage.
Be nice to people,Use polite/positive language.

The code was to help Amit who was having difficulties in Varset,Varget and also to explore as per the logic - Case 1.

And I left the monthly lows exploration intentionally for Amit to code.

For people from non programming background it will be difficult to understand
the concepts - and will take time to code.
Like any other profession.It takes time to learn programming.
 

amitrandive

Well-Known Member
#18
Your code(s) are garbage. Just use the code in post #3 and you are done. Yours is completely off-base to post #1.


As for the OP ....
Seriously Amitrandive, what you not understand in post #3. Do you know what Varset and Varget mean?
You just have to fill in. What is the problem in doing so? It's like filling in colors in a 99% finished painting. An elementary school kid can do that.

So let's start with first loop:
You want to set variables MH1 to MH12 and variables ML1 to ML12. So what should be the names in the two VarSet lines first parameter of first loop and what variables has to be inserted in second parameter of Varset since you look for HHV and LLV? It's so easy.

From the AB manual

Use trace if you do not understand what is happening in the AB manual loop

Code:
for( i = 1; i < 10; i++ ) 
{ 
    VarSet( "C"+i, Ref( C, -i ) );     
    _Trace( StrFormat( "VarGet call -> C%g = %1.2f -> stores Ref( C, -%g)", i, VarGet( "C" + i ), i ) );
}
Now adapt to post #3 first loop.. you want variables MH1 to MH12 and ML1 to ML12 which shall store HHVs and LLVs.


Finally step out of copy&pasting and think a little bit and learn how to fish.
Its like if somebody start talking about simple medical terms , it would be natural for a person in the same profession to understand.For the other persons it would be like Greek and Latin.:D

Not all people are born super brilliant and not everybody is a Master of All things on Earth.

Copy pasting is not bad , if we can help out people whose requirement is just that.
Also copy pasting would work most of the times.

We don't require to write new codes from scratch every time.So it is a time saving process.

Some people choose to have maturity ,kindness and compassion in helping others over brilliance and arrogance and avoid over display of knowledge.
 
Last edited:

TradeOptions

Well-Known Member
#20
I praise the effort being put in by jagankris and the way amit is handling this thread.

I find the posts of trash to be offensive and low standard :annoyed:

He might be a super expert programmer having great skills, but the way he has replied in this thread is real bad.

jagankris bro, please do not be offended by his reply. For every single guy like him, there would be ten other guys who would praise the efforts put in by you to help in a polite manner.

With my best regards
 
Status
Not open for further replies.

Similar threads