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

Re: [amibroker] In Trade Index



PureBytes Links

Trading Reference Links

Thanh you for your quick response , your formula is good. But it works not always.
 
I think it is a problem of  "QUICKAFL" activation ( I have not find in the doc, what is exactly this "QUICKAFL"
 
Best regards 
 
Alain
 
----- Original Message -----
Sent: Thursday, March 22, 2007 2:36 PM
Subject: Re: [amibroker] In Trade Index

You have to take care of the conditions before the first buy/sell signal.  So try something like this which will result in intrade == 0 before the first signal and then your 1, -1 thereafter:
 
buybar = iif(barindex() == 0, 0, valuewhen(buy, barindex(), 1));
sellbar = iif(barindex() == 0, 0, valuewhen(sell, barindex, 1));
intrade = iif(barbuy > barsell, 1, iif(barsell > barbuy, -1, 0)):
 
Bill
 
 
----- Original Message -----
From: Alain Baur
Sent: Thursday, March 22, 2007 3:48 AM
Subject: [amibroker] In Trade Index

Hi
I would like to create an index ( "InTrade") which indicates if i am On the market or no.
 
This formula works well but only after the two first trades (Buy then sell or sell then Buy)
 

SetChartOptions(1,chartShowDates);

GraphXSpace = 10 ;

Plot(Close, "C", colorBlack, styleCandle);

X = BarIndex();

MA10 = MA(C, 10) ;

MA50 = MA(C, 50);

Plot(MA10, "MA10", colorBlue, styleLine);

Plot(MA50, "MA50", colorRed, styleLine);

Buy = Cross(MA10, MA50);

Sell = Cross(MA50, MA10);

BarBuy = ValueWhen(Buy, X, 1);

BarSell = ValueWhen(Sell, X, 1);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone), colorGreen, 0, L, -12);

PlotShapes(IIf(Sell, shapeDownArrow, shapeNone), colorRed, 0, H, -12);

intrade = IIf( BarBuy > BarSell , 1, -1);

Title = " " + Name() + " - " + Date() + " - BarBuy = " + BarBuy + " - BarSell = " + BarSell

+ " - Intrade = " + intrade + " " ;

 Is it possible to write an other formula which works since the beginning of the Array ? 
 
 
Thank's for your response


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.14/727 - Release Date: 3/19/2007 11:49 AM

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___