[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Help with Cycle Indicator



PureBytes Links

Trading Reference Links

The TS code is written as a function where the Length is supplied by 
whatever calls it so try the below (Not tested) which is basically a 
smoothed stochastic of a smoothed stochastic ...

function DGL(Length)
{
SloFastK = EMA(100 * (C - LLV(L, Length)) / (HHV(H, Length) - LLV(L, 
Length)), 3);

Cycle = EMA(100 * (SloFastK - LLV(SloFastK, Length)) / (HHV(SloFastK, 
Length) - LLV(SloFastK, Length)),3);

Return Cycle;
}

--- In amibroker@xxxxxxxxxxxxxxx, "ewn87544" <ewn87544@xxxx> wrote:
>  I am trying to convert the Trade Station 4.0 code for the 
> DGL (Dynamic Gann Level) Cycle Indicator this is usually used in 5 
or 
> 10 period moving averages.
>  I am new to Amibroker and don't understand if, and, or, and else 
> usage in Amibroker.
>  Below is my attempt to accomplish this and following that is the 
> TS4 code.
> Thanks I alot.
> Ernie
> 
> 
> // DGL Cycle_5 
> //Inputs: Length(NumericSimple); 
> //Vars: SloFastK(0),NewFastK(0),Factor(.5);
> 
> Length = 5;
> Factor = .5;
> // Calculate Raw Stochastic AND average it with 3 bar xma 
> IF HHV(High,Length) - LLV(L,Length) > 0 AND C - LLV(L,Length) > 0 
> then 
> SloFastK = EMA((Close - LLV(L,Length)) / (HHV(H,Length) - LLV
> (L,Length)) * 100,3); 
> Else SloFastK = 0; 
> // Calculate raw stochastic using xma from above (SloFastK) 
> Value1 = LLV(SloFastK,Length);
> Value2 = HHV(SloFastK,Length) - Value1;
> Value3 = SloFastK;
> 
> If Value2 > 0 then
> 	NewFastK = (Value3 - Value1) / Value2 * 100
> else 
> 	NewFastK = 0;
> 
> Cycle = Factor * NewFastK + (1 - Factor) * Cycle[1];
> 
> Plot(Cycle,"Cycle",colorRed);
> //Plot(Value1,"Value1",colorRed);
> //Plot(Value2,"Value2",colorRed);
> //Plot(Value3,"Value3",colorRed);
> 
> 
> /*
> Trade Station  4 Code
> Inputs: Length(NumericSimple); 
> 
> Vars: SloFastK(0),NewFastK(0),Factor(.5);
> 
> { Calculate Raw Stochastic AND average it with 3 bar xma }
> If Highest(H,Length) - Lowest(L,Length) > 0 AND C - Lowest
(L,Length) 
> > 0 then 
> SloFastK = xAverage((Close - Lowest(L,Length)) / (Highest
(H,Length) - 
> Lowest(L,Length)) * 100,3) 
> Else SloFastK = 0; 
> { Calculate raw stochastic using xma from above (SloFastK) }
>  Value1 = Lowest(SloFastK,Length);
> Value2 = Highest(SloFastK,Length) - Value1;
> Value3 = SloFastK;
> 
> if Value2 > 0 then
> 	NewFastK = (Value3 - Value1) / Value2 * 100
> else 
> 	NewFastK = 0;
> 
> Cycle = Factor * NewFastK + (1 - Factor) * Cycle[1];


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading!
Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/aM1XQD/od7FAA/uetFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/