Re: REQ Help with Trend Indicator
I only found my basic 'diamond indicator' but I will explain to you what you need to do in order to complete it.
Here's it's basic background. TGuider uses a 5 period MA as it's default. You can change this for quicker responses in immediate trend changes.
Logic:
If Price closes below the MA a red dot will paint in TSation.
If Price closes above the MA a green dot will paint.
That's the basis of it. But there is a little twist that gives you the warning of a possible trend change and that is the white diamond.
Here's how the white diamond works. You'll have to code this part in but not to worry it's very simple.
If you're in a downtrend, closing below the MA then all of a sudden you get a close above the MA, that would paint you a white diamond. If price then reversed and closed below the MA on the following bar, this would also be a white diamond.
In order for either the red or green dot to paint, it will need to be the second close on that side of the MA since the first will be white.
Are you following? Good.
It's as simple as that. Here's the basic code for just red and green dots. You'll have to put in the extra conditions for the white (possible change in trend coming) dots.
inputs: Price( Close ), Length( 4 ), Displace( 0 ) ;
variables: Avg( 0 ) ;
Avg = AverageFC( Price, Length ) ;
if Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin
If Close < Avg then
begin
Plot1( Avg , "Avg", Red );
end
else
begin
Plot1 (Avg , "Avg", Green);
end;
{ Alert criteria }
if Displace <= 0 then
begin
if Price crosses over Avg then
Alert( "Price crossing over average" )
else if Price crosses under Avg then
Alert( "Price crossing under average" ) ;
end ;
end ;
Good Luck!
|