Help me to convert amibroker code to Meta stock

rajuwaste

Active Member
#1
Hi Friends,
I am learning to create custom indicator.Recently I downloaded code related to amibroker.I decided to recode it into metastock.I converted almost all the lines except the last two lines in the code.In amibroker there is plot function available,is there any equvalent function available in metastock or help me to recode the following amibroker code.

x = Cum(1);

perchg = 0.3*LastValue( Highest( ROC( Low, 50 ) ));

startvalue = LastValue( Trough( Low, perchg, 1 ) );
endvalue1 = LastValue( Trough( Low, perchg, 2 ) );

startbar = LastValue( ValueWhen( Low == startvalue, x, 1 ) );
endbar = LastValue( ValueWhen( Low == endvalue1, x, 1 ) );

Aa = (endvalue1-startvalue)/(endbar-startbar);
b = startvalue;

trendline = Aa * ( x - startbar ) + b;

Plot( Close, "Price", colorBlue, styleCandle );
Plot( IIf( x >= endbar, trendline, Null ), "Trendline", colorRed );

:)
 

oxusmorouz

Well-Known Member
#2
Hi Friends,
I am learning to create custom indicator.Recently I downloaded code related to amibroker.I decided to recode it into metastock.I converted almost all the lines except the last two lines in the code.In amibroker there is plot function available,is there any equvalent function available in metastock or help me to recode the following amibroker code.

Plot( Close, "Price", colorBlue, styleCandle );
Plot( IIf( x >= endbar, trendline, Null ), "Trendline", colorRed );

:)
Plot1:= If(X >=endbar,trendline,prev);
Plot1

You will have to plot this in the price window.
 

Similar threads