PureBytes Links
Trading Reference Links
|
Hi John,
I've never coded in EasyLanguage, but it looks like it might be the following:
BP1 = Ref(BP, -1);
BP2 = Ref(BP, -2);
Peak = IIF( BP1 > BP AND BP1 > BP2, BP1, 0 );
Valley = IIF( BP1 < BP AND BP1 < BP2, BP1, 0 );
AvgPeak = MA( Peak, 50 );
FracAvgPeak = Fraction * AvgPeak;
AvgValley = MA( Valley, 50 );
FracAvgValley = Fraction * AvgValley;
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "bbands" <BBands@xxx> wrote:
>
> I've included the TradeStation code below. It is lines 29 through 36 that I am having trouble realizing in AB.
>
> TIA,
>
> John
>
> 1. Indicator: EmpiricalMode
> 2. inputs:
> 3. Price( 0.5 * ( High + Low ) ),
> 4. Period( 20 ),
> 5. Delta1( 0.5 ),
> 6. Fraction( 0.1 ) ;
>
> 7. variables:
> 8. Beta1( 0 ),
> 9. Gamma1( 0 ),
> 10. Alpha( 0 ),
> 11. HalfAlphaDiff( 0 ),
> 12. Beta1OnePlusAlpha( 0 ),
> 13. BP( 0 ),
> 14. Trend( 0 ),
> 15. Peak( 0 ),
> 16. Valley( 0 ),
> 17. AvgPeak( 0 ),
> 18. FracAvgPeak( 0 ),
> 19. AvgValley( 0 ),
> 20. FracAvgValley( 0 ) ;
>
> 21. Beta1 = Cosine( 360 / Period ) ;
> 22. Gamma1 = 1 / Cosine( 720 * Delta1 / Period ) ;
> 23. Alpha = Gamma1 - SquareRoot( Square( Gamma1 ) - 1 ) ;
> 24. HalfAlphaDiff = 0.5 * ( 1 - Alpha ) ;
> 25. Beta1OnePlusAlpha = Beta1 * ( 1 + Alpha ) ;
> 26. BP = HalfAlphaDiff * ( Price - Price[2] ) +
> 27. Beta1OnePlusAlpha * BP[1] - Alpha * BP[2] ;
> 28. Trend = Average( BP, 2 * Period ) ;
>
> 29. if BP[1] > BP and BP[1] > BP[2] then
> 30. Peak = BP[1]
> 31. else if BP[1] < BP and BP[1] < BP[2] then
> 32. Valley = BP[1] ;
>
> 33. AvgPeak = Average( Peak, 50 ) ;
> 34. FracAvgPeak = Fraction * AvgPeak ;
> 35. AvgValley = Average( Valley, 50 ) ;
> 36. FracAvgValley = Fraction * AvgValley ;
>
> 37. Plot1( Trend, "Trend" ) ;
> 38. Plot2( FracAvgPeak, "AvgPeak" ) ;
> 39. Plot3( FracAvgValley, "AvgValley" ) ;
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|