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

[amibroker] Re: SigScaleIn/SigScaleOut issue



PureBytes Links

Trading Reference Links

Have a look at SetBacktestMode and see if that helps.

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

Mike

--- In amibroker@xxxxxxxxxxxxxxx, "Paolo Cavatore" <pcavatore@xxx> 
wrote:
>
> I've got an indicator which is giving buy/sell signals (ie. 0 
> nothing, +1 buy 100 shares, +2 buy 200 shares, -3 sell 300 shares 
and 
> so forth).
>  
> SigScaleIn/SigScaleOut variables don't seem to be able to manage 
> long/short positions properly. Let's say I'm long 400 shares and 
get 
> a -6 from my indicator. I should close the long position and open a 
> new short position for 200 shares.
>  
> The code below is a draft of what I'm trying to achieve but there 
is 
> no way to let it work as it should. Any help is much appreciated.
>  
> p
>  
>  
> SetPositionSize( 100 * abs(Indicator), spsShares);
>  
> DoScaleInBuy = Indicator > 0;
> DoScaleOutBuy = Indicator < 0;
> DoScaleInShort = Indicator < 0;
> DoScaleOutShort = Indicator > 0;
>  
> Buy = DoScaleInBuy * SigScaleIn + DoScaleOutBuy * SigScaleOut;
>  
> Short = DoScaleInShort * SigScaleIn + DoScaleOutShort * SigScaleOut;
>  
> Sell = Cover = 0;
>



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

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

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

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

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/

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