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

RE: [amibroker] Why wont this code allow short trades???



PureBytes Links

Trading Reference Links

The first part of the code works. I get shorts.
The looping part is incomplete (will not compile). You must've not
copied it all.

--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of orionsturtle
Sent: Friday, July 14, 2006 12:08
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Why wont this code allow short trades???

I tried to make this help file code work on the short side, but it 
never even enters into a single trade. I did set the backtest 
positions to short. Could someone please just take a quick look at 
this small piece of code and maybe you can see why it wont trade 
short. I believe it is something simple but I can't seem to find 
it.Thank you.
---------------------------
Short = Cross( MA( C, 10 ), MA( C, 5 ) ); 
Cover = 0 ; 
priceatshort=0;
Lowsinceshort=0;
exit = 0; 

for( i = 0; i < BarCount; i++ ) 
{ 
   if( priceatshort == 0 AND Short[ i ] ) 
    { 
       priceatshort = ShortPrice[ i ]; 
    } 
   if( priceatshort > 0 ) 
    { 
       Lowsinceshort= Min( Low[ i ], Lowsinceshort); 
      //PT1
      if( exit == 0 AND Low[ i ] <= ( 1 - FirstProfitTarget * 0.01 ) 
* priceatshort) 
       { 
         exit = 1; 
		  ShortPrice[i] = ( 1 - FirstProfitTarget * 0.01 ) * 
priceatshort;  
         Short[ i ] = sigScaleOut; 
       } 







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