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

[amibroker] Help with entry price?



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, Khai Nguyen <ntk98_2000@xxxx> wrote:
> I think the way you implement has similarity with how the pivot 
finder is calculated. Would it mean if you see a buy signal and see 
after few days the price start cut the parabolic trend line and start 
to move sideways you has to be careful and prepare to leave possible 
with a stop order.
>  
> But sometime the price could follow the trend again (the 5% approx 
rule: if C not falling more then 5%, trend is still not broken), so I 
like to use other indicator to confirm\ or prepare. For example open 
and close a trade using this folling method:
> a) The D-day: If parabolic Trend shows an uptrend for 2 consecutive 
days and MFI() has given a positive signal in the last 5 days, only 
then the parabolic trend buy signal is confirmed. and 
> b) The pill after:
> If parabolic trend has given a positive buy signal, but when in the 
next 2 days if an very-heavy-Z indicator issues a sell signal then, 
total is a sell signal 
>  
> It would be very helpful and educative for me if you could show how 
do I have to code this? (in an complex and\or a simple but effective 
ways if possible)


> Plus, how would you code so that MFI() and parabolic trend line can 
>be shown in ONE chart (general different scale problem)

It ia already available in AFL structure via 
StyleOwnScale/StyleLeftAxisScale 


> DIMITRIS TSOKAKIS <TSOKAKIS@xxxx> wrote:
> Khai,
> Well, p0 and p1 are the boundaries of the parabolas.
> The best-fit parabolic should lie somewhere between, but the 
> boundaries should cover a relatively wide range.
> In order to avoid extremes, I plot them between LLV(L,200) and HHV
> (H,200), I think it is good [you may change 200 to 100 or 500 
anyway]
> Here is the full code :
> 
> Plot(C,"C",1,64);
> perc=3;//sensitivity calibration
> x=BarIndex();xx=LastValue(x);
> t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x));
> H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H));
> t11=LastValue(ValueWhen(TroughBars(L,perc)==0,x));
> H11=LastValue(ValueWhen(TroughBars(L,perc)==0,L));
> g=t1>t11;
> shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x==t11));
> Color=IIf(g,colorRed,colorBrightGreen);
> PlotShapes(shape,color);
> t=IIf(g,x-t1,x-t11);
> diff1=IIf(g,H1*(xx-t1),H11*(xx-t11));
> Lma=LastValue(MA(C,50));
> f1=0;f2=IIf(Lma<100,1,0)+3*int(log10(Lma));
> fa=0;fb=0;step=f2/100;
> for(f=f1;f{
> parabolic=IIf(g,H1-f*t^2,H11+f*t^2);
> S1=LastValue(Sum(abs(parabolic-H),xx-t1));
> S11=LastValue(Sum(abs(parabolic-L),xx-t11));
> diff=IIf(g,S1,S11);
> if(diff{
> diff1=diff;fa=f;
> }
> }
> for(f=Max(fa-step,0);f{
> parabolic=IIf(g,H1-f*t^2,H11+f*t^2);
> S1=LastValue(Sum(abs(parabolic-H),xx-t1));
> S11=LastValue(Sum(abs(parabolic-L),xx-t11));
> 
> diff=IIf(g,S1,S11);
> if(diff{
> diff1=diff;fb=f;
> }
> }
> p=IIf(g,H1-fb*t^2,H11+fb*t^2);
> p0=IIf(g,H1-f2*t^2,H11+f2*t^2);
> p0=IIf(p0>LLV(L,200) AND p0p1=IIf(g,H1,H11);
> Plot(IIf(x>=Max(t1,t11),p,-1e10),"",color,8);
> Plot(IIf(x>=Max(t1,t11),p0,-1e10),"",color+1,1);
> Plot(IIf(x>=Max(t1,t11),p1,-1e10),"",color+1,1);
> Title=Name()+", "+WriteIf(t1>t11,"f_desc","f_asc")+"="+WriteVal
> (fb,1.4);
> GraphXSpace=3;
> 
> p1 will be horizontal, p0 will be sharp enough [some times will not 
> be visible, when the very next [after the peak] price is out of 
> limits].
> p0 and p1 colors are next shades to the main parabolic [color, 
> color+1].
> 
> Dimitris
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, Khai Nguyen wrote:
> > Could it be it is like this:
> > "
> > // The last best-fit parabolic trendline, by D. Tsokakis, 
Sept2004 
> > Plot(C,"C",1,64); 
> > perc=3;//sensitivity calibration 
> > x=BarIndex();xx=LastValue(x); 
> > t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x)); 
> > H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H)); 
> > t11=LastValue(ValueWhen(TroughBars(L,perc)==0,x)); 
> > H11=LastValue(ValueWhen(TroughBars(L,perc)==0,L)); 
> > g=t1>t11; 
> > shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x==t11)); 
> > Color=IIf(g,colorRed,colorBrightGreen); 
> > PlotShapes(shape,color); 
> > t=IIf(g,x-t1,x-t11); 
> > diff1=IIf(g,H1*(xx-t1),H11*(xx-t11)); 
> > Lma=LastValue(MA(C,50)); 
> > f1=0;f2=IIf(Lma<100,1,0)+3*int(log10(Lma)); 
> > fa=0;fb=0;step=f2/100; 
> > for(f=f1;f> { 
> > parabolic=IIf(g,H1-f*t^2,H11+f*t^2); 
> > S1=LastValue(Sum(abs(parabolic-H),xx-t1)); 
> > S11=LastValue(Sum(abs(parabolic-L),xx-t11)); 
> > diff=IIf(g,S1,S11); 
> > if(diff> { 
> > diff1=diff;fa=f; 
> > } 
> > } 
> > for(f=Max(fa-step,0);f> { 
> > parabolic=IIf(g,H1-f*t^2,H11+f*t^2); 
> > S1=LastValue(Sum(abs(parabolic-H),xx-t1)); 
> > S11=LastValue(Sum(abs(parabolic-L),xx-t11)); 
> > diff=IIf(g,S1,S11); 
> > if(diff> { 
> > diff1=diff;fb=f; 
> > } 
> > } 
> > p=IIf(g,H1-fb*t^2,H11+fb*t^2); 
> > p0=IIf(g,H1-f2*t^2,H11+f2*t^2); 
> > p1=IIf(g,H1,H11); 
> > //p0=IIf(p0>LLV(L,200), p0, p1=IIf(g,H1,H11)); 
> > Plot(IIf(x>=Max(t1,t11),p,-1e10),"",color,8); 
> > //Plot(IIf(x>=Max(t1,t11),p0,-1e10),"",color+1,1); 
> > Plot(IIf(x>=Max(t1,t11),p1,-1e10),"",color+1,1); 
> > Title=Name()+", "+WriteIf(t1>t11,"f_desc","f_asc")+"="+WriteVal
> (fb,1.4);//+"[f2="+WriteVal(f2)+",step="+WriteVal(step); 
> > GraphXSpace=3; 
> > "
> > PS: 
> > "The Strange Plot"
> > I have to tyake one line of your code out "
> > Plot(IIf(x>=Max(t1,t11),p0,-1e10),"",color+1,1);" because it 
shows 
> an heavy upwards parabol while price remains in a flat line because 
> the scale too different. (It thows an interesting question: How 
would 
> you normalise two graphs of different scale for example MACD and 
TSV 
> so that we can monitor theirs behaviour on one chart only?)
> > 
> > Could you explain what that line plots? An expected trend? In 
that 
> case many stock trade sideways but trendline shown strongly up.
> > 
> > Thanks for the formula, and thank for your time to explain or 
> correct "the strange plot"
> > 
> > 
> > 
> > 
> > Khai Nguyen wrote:
> > 
> > DT,
> > 
> > The formula on Elitetrader contains errors. Please correct them. 
> > 
> > 
> > 
> > ---------------------------------
> > ALL-NEW Yahoo! Messenger - all new features - even more fun! 
> > 
> > [Non-text portions of this message have been removed]
> > 
> > 
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at: 
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > ALL-NEW Yahoo! Messenger - all new features - even more fun! 
> > 
> > [Non-text portions of this message have been removed]
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 		
> ---------------------------------
>  ALL-NEW Yahoo! Messenger - all new features - even more fun!  
> 
> [Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.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/