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

[amibroker] Re: help in writing a formula



PureBytes Links

Trading Reference Links

--- In amibroker@xxxxxxxxxxxxxxx, "Alan Nouray" <alann@xxx> wrote:
>
> Thank you Mike. This is what I wrote but when I do backtest, nothing
> shows up. Is this correct?
>
> x=Foreign("X","C");
> YourSystemEntrySignal = Cross( EMA(x, 10), EMA(x, 20 ) ) AND x >
> Ref(x,-50);
> YourSystemExitSignal= Cross(EMA(x, 20), EMA(x, 10)) AND x < Ref(x,
-50);
>
> if( Name() == "A" )
> {
> Buy = YourSystemEntrySignal;
> Sell = YourSystemExitSignal;
>
> SetPositionSize( 500, spsShares );
> }
>
> if( Name() == "B" )
> {
> Short = YourSystemEntrySignal;
> Cover = YourSystemExitSignal;
>
> SetPositionSize( 500, spsShares );
> }
>
> Alan
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Mike" sfclimbers@ wrote:
> >
> > You were not specific enough in your description for anyone to write
> > the formula. Do you mean that the Cross happens in the EMA of "X",
or
> > of "A", or of "B"?
> >
> > In any event, the functions that you will need are as follows:
> >
> > 1a. Foreign http://www.amibroker.com/guide/afl/afl_view.php?
> > name=foreign
> >  or
> > 1b. SetForeign http://www.amibroker.com/guide/afl/afl_view.php?
> > name=setFOREIGN
> > 2. EMA http://www.amibroker.com/guide/afl/afl_view.php?id=44
> > 3. Cross http://www.amibroker.com/guide/afl/afl_view.php?name=cross
> > 4. Ref http://www.amibroker.com/guide/afl/afl_view.php?name=ref
> > 4. How to trade pairs/spreads
> > http://finance.groups.yahoo.com/group/amibroker/message/134492
> >
> > Mike
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Alan Nouray" <alann@> wrote:
> > >
> > > Can anybody help me how to write and test the following formula:
> > >
> > > when 10 day ema crosses the 20 day ema and the close of "X" fund
is
> > > higher than the close 50 days ago, then buy fund "A" and sell
> > fund "B"
> > >
> > > when 20 day ema crosses the 10 day ema and the close of "C" fund
is
> > > lower than the close 50 days ago, then sell fund "A" and buy fund
"B"
> > >
> > > Thank you.
> > > Alan
> > >
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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

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/