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

[amibroker] Re: Colored Lines



PureBytes Links

Trading Reference Links

I applied your suggestion but it doesn't change the result.  The code
is as follows:

------------------------------------------------

//---- Weekly Woodie pivot points
TimeFrameSet(inWeekly);
WeekH = Ref(H, -1);	//last week's high
WeekL = Ref(L, -1);	// 	low
WeekC = Ref(C, -1);	//	close
WeekO = O;		// current week's open

// Pivots
PP = (WeekH + WeekL + WeekO + WeekO) / 4 ;
R1  =  (2 * PP) - WeekL;
S1  =  (2 * PP) - WeekH;
R2  =  PP + (WeekH - WeekL);
S2  =  PP - (WeekH - WeekL);
TimeFrameRestore();

wPIVOT = TimeFrameExpand(pp,inWeekly);

Plot(TimeFrameExpand(R1,inWeekly),
"R1",colorRed,styleDots+styleNoLine+styleNoLabel);
Plot(TimeFrameExpand(S1,inWeekly),
"S1",colorDarkGreen,styleDots+styleNoLine+styleNoLabel);
Plot(TimeFrameExpand(R2,inWeekly),
"R2",colorRed,styleDots+styleNoLine+styleNoLabel);
Plot(TimeFrameExpand(S2,inWeekly),
"S2",colorDarkGreen,styleDots+styleNoLine+styleNoLabel);

Plot(wPIVOT,"",IIf(wPivot>Ref(wPivot,-1),colorBrightGreen,
            IIf(wPivot<Ref(wPivot,-1),colorDarkRed,
            colorWhite)),
            styleDots+styleNoLabel);

---------------------------------------------------



It seems that the code evaluates bar-by-bar when it's applied on a 60
minute chart and the comparison for the current week versus last
results to an "equal" (wPivot > Ref (wPivot, -1).  Even if I change
that line and make it wPivot >=Ref (wPivot,-1) doesn't draw correctly.
  

Any other ideas?  Thanks for taking the time

Costas

--- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxx> wrote:
>
> Okay, I tried your code. The intervening dots don't actually exist
> because you have done weekly get prices, they are being filled by code
> that plugs holes and thus are not compared in your color test.
> 
> Try setting the timeframe to inWeekly first.
> Compute your weekly averages and PP
> Restore the timeframe
> Then do
> 
> PPD = TimeFrameExpand(PP,inWeekly); //Check my syntax here!
> 
> Then the plot colors should work as now there are dots for every day.
> --
> Terry
> 
> -----Original Message-----
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> Behalf Of cyclicaltrader
> Sent: Sunday, August 13, 2006 20:40
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Colored Lines
> 
> Hi Terry and thanks for the reply
> 
> I must be missing something.  "PP" is the calculation of the pivot. 
> What do you mean by saying "actual"?  Even if I remove the dotted line
> and let the pivot draw as a simple line, it will still don't color
> properly.
> 
> Thanks for the help and i appreciate any help you can provide
> 
> Costas
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@> wrote:
> >
> > Costas,
> > 
> >  
> > 
> > I don't see where you apply the same logic to any dotted line.
> > 
> >  
> > 
> > Try this:
> > 
> >  
> > 
> > Color = IIf(PP
> >
> >Ref(PP,-1),colorBrightGreen,IIf(PP<Ref(PP,-1),colorDarkRed,colorWhite))
> > ;
> > 
> > Plot(PP, "",color,styleDots+styleNoLabel);
> > 
> > Plot(xxx,"",color,stylexyz); //Where this is your "actual pivot" plot
> > 
> > --
> > 
> > Terry
> > 
> >  
> > 
> > -----Original Message-----
> > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
> > Behalf Of cyclicaltrader
> > Sent: Sunday, August 13, 2006 16:47
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Colored Lines
> > 
> >  
> > 
> > Hi,
> > 
> >  
> > 
> > I took a piece of code I found in the AFL library and modified it to
> > 
> > add coloring.  For some reason something doesn't work right.
> > 
> >  
> > 
> > The code is the following:
> > 
> >  
> > 
> > ---------------------------------------
> > 
> >  
> > 
> > WeekH = TimeFrameGetPrice("H", inWeekly, -1);
> > 
> > WeekL = TimeFrameGetPrice("L", inWeekly, -1);
> > 
> > WeekC = TimeFrameGetPrice("C", inWeekly, -1);
> > 
> > WeekO = TimeFrameGetPrice("O", inWeekly);
> > 
> >  
> > 
> > PP = (WeekH + WeekL + WeekO + WeekO) / 4 ;
> > 
> >  
> > 
> > Plot(PP, "",IIf(PP >Ref(PP,-1),colorBrightGreen,           
> > 
> > IIf(PP<Ref(PP,-1),colorDarkRed,colorWhite)),styleDots+styleNoLabel);
> > 
> >  
> > 
> > -------------------------------------------
> > 
> >  
> > 
> > The line changes from red to green and visa versa depending if the
> > 
> > weekly pivot is higher (or lower) than last week's pivot.  But the
> > 
> > dotted line (which is the actual pivot) doesn't hold the green or red
> > 
> > color. The "colorwhite" was added just to complete the IIF statement.
> > 
> >  
> > 
> > The pivot should be either red or green.
> > 
> >  
> > 
> > Thanks in advance
> > 
> >  
> > 
> > Costas
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> > Please note that this group is for discussion between users only.
> > 
> >  
> > 
> > To get support from AmiBroker please send an e-mail directly to 
> > 
> > SUPPORT {at} amibroker.com
> > 
> >  
> > 
> > For other support material please check also:
> > 
> > http://www.amibroker.com/support.html
> > 
> >  
> > 
> >  
> > 
> > Yahoo! Groups Links
> > 
> >  
> > 
> >     http://groups.yahoo.com/group/amibroker/
> > 
> >  
> > 
> >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > 
> >  
> > 
> >     http://docs.yahoo.com/info/terms/
> >
> 
> 
> 
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
>  
> Yahoo! Groups Links
>