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

[amibroker] Re: need assistance in generating buy signal with zig indicator


  • Date: Sun, 14 Mar 2010 20:33:21 -0000
  • From: "wooziwog" <xcitemint@xxxxxxx>
  • Subject: [amibroker] Re: need assistance in generating buy signal with zig indicator

PureBytes Links

Trading Reference Links

rijnaa,
I have posted code that shows the zig Hi Lo pivots plotted as small pink and green circles.  In addition pink and green arrows are plotted showing when the zig Hi or Lo would actually plot in real time.  In other words the price must change by "x" percent before the previous Hi or Lo becomes valid. You will see visually that the zig line looks great but the valid entry and exits often occur near turning points or pullbacks.
I have also included red and blue circles for Hi/Lo fractals.
They can produce much better results since you can confirm high and low pivots quickly. No percentage settings are necessary for fractals, you just need to filter the highs and lows (multiple highs may occur with no lows and vice versa. 
One example of a filter would be to check the percentage change of a fractal Hi or Lo to your zig Hi Lo setting for pivot confirmation

David K.

 

function zhilo(pct)  {
   pk=PeakBars(H,pct)==0; tr=TroughBars(L,pct)==0;
   zHi=Zig(H,pct); zLo=Zig(L,pct); HLAvg=(zHi+zLo)/2;
   zv=IIf(pk,zHi,IIf(tr,zLo,IIf(HLAvg>Ref(HLAvg,-1),H,L)));
return Zig(zv,pct);  }
//===========================
Plot( C, "Close",47,64);
pct=0.50;
zhl=zhilo(pct);
plot(zhl,"",29,1);
ppR=Ref(zhl,-1)<zhl AND zhl>Ref(zhl,1);//pk
ppS=Ref(zhl,-1)>zhl AND zhl<Ref(zhl,1);//tr
PlotShapes(shapeSmallCircle*ppS,43,0,L,-10); 
PlotShapes(shapeSmallCircle*ppR,40,0,H, 10);
//Zig RealTime Change
ppSv=IIf(L>(1+(LastValue(pct)/100))*(ValueWhen(ppS,L,1))AND ROC(zhl,1)>0,1,0); 
ppRv=IIf(H<(1-(LastValue(pct)/100))*(ValueWhen(ppR,H,1))AND ROC(zhl,1)<0,1,0); 
ppSv=ExRem(ppSv,ppRv);   ppRv=ExRem(ppRv,ppSv);
PlotShapes(shapeUpArrow*ppSv,43,0,L,-20); 
PlotShapes(shapeDownArrow*ppRv,40,0,H,-20);

//Fractal High Lows
minbars=3;
bi= BarIndex();
pk=H==HHV(H,2*minbars) AND Ref(HHV(H,minbars),minbars)< H;
pk=pk AND LastValue(bi)-ValueWhen(pk,bi)> minbars;
tr=L==LLV(L,2*minbars) AND Ref(LLV(L,minbars),minbars)> L;
tr=tr AND LastValue(bi)-ValueWhen(tr,bi)> minbars;
PlotShapes(shapeSmallCircle*pk,colorRed,0,H,20);
PlotShapes(shapeSmallCircle*tr,colorBlue,0,L,-20);
--- In amibroker@xxxxxxxxxxxxxxx, "rijnaars" <rijnaa@xxx> wrote:
>
> How do i correct future related parts in Zig indicator
> 
> i suppose it has to do with this part: 
> 
> change = Param("% change",5,0.1,25,0.1);
> 
> need help
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "rijnaars" <rijnaa@> wrote:
> >
> > Thanks Mike, can you tell me where i should correct the signals to no longer look in the future
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> > >
> > > 1. You cannot trade a system that uses Zig unless you correct the signals to no longer be looking into the future. What you have now *looks into the future*, just be aware of that.
> > > 
> > > 2. Zig is the name of a function, you cannot use it without providing the function arguments.
> > > 
> > > e.g.
> > > Condition1 = Zig > Ref(Zig, -1); <-- this is wrong
> > > 
> > > Instead do
> > > 
> > > PZig = Zig(P, change);
> > > Condition1 = PZig > Ref(PZig, -1);
> > > 
> > > Mike
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "rijnaars" <rijnaa@> wrote:
> > > >
> > > > _SECTION_BEGIN("ZIG - Zig");
> > > > P = ParamField( "Price field" );
> > > > change = Param("% change",5,0.1,25,0.1);
> > > > Plot( Zig(P, change), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
> > > > 
> > > > Condition1=Zig>Ref(Zig,-1); 
> > > > Condition2=Ref(Zig,-1)<Ref(Zig,-2);
> > > > Condition2=Zig<Ref(Zig,-1);
> > > > 
> > > > Buy= Condition1;
> > > > Sell= Condition2;
> > > > 
> > > > shape = Buy * shapeUpArrow + Sell * shapeDownArrow;//No same day buy sell possible 
> > > > PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );;
> > > > 
> > > > _SECTION_END();
> > > > 
> > > > I get the next errors
> > > > 
> > > > ln6 col15: error 31 syntax error expecting "("
> > > > ln7 col15: error 31 syntax error expecting "("
> > > > ln8 col15: error 31 syntax error expecting "("
> > > > ln10 col16: error 29 variable condition1 used without having been initialized.
> > > > ln11 col17: error 29 variable condition1 used without having been initialized.
> > > >
> > >
> >
>




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

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