CanOz
Home runs feel good, but base hits pay bills!
- Joined
- 11 July 2006
- Posts
- 11,543
- Reactions
- 519
No probs, hth
There is an AFL function for an inside bar, might make the code a bit tidier.
http://www.amibroker.com/guide/afl/afl_view.php?id=74
(OT: enjoying your posts on your futures trading CanOz, too busy to post much myself but enjoying reading what you're up to)
Cond1 = Close > Ref( Close, -1 );
Cond2 = High < Ref( High, -1 ) AND Low > Ref( Low, -1 );
Cond3 = Close < Ref( Close, -1 );
Thanks for that Captain...unfortunately i'm so out of practice from what was bad coding i can't even get this right....
All i want to do is add the code to add another inside day....so two inside days....
Here is the original, could you set me right please?
Code:Cond1 = Close > Ref( Close, -1 ); Cond2 = High < Ref( High, -1 ) AND Low > Ref( Low, -1 ); Cond3 = Close < Ref( Close, -1 );
Edit: I'm looking for balance within balance, so as long as the last two days are within the range of the bar 3 days ago then I'm interested...
//Most recent bar is inside the range of the previous
Cond1 =
High < Ref( High, -1 ) AND
Low > Ref( Low, -1 );
//Second last bar is inside the previous bar
Cond2 =
Ref( High, -1 ) < Ref( High, -2 ) AND
Ref( Low, -1 ) > Ref( Low, -2 );
Filter = Cond1 AND Cond2;
It's pre-coded in AB.
SYNTAX inside()
RETURNS ARRAY
FUNCTION Gives a "1" or "true" when an inside day occurs.Gives "0" otherwise. An inside day occurs when today's high is less than yesterday's high and today's low is greater than yesterday's low.
Just to clarify Can - I thought you were looking for this:
View attachment 52077
Yeah, that's it, balance within balance.
That's what the code I posted should give you. Your response earlier makes it sound like you still aren't getting this result.
What results are you getting? Or did I misread you and the problem's sorted already?
Thanks for that Captain...unfortunately i'm so out of practice from what was bad coding i can't even get this right....
All i want to do is add the code to add another inside day....so two inside days....
Here is the original, could you set me right please?
Code:Cond1 = Close > Ref( Close, -1 ); Cond2 = High < Ref( High, -1 ) AND Low > Ref( Low, -1 ); Cond3 = Close < Ref( Close, -1 );
Edit: I'm looking for balance within balance, so as long as the last two days are within the range of the bar 3 days ago then I'm interested...
Cond1 = Close > Ref( Close, -1 );
Cond2 = High < Ref( High, -1 ) AND Low > Ref( Low, -1 );
Cond3 = High < Ref( High, -2 ) AND Low > Ref( Low, -2 );
Cond4 = Ref(Cond1, -2);
Filter = Cond1*Cond2*Cond3*Cond4;
Cond1 = Close > Ref( Close, -1 );
Cond2 = High < Ref( High, -1 ) AND Low > Ref( Low, -1 );
Cond3 = High < Ref( High, -2 ) AND Low > Ref( Low, -2 );
Filter = Cond1*Cond2*Cond3;
Tested and works!
a = Inside();
aa = a==1;
b = Ref(a,-1)==1;
d = Ref(a,-2)==1;
Filter = a AND b AND d;
AddColumn(C*V,"IVT");
or this to visualize it with a yellow candle -
a = Inside();
aa = a==1;
b = Ref(a,-1)==1;
d = Ref(a,-2)==1;
Filter = a AND b AND d;
AddColumn(C*V,"IVT");
SetBarFillColor( IIf( (Filter), colorYellow, colorBlue ) );
Plot( C, "Price", IIf( C > O, colorGreen, colorRed ), styleCandle );
Filter = Sum( Inside(), 3 ) == 3;
AddColumn(C*V,"IVT");
Filter = Sum( Inside(), 3 ) == 3;
AddColumn(C*V,"IVT");
SetBarFillColor( IIf( (Filter), colorYellow, colorBlue ) );
Plot( C, "Price", IIf( C > O, colorGreen, colorRed ), styleCandle );
Very nice! It's a tiny symmetrical triangle consisting of 3 bars.
yeah, they're quite common...still can't get your indicator to paint the bars properly...
It struck me while watching a webinar this morning that this is basically what i'm looking for. You can check out the Webinar below.
Edit: I'm looking for balance within balance, so as long as the last two days are within the range of the bar 3 days ago then I'm interested...
Cond1 = High < Ref( High, -2 ) AND Low > Ref( Low, -2 );
Cond2 = Ref(High, -1) < Ref( High, -2 ) AND Ref(Low, -1) > Ref( Low, -2 );
Just to clarify Can - I thought you were looking for this:
View attachment 52077
Yeah, that's it, balance within balance.
cond1 = Close > Ref(Close, -1) and Ref(Close, -1) > Ref(Close, -2);
cond2 = Sum( Inside(), 2 ) == 2;
Filter = cond1 AND cond2;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?