PureBytes Links
Trading Reference Links
|
Dimitris, I had to chuckle here. I get the feeling if I were to ask you for directions to the restroom your response would be -
"oh it's easy, just do this....
MaxGraph = 8;K=EMA((H+L+C)/3,10);S1=2*(K-Ref(K,-1))/(K+Ref(K,-1));RS=100+1000*EMA(S1,3);Graph0=RS;Graph0Style=1;Graph0Color=7;Graph1=110;
Your programming skills are amazing. DIMITRIS TSOKAKIS <TSOKAKIS@xxxxxxxxx> wrote:
--- In amibroker@xxxxxxxxxxxxxxx, "jwilsonp2a" <jimnwilson@xxxx> wrote:> j,> > If you want the slope based on the value today and yesterday, I > would use MA(close,x)-MA(ref(close,-1),x), where x is the length of > the moving average. This is the old "rise over run" from algebra. > However, you should normalize this value if you want to compare it > to something else. Say stock A has a MA that was 100 yesterday and > 105 today. The slope would be 5. Stock B has a MA that was 10 > yesterday and 10.5 today. The slope would be 0.5. But both changed > by the same percentage. So you could divide both values by the MA > yesterday, then both would be 0.05, the same "slope".> > Maybe one of the experts out there could clarify one thing:> > Is MA(ref(close,-1),x) the same as
ref(MA(close,x),-1) ?Jim,you don“t need the experts, your IndBuilder may answer the questionx=30; x1=MA(Ref(Close,-1),x) ; x2=Ref(MA(Close,x),-1);Plot(x1,"",colorBlack,1);Plot(x2,"",colorRed,8);As for the slope, I often use the following MaxGraph = 8;K=EMA((H+L+C)/3,10);S1=2*(K-Ref(K,-1))/(K+Ref(K,-1));RS=100+1000*EMA(S1,3);Graph0=RS;Graph0Style=1;Graph0Color=7;Graph1=110;Graph2=90;Graph2Style=1;Graph3=120;Graph4=80;Graph2Color=Graph4Color=4;Graph1Color=Graph3Color=5;Title="R S = "+WriteVal(rs-10,format=1.2)+" ("+WriteVal(Ref(rs-10,-1),format=1.2)+")";Graph5=100;Graph5Style=8;Graph5BarColor=1;x = Cum(1);per = 1;s1=rs;s11=rs;pS = TroughBars( s1, per, 1 ) == 0;endt= LastValue(ValueWhen( pS, x, 1 ));startt=LastValue(ValueWhen( pS, x, 2 ));dtS =endt-startt;endS = LastValue(ValueWhen( pS, s1, 1 ) );startS = LastValue( ValueWhen( pS, s1,
2 ));aS = (endS-startS)/dtS;bS = endS;trendlineS = aS * ( x -endt ) + bS; Graph6 = IIf(x>startt-10,trendlineS,-1e10);Graph6Style = 1;Graph6BarColor = IIf(as>0,5,4);pR = PeakBars( s11, per, 1 ) == 0;endt1= LastValue(ValueWhen( pR, x, 1 ));startt1=LastValue(ValueWhen( pR, x, 2 ));dtR =endt1-startt1;endR = LastValue(ValueWhen( pR, s11, 1 ) );startR = LastValue( ValueWhen( pR, s11, 2 ));aR = (endR-startR)/dtR;bR = endR;trendlineR = aR * ( x -endt1 ) + bR; Graph7 = IIf(x>startT1-10,trendlineR,-1e10);Graph7Style = 1;Graph7BarColor = IIf(Ar>0,5,4);Dimitris Tsokakis> > For the buyprice question, it would be buyprice=MA(close,x)-0.25;> > Hope that helps,> > Jim> > > --- In amibroker@xxxxxxxxxxxxxxx, "jaykwok425" <jaykwok@xxxx> wrote:> > 2 Questions:> > > > 1) How do I calculate the
slope of a moving average?> > > > 2) How would I set buyprice to be 1 tick under a moving average > > (assuming ticksize = 0.25)?> > > > Thanks for answering my newbie questions,> > > > jSend 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
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 the Yahoo! Terms of Service.
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
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
Yahoo! Groups Sponsor
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 the Yahoo! Terms of Service.
|