[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

Go to AA settings and make sure that you have selected Postions: "Long and short"

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "orionsturtle" <orionsturtle@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, July 14, 2006 8:08 PM
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
> 
> 
> 
> 
> 
> 
> 
> 
>