请教大大一个问题
_SECTION_BEGIN("MACDPrediction");/*An MACD, Signal Cross is, in general, a bullish Signal.
Since it comes with a significant delay, it would be important to anticipate this Cross. Some days before the Cross, we often see an MACD turning point. It is interesting to investigate the related conditions AND use them before the end of the session.
The following AFL code will give the necessary next ROC for a higher MACD value.*/
//The probable Cross between MACD AND its Signal, by D. Tsokakis, Feb2005
SetBarsRequired(10000,0);
function EMAn ( Cnext , r3)
{
return ( 2 * Cnext + ( r3 - 1 ) * EMA ( C , r3 ) ) / ( r3 + 1 ) ;
}
function MACDn ( Cnext , r1 , r2 )
{
return EMAn ( Cnext ,r1 ) - EMAn ( Cnext , r2 ) ;
}
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
det = 500 ;
perc = 25/100 ;
Clast = SelectedValue ( C ) ;
det = 500 ;
perc = 25/100 ;
Clast = SelectedValue ( C ) ;
MACDlast = SelectedValue(MACD());
SIGNALlast = SelectedValue ( Signal ( ) );
Cnextmin = ( 1 - perc ) * Clast ;Cnextmax = ( 1 + perc ) * Clast ;
step = ( Cnextmax - Cnextmin ) / det ;
nextROC1 = -100 * perc ;
nextROC2 = -100 * perc ;
for ( Cnext = Cnextmin ; Cnext <= Cnextmax ; Cnext = Cnext + step )
{
X = MACDn ( Cnext , 12 , 26 ) ;
Y = EMA ( X , 9 ) ;
MACDnext = SelectedValue ( X );
SIGNALnext = SelectedValue ( Y );
NextROC = 100 * ( -1 + Cnext / Clast ) ;
NextROC0 = 100 * ( -1 + Cnext / Clast ) ;
if ( macdnext < SignalLAST )
{
NextROC1 = NextROC ;
}
if ( MACDnext < MACDlast )
{
nextROC2 = nextROC0;
}
}
//Plot ( 0 ,"", colorBlack ,styleDashed ) ;
Plot (nextROC1,"", colorRed) ;
Plot ( nextROC2 ,"", colorGreen) ;
_SECTION_END();
请教程式如何改 才能得到每日的nextROC1和nextROC2
Can anybody help me? Thanks SelectedValue的问题? Plot (nextROC1,"nextROC1", colorRed) ;
Plot ( nextROC2 ,"nextROC2", colorGreen) ; 不行,一样的。只能得到两条直线 Title = "NextROC1 = "+nextroc1+" NextROC2 = "+nextroc2;
hitrader 發表於 14-5-16 13:38 static/image/common/back.gif
Title = "NextROC1 = "+nextroc1+" NextROC2 = "+nextroc2;
只能显示当日的数据 见图
{:4_95:}anybody help me? hangye 發表於 14-5-17 17:49 static/image/common/back.gif
anybody help me?
把 SelectedValue去掉試試看唷~~
还是不行唷,大大 这段程式码实在难懂{:4_87:}
頁:
[1]