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

Re: [amibroker] Volume Code Question



PureBytes Links

Trading Reference Links

Graham or anyone, I have a question about the
following code:

When I use code 2 on my database I generate trades
which do not meet the criteria that is, volume
required. What exactly could be going on behind the
scenes, because the code allows trades with less than
10000000 volume to get through. When I test 1. , the
code works fine, but I found the return goes way down
compared to the 2. coe, volume for the single day
only. I can't figure out why this is. 

1.  MA (Volume,10) > 20000000

2.  Buy = Open > 1.00 AND Volume > 10000000 AND ....


System Code: 

Length      = Optimize("Length", 50, 1, 100, 1);   
    
 Change      = Close - Ref(Close, -1);   
 intraChange = Close - ((H + L) / 2);   
    
 PlusChange  = IIf(Change > 0 AND intraChange > 0, 
Change +    
 intraChange, 0);   
 MinusChange = IIf(Change < 0 AND intraChange < 0,
-Change -    
 intraChange, 0);   
    
 BSPC0       = BarsSince(PlusChange  == 0);   
 BSMC0       = BarsSince(MinusChange == 0);   
    
 PlusCF      = Sum(PlusChange,  BSPC0);   
 MinusCF     = Sum(MinusChange, BSMC0);   
    
 PlusTCF     = Sum(PlusChange  - MinusCF, Length);   
 MinusTCF    = Sum(MinusChange - PlusCF,  Length);   


  //MA (Volume,10) > 2000000

Buy         = Open > 1.00 AND Volume > 10000000 AND
PlusTCF  > 0 AND Cross ( MACD (12,26), Signal
(12,26,9)) OR Cross( MA( Close, 154 ), MA( Close, 384
));      
 Sell        = MinusTCF > 0 OR Cross( MA( Close, 200
), EMA( Close, 20 ) ); 
   
 Plot(PlusTCF,  "PlusTCF",  colorGreen, 1);           
//Plots PlusTCF line   
Plot(MinusTCF, "MinusTCF", colorRed,   1);           
//Plots MinusTCF line   
 Plot (0,       "",         colorBlue,  styleNoLabel);
// shows a blue  line through 0   
   
 PlotGrid( 25, 55); // shows white grid line for black
background   
 PlotGrid(-25,-55); // same   
   
//Stops          
          
TrailStopAmount = 16 * ATR( 10 );          
ApplyStop( 2, 2, TrailStopAmount, 2 );          

//Position Sizing Algorithm          
     
Capital= 100000;       

MaxTrade =  Ref(Equity(),-1) * 0.30; 
MaxTrade =  Equity() * 0.30; 
MinTrade = Equity() * 0.07; 
riskPS   = (.015 * Capital)/(BuyPrice *
(TrailStopAmount/500)) * BuyPrice;      
PositionSize = Min(MaxTrade, riskPS); 

Thanks, 

Eric
--- Graham <kavemanperth@xxxxxxxxx> wrote:

> Buy = MA (Volume,-20) > 10000000l is incorrect
> unless you are trying
> to calculate moving average into the future, not
> even certain it does
> calculate anything printable
> 
> try using
> Buy = MA (Volume,20) > 10000000
> 
> 
> Volume > 10000000 means on that particular single
> bar the volume value
> MA(Volume,20) is the average of the volumes over
> past 20 bars
> 
> On 8/10/05, eric paradis
> <thechemistrybetweenus@xxxxxxxxx> wrote:
> > I am using the following code as part of my buy
> > statement. What is the difference between the
> > statement with the moving average and volume by
> > itself? It can't be volume for a single bar,
> because
> > during testing, the system bought shares on stocks
> > with about 200,000 volume a day. Is there a
> default
> > period that volume uses? I cannot find the
> information
> > in my User Guide. Thanks for the help.
> > 
> > Buy = MA (Volume,-20) > 10000000
> > 
> > 
> > Buy = Volume > 10000000
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> > 
> > 
> > 
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> > 
> > 
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hb4nkh6/M=362131.6882500.7825259.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123725798/A=2889190/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Put more honey in your pocket. (money matters made easy) Welcome to the Sweet Life - brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

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 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/

<*> 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/