Skip to main content

Weekly step Upgraded for Amibroker (AFL)

panno almost 14 years ago Amibroker (AFL)

  • Rating:
    3 / 5 (Votes 3)
  • Tags:
    amibroker

Weekly Step was modified and revised for further use.
It can be used for shorter time frame as well like hourly and 15 minutes.
Do try……….
Pan

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("BS Weekly"); 
/* switch to weekly time frame */ 
TimeFrameSet( inWeekly );  
MP = ( H + L + C) / 3; //CALCULATING MEDIAN PRICE 
BS = MA( MP, 5 ); // CALCULATING THE BALANCE STEP 
_UP = BS > Ref(BS,-1); 
_BScolor = IIf( _UP, ParamColor("Up Color", colorBrightGreen), ParamColor("Down Color", colorRed )); /* choose color */
TimeFrameRestore();  
  
/* expand calculated weekly BALANCE STEP to display on DAILY charts */ 
  
BalanceStep = TimeFrameExpand( BS, inWeekly ); 
UP = TimeFrameExpand( _UP, inWeekly ); 
BScolor = TimeFrameExpand( _BScolor, inWeekly ); 

Plot(BalanceStep,"Weekly Val",BScolor,styleLine | styleThick,0,0,1); 
//-----------------------------------------------------------
TimeFrameSet( inDaily);  
MP1 = ( H + L + C) / 3; //CALCULATING MEDIAN PRICE 
BS1 = MA( MP1, 5 ); // CALCULATING THE BALANCE STEP 
_UP1 = BS1 > Ref(BS1,-1); 
_BScolor1 = IIf( _UP1, ParamColor("Up Color1", colorCustom11), ParamColor("Down Color1", colorCustom12)); /* choose color */
TimeFrameRestore();  
  
/* expand calculated weekly BALANCE STEP to display on DAILY charts */ 
  
BalanceStep1 = TimeFrameExpand( BS1, inDaily); 
UP1 = TimeFrameExpand( _UP1, inDaily); 
BScolor1 = TimeFrameExpand( _BScolor1, inDaily); 

Plot(BalanceStep1,"Daily Val",BScolor1,styleLine | styleThick,0,0,1); 
//----------------------------------------------------------------------
_SECTION_END();

_SECTION_BEGIN("Price");
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
pds = 20; 
MAFAST = EMA( Close, 20 ); 
MASLOW = EMA( Close, 40 ); 
  
DonchianUpper = HHV( Ref( H, -1 ), pds ); // Highest high value of highs in last 20 periods 
DonchianLower = LLV( Ref( L, -1 ), pds ); // Lowest low value of low in last 20 periods 
DonchianMiddle = ( DonchianUpper + DonchianLower ) / 2; 
  
UpTrend = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) ) AND EMA( Close, 20 ) > EMA( Close, 40 ); 
DnTrend = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) ) AND EMA( Close, 20 ) < EMA( Close, 40 ); 
Color = IIf( UpTrend, colorBlue, IIf( DnTrend, colorRed, colorYellow) ); 
  
// Plots a 20 period Donchian channel 
Plot( C, "Price", Color, styleBar | styleThick ); 
NewDay = IIf(Day() != Ref(Day(), -1) OR BarIndex() == LastValue(BarIndex()), 1, 0); 
//Plot(NewDay, "", 47, 2 + 32768 + 4096, Minvalue = 0, Maxvalue = 1); 
_SECTION_END();

4 comments

1. hmsanil
almost 14 years ago

HI Panno,

Please tell us how to interprete this indicator for 15 minutes usage elaborately

Thanks

Sudha

2. Divyesh
almost 14 years ago

@Panno,
thnx for daily level….!
i had used weekly levels now this helps me in daily level….!
Thnx once again….!

almost 14 years ago

It is not working in 15 minutes or hourly timeframe. Kindly check it. (Only working in daily and weekly)

Leave Comment

Please login here to leave a comment.