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

Re: [amibroker] Pyramiding and Incremental Buys After MA Crossover


  • Date: Tue, 26 Jan 2010 09:38:59 +0100
  • From: reinsley <reinsley@xxxxxxxx>
  • Subject: Re: [amibroker] Pyramiding and Incremental Buys After MA Crossover

PureBytes Links

Trading Reference Links


Hi,

Did you see this help page and related formulas ?

http://www.amibroker.com/guide/afl/afl_view.php?id=272

Best regards



Le 26/01/2010 02:21, readshark a écrit :
>
>
> I am trying to code a pyramiding trading system to Buy on a MA
> Crossover, and Buy more each time the price rises by 5%. For example if
> the MA crossover occurred at 100, the system would continue to buy at
> 105, 110, 115, 120, 125, etc.
>
> Here is my code thus far. It looks like it is buying and selling on the
> same day, but not pyramiding as I explained (or tried to) above.
>
> Thanks in advance.
>
> _______
>
> PositionSize = -5;
> FastMALength = 50;
> SlowMALength = 200;
>
> FastMA = MA(Close, FastMALength);
> SlowMA = MA(Close, SlowMALength);
> Vol = MA(Volume, 100);
>
> Buy = Cross(FastMA, SlowMA);
> Sell = Cross(SlowMA, FastMA);
>
> Buy = Buy + sigScaleIn;
>
> BuyInc = 5;
> NextBuy = 0;
>
> for ( i = 0; i < BarCount; i++ )
> {
> if( NextBuy > 0 && Close[ i ] > NextBuy[ i ])
> {
> Buy[ i ] = sigScaleIn;
> }
> if(Close[ i ] > BuyPrice[ i ])
> {
> counter = int((Close[ i ] - BuyPrice[ i ]) / BuyInc) + 1;
> NextBuy = ( (BuyInc / 100) * counter[ i ]) * BuyPrice[ i ];
>
> }
> }
>
> 



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

**** 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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/