Plotting Help

SwingKing

Well-Known Member
#1
Let's say if we have a condition ,

A = Ref(HHV(Close, 15), -1); // Highest close in past 15 days leaving aside today's day.

Can some one help me with marking A's value on the chart as '1' ??
 

asnavale

Well-Known Member
#2
Let's say if we have a condition ,

A = Ref(HHV(Close, 15), -1); // Highest close in past 15 days leaving aside today's day.

Can some one help me with marking A's value on the chart as '1' ??
Hi raunak,

do you mean A should be equal to 1 only for the day when Highest High of Close in previous 15 days was reached and for all other remaining 14 days A = 0 ?

-Anant
 

SwingKing

Well-Known Member
#3
Hi raunak,

do you mean A should be equal to 1 only for the day when Highest High of Close in previous 15 days was reached and for all other remaining 14 days A = 0 ?

-Anant
Thanks for the reply Anant ...

What I want is this ...

I basically want to mark the highest high point in last 15 day period as '1' (Numeric 1) on the chart...

I tried using the plot function ... but just cant figure out the x,y points ..
 

asnavale

Well-Known Member
#4
Thanks for the reply Anant ...

What I want is this ...

I basically want to mark the highest high point in last 15 day period as '1' (Numeric 1) on the chart...

I tried using the plot function ... but just cant figure out the x,y points ..
Hi raunak,

Try the following code:

A = (C == HHV(C, 15));

_N(Title = StrFormat("{{NAME}}, {{DATE}}, {{INTERVAL}}, {{OHLCX}}, Vol. %1.0f\n", V));

Plot(C, "", colorGrey40, styleCandle);

for( i = 0; i < BarCount; i++ ) if( A ) PlotText( "1", i, H[ i ], colorYellow);


I have posted the out put of this AFL below. Does it meet your expectation?




-Anant
 
Last edited:

pkgmtnl

Well-Known Member
#6
Anant bhai,
help on this issue,

I have an expl AFL based on crossover, wherein I want to put an additional conditions /syntax wherein the cross over at a slope (angle) greater then 30 degree to baseline or vice versa for Buy or Sell conditions respectively.

Cond1 = Cross(MACD(r1,r2),Signal(r1,r2,r3));
Cond2 = Slope>??? (this syntax requd);

Buy = Cond1 AND cond2;

.....
....

can somebody guide on this? asnavale ji ur help is needed..
 

asnavale

Well-Known Member
#7
Anant bhai,
help on this issue,

I have an expl AFL based on crossover, wherein I want to put an additional conditions /syntax wherein the cross over at a slope (angle) greater then 30 degree to baseline or vice versa for Buy or Sell conditions respectively.

Cond1 = Cross(MACD(r1,r2),Signal(r1,r2,r3));
Cond2 = Slope>??? (this syntax requd);

Buy = Cond1 AND cond2;

.....
....

can somebody guide on this? asnavale ji ur help is needed..

Hi pkg,

Try this:

Cond2 = atan(V1 -V2) > PI/6;

where:

V1= MACD(r1, r2)
V2 = Ref(MACD(r1, r2), -1)
PI = 22/7

-Anant
 

SwingKing

Well-Known Member
#9
Dear Anant what is PI. its value 22/7 what does it mean?? Thanks.
Anant has mentioned this condition,

Cond2 = atan(V1 -V2) > PI/6; (π/6)

Now PI has value of 180 degrees ... it is more of a geometric concept... so when u r testing the rule for 30 degrees ... u use PI/6 (180/6)...

degrees are defined such that there are 360 in a full circle. Size of circle does not matter. A degree is a measure of how "wide" an angle is.For a circle, the circumference is 2π. This equals 360. If you divide this by two, you can see why 180 = π (pie) radians.

hope its clear ... for more info refer to atan function ...
 

SwingKing

Well-Known Member
#10
Anant, is there any function that restricts condition for specific time frame ??

For Eg. What If I want to calculate the highest high from 22Jan2009 to 23rd Feb 2009. Is there a specific function to write this ...

Thanks

Raunak
 

Similar threads