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

[amibroker] Re: Plot Ribbon or Bands (Offset)?



PureBytes Links

Trading Reference Links

That didn't fix the problem.  Here is the code for the indicator, 
apply this and you will see what I am talking about.


///////////////////////////////////////////////////////////
//3-Bar Indicator
//////////////////////////////////////////////////////////


//Identifys number of lookback bars to ignore inside days
Countbars=BarIndex()-ValueWhen(Inside()==0,BarIndex(),4);

//Long and Short Setups
HigherClose = C > Ref(C,-1);
LowerClose = C < Ref(C,-1);

//3-bar stop level
ThreeBarLow = LLV(L,Countbars);
ThreeBarHigh = HHV(H,Countbars);

//Recalculates stop based on a higher close or lower close
LowerStopLoss = IIf(HigherClose, ThreeBarLow, Ref(ThreeBarLow,-1));
UpperStopLoss = IIf(LowerClose, ThreeBarHigh, Ref(ThreeBarHigh,-1));

//Plots stop loss staircase
Plot(LowerStopLoss,"Lower Stop",ParamColor("Lower Color", 
colorLime), styleStaircase);
Plot(UpperStopLoss,"Upper Stop",ParamColor("Upper Color", 
colorOrange ),styleStaircase);

//Long and Short stop loss levels
LongStopOut = C < LowerStopLoss;
ShortStopOut = C > UpperStopLoss;

//Identifying if there is an open long or short position
LongPosition = Flip(HigherClose,LongStopOut);
ShortEntry = LowerClose AND LongPosition == 0;
ShortPosition = Flip(ShortEntry,ShortStopOut);

//Bands
LongShortBand = IIf(LongPosition==1 AND Ref(ShortPosition==0,-
1),1,0);
Color = IIf(LongShortBand==1,colorLime,colorOrange);
Plot(1,"",Color,styleArea|styleOwnScale|styleNoLabel);





--- In amibroker@xxxxxxxxxxxxxxx, "cstrader" <cstrader232@xxxx> 
wrote:
>
> Try:
> 
> value = your variable;
> Priorvalue(value, -1);
> 
> Then plot priorvalue variable.
> 
> ----- Original Message ----- 
> From: "sslack88" <jzzpiano88@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, January 23, 2006 4:43 PM
> Subject: [amibroker] Plot Ribbon or Bands (Offset)?
> 
> 
> > When I plot a ribbon or a band on the chart it changes color in 
> > between the bars, is there a way to plot the color change right 
on the 
> > bar when the condition changes?
> > 
> > For Example:
> > When LongShortPosition variable changes from 1 to 0 on a 
specific bar, 
> > I want the color to change right there.
> > 
> > 
> > 
> > 
> > 
> > 
> > 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
> > 
> > 
> > 
> > 
> > 
> > 
> >
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/