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

[amibroker] Re: In Trade Index



PureBytes Links

Trading Reference Links

Thanks for the explanation Alain.  My problem was that I was thinking 
only in terms of "long" or "out" and not distinguishing between "out" 
and "sell".

--- In amibroker@xxxxxxxxxxxxxxx, "Alain Baur" <alain.baur@xxx> wrote:
>
> Not exactly, Your formula gives 1 if Buy and 0 if sell
> 
> Then it gives 0 at the begin of the array (where we are not Buy nor 
Sell) and we may believe that we are Sell.
> 
> The complete formula  give 0 at the begining (where Not buy and not 
sell) and after she gives 1 When Buy and -1 when Sell. 
> 
>   ----- Original Message ----- 
>   From: Ron Rowland 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Friday, March 23, 2007 3:29 PM
>   Subject: [amibroker] Re: In Trade Index
> 
> 
>   I believe the following accomplishes the same.
> 
>   inTrade = Flip(Buy,Sell) ;
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> wrote:
>   >
>   > Sorry made mistake
>   > 
>   > inTrade = iif(Flip(Buy,Sell),1,-1) ;
>   > 
>   > -- 
>   > Cheers
>   > Graham
>   > AB-Write >< Professional AFL Writing Service
>   > Yes, I write AFL code to your requirements
>   > http://www.aflwriting.com
>   > 
>   > 
>   > 
>   > On 23/03/07, Graham <kavemanperth@> wrote:
>   > > I think you will find this an easier solution
>   > >
>   > > inTrade = Flip(Buy,Sell) - 1;
>   > >
>   > >
>   > > --
>   > > Cheers
>   > > Graham
>   > > AB-Write >< Professional AFL Writing Service
>   > > Yes, I write AFL code to your requirements
>   > > http://www.aflwriting.com
>   > >
>   > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > > ----- Original Message -----
>   > > > From: Alain Baur
>   > > > To: amibroker@xxxxxxxxxxxxxxx
>   > > > 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
>   > > >
>   > > >
>   > > >
>   > > >
>   > > >
>   > > > ________________________________
>   > >
>   > > >
>   > > >
>   > >
>   > >
>   >
>




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
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/