PureBytes Links
Trading Reference Links
|
Hello
Thanks for your message.
Im new for amibroker and I try to use the AFL in a trading system
I have seen a indicator as shown herewith
http://www.amibroker.com/members/traders/01-2004.html
Please could you help me to make the language compatible for realtime trading with for example QQQ and BRCD.
At this moment I can see the results but there are no buy or sell signals ( arrows in green and red ) visible?
Thanks in advance for your help.
With kind regards
Hans Veger
Netherlands
hvgistel@xxxxxxxxxx
//--Indicator-End--
// Above line instructs the parser that the code
// below is only for commentary/interpretation window
// This provides significant performance improvement
//
// (C)2002 amibroker.com
movshort = MA( C, Prefs(4) );
movmed = MA( C, Prefs(6) );
movlong = MA( C, Prefs(28) );
btop = BBandTop( C, Prefs( 4 ), Prefs(8)/100 );
bbot = BBandBot( C, Prefs(4), Prefs(8)/100 );
width = btop - bbot;
lslop = LinRegSlope( C, 30 ) + 100;
lslo = LLV( lslop, 90 );
lshi = HHV( lslop, 90 );
lswidth = lshi - lslo;
trend = 100*( lslop - lslo )/lswidth;
mawidth = MA( width, 100 );
relwidth = 100*(width - mawidth)/mawidth;
_N( tname = Name()+"("+FullName()+")" );
Buy = Close < Ref(C,-1) AND Ref(Close,-1) < Ref(Close,-2) AND Ref(Close,-2) < Ref(Close,-3)AND Ref(Close,-3) < Ref(Close,-4) AND Ref(Close,-4) < Ref(Close,-5) ;
Sell =
Close > Ref(C,-1) AND Ref(Close,-1) > Ref(Close,-2) AND Ref(Close,-2) > Ref(Close,-3)AND Ref(Close,-3) > Ref(Close,-4) AND Ref(Close,-4) > Ref(Close,-5) ;
"Price and moving averages:";
tname + " has closed " + WriteIf( C > movshort, "above" , "below" ) + " its short time moving average. ";
"Short time moving average is currently " + WriteIf( movshort > movmed, "above", "below") + " mid-time, and " + WriteIf( movshort > movlong, "above", "below" ) + " long time moving averages.";
"The relationship between price and moving averages is: "+
WriteIf( C > movshort AND movshort > movmed, "bullish",
WriteIf( C < movshort AND movshort < movmed, "bearish", "neutral" ) ) + " in short-term, and "+
WriteIf( movshort > movmed AND movmed > movlong , "bullish",
WriteIf( movshort < movmed AND movmed < movlong, "bearish", "neutral" ) ) + " in mid-long term. ";
"\nBollinger Bands:";
tname+ " has closed " +
WriteIf( C < bbot, "below the lower band by " +
WriteVal( 100 *( bbot-C )/ width, 1.1 ) + "%. " +
WriteIf( trend < 30, " This combined with the steep downtrend can suggest that the downward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the lower band and a downside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +
WriteIf( C > btop, "above the upper band by " +
WriteVal( 100 *( C- btop )/ width, 1.1 ) + "%. " +
WriteIf( trend > 70, " This combined with the steep uptrend suggests that the upward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the upper band and a upside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +
WriteIf( C < btop AND ( ( btop - C ) / width ) < 0.5,
"below upper band by " +
WriteVal( 100 *( btop - C )/ width, 1.1 ) + "%. ",
WriteIf( C < btop AND C > bbot , "above bottom band by " +
WriteVal( 100 *( C - bbot )/ width, 1.1 ) + "%. ", "" ) );
WriteIf( ( trend > 30 AND trend < 70 AND ( C > btop OR C < bbot ) ) AND abs(relwidth) > 40,
"This picture becomes somewhat unclear due to the fact that Bollinger Bands are currently",
"Bollinger Bands are " )+
WriteVal( abs( relwidth ), 1.1 ) + "% " +
WriteIf( relwidth > 0, "wider" , "narrower" ) +
" than normal.";
WriteIf( abs( relwidth ) < 40, "The current width of the bands (alone) does not suggest anything conclusive about the future volatility or movement of prices.","")+
WriteIf( relwidth < -40, "The narrow width of the bands suggests low volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility increasing with a sharp price move has increased for the near-term. "+
"The bands have been in this narrow range for " + WriteVal(BarsSince(Cross(-40,relwidth)),1.0) + " bars. The probability of a significant price move increases the longer the bands remain in this narrow range." ,"")+
WriteIf( relwidth > 40, "The large width of the bands suggest high volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility decreasing and prices entering (or remaining in) a trading range has increased for the near-term. "+
"The bands have been in this wide range for " + WriteVal(BarsSince(Cross(relwidth,40)),1.0) + " bars.The probability of prices consolidating into a less volatile trading range increases the longer the bands remain in this wide range." ,"");
Buy=Cross(MACD(), Signal());
Sell=Cross(Signal(), MACD());
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
Plot( Close, "Price", colorBlue
, styleCandle );
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
GraphXSpace = 5;
Y=5;
X=5;
ApplyStop( 0, 1, Y, 1 ); // max loss stop y%
ApplyStop( 1, 1, X, 1 ); // profit target stop x%
five_days_down = IIf(Close < Ref(Close, -1) AND
(Ref(Close, -1) < Ref(Close, -2)) AND
(Ref(Close, -2) < Ref(Close, -3)) AND
(Ref(Close, -3) < Ref(Close, -4)) AND
(Ref(Close, -4) < Ref(Close, -5)), 1, 0);
five_days_up = IIf(Close > Ref(Close, -1) AND
(Ref(Close, -1) > Ref(Close, -2)) AND
(Ref(Close, -2) > Ref(Close, -3)) AND
(Ref(Close, -3) > Ref(Close, -4)) AND
(Ref(Close, -4) > Ref(Close, -5)), 1, 0);
Buy = five_days_down;
Sell = five_days_up;
Buy = Sum( ROC( Close, 1 ) > 0, 5 ) == 5;
Sell = Sum( ROC( Close, 1 ) < 0, 5 ) == 5;
Buy = High == LastValue( Highest( High ) );
Buy = High == HHV( High, 20 ) AND Ref( HHVBars( High, 20 ), -1 ) >=4;
Buy = Cross( MACD(), 0 );
Sell = Cross( 0, MACD() );
Buy = Cross( EMA( Close, 9 ), EMA( Close, 15 ) );
Sell = Cross( EMA( Close, 15 ), EMA( Close, 9 ) );
Buy = Cross( RSI(), 30 );
Sell = Cross( 70, RSI() );
Buy = Cross( Ultimate(), 50 );
-------Original Message-------
From: amibroker@xxxxxxxxxxxxxxx
Date: zondag 14 december 2003 17:41:55
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: 2 days bar?
A shorter code, but it works (varsågod).Beware of linewrap.x=Param("Days",2,2,5);y=Cum(1)%x==0;Ox=IIf(y,Ref(O,-(x-1)),Null);Hx=IIf(y,HHV(H,x),Null);Lx=IIf(y,LLV(L,x),Null);Cx=IIf(y,C,Null);Vx=Sum(V,x);Change=100*(Cx-Ref(C,-x))/Ref(C,-x);PlotOHLC(Ox,Hx,Lx,Cx,"",colorBlack,styleCandle);GraphXSpace=3;Title=WriteIf(!IsNull(Cx),Name()+" "+WriteVal(x,1.0)+"-day bars "+" Open "+WriteVal(Ox,1.2)+", Hi "+WriteVal(Hx,1.2)+", Lo"+WriteVal(Lx,1.2)+", Close "+WriteVal(Cx,1.2)+" ("+WriteVal(Change,1.1)+"%) "+" Volume "+WriteVal(Vx,1.0),Name()+" "+WriteVal(x,1.0)+"-Day bars "+" {EMPTY}");/Johan :)--- In amibroker@xxxxxxxxxxxxxxx, "Johan" <epostens@xxxx> wrote:> Hi! Thanks for your help! So much? :/> > > > > --- In amibroker@xxxxxxxxxxxxxxx, "theoldchartreader" > <theoldchartreader@xxxx> wrote:> > Hi,> > Yes you can do it, just change the factor to 2.> > > > // compress price time series by a given factor> > // e.g. 5 into 1 is like weekly view> > // by Junya Ho (JUNYAdotHO@xxxxxxxxxxxxxxxxxxx)> > barnum = Cum(1);> > numbars = LastValue(barnum);> > factor = 3; // compress FACTOR bars into 1> > > > // number of compressed bars> > numcbars = ceil(numbars / factor);> > > > delta = numbars - barnum;> > > > factorbeginidx = - factor * delta - factor + 1 + delta;> > factorendidx = - factor * delta + delta;> > > > newo = IIf(barnum < numbars - numcbars, 0, Ref(O, factorbeginidx));> > newh = IIf(barnum < numbars - numcbars, 0, Ref(HHV(H, factor), > > factorendidx));> > newl = IIf(barnum < numbars - numcbars, 0, Ref(LLV(L, factor), > > factorendidx));> > newc = IIf(barnum < numbars - numcbars, 0, Ref(C, factorendidx));> > > > Daystart_str = WriteVal(Ref(Year(), factorbeginidx), 1.0) + "-" +> > WriteVal(Ref(Month(), factorbeginidx), 1.0) + "-" + WriteVal(Ref(Day> > (),> > factorbeginidx), 1.0);> > > > Dayend_str = WriteVal(Ref(Year(), factorendidx), 1.0) + "-" +> > WriteVal(Ref(Month(), factorendidx), 1.0) + "-" + WriteVal(Ref(Day> (),> > factorendidx), 1.0);> > > > > > PlotOHLC(newo, newh, newl, newc, WriteVal(factor, 1.0) + "-period > > price", 17,styleBar);> > > > Title = WriteVal(factor, 1.0) + "-period candlesticks, O:" + > WriteVal> > (newo) +> > ", H:" + WriteVal(newh) + ", L:" + WriteVal(newl) + ", C:" + > > WriteVal(newc)> > + ", from: " + Daystart_str + ", to: " + Dayend_str;> > > > > > > > > > good luck,> > Dennis> > > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "Johan" <epostens@xxxx> wrote:> > > Is it possible to have bars that shows for example 2 daily bars > in > > > one? Just like weekly is five..> > > > > > Thank youSend BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to suggest@xxxxxxxxxxxxx-----------------------------------------Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
____________________________________________________ IncrediMail - Email has finally evolved - Click Here
Yahoo! Groups Sponsor
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Attachment:
Description: ""
|