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

[amibroker] Re: Circular issue with duplicate buy signals



PureBytes Links

Trading Reference Links

This kind of problem can be solved by writing a for loop and setting
the buy/sell signals one bar at a time. You will have complete control
over the signals, but it will run somewhat slower.

-Steve

--- In amibroker@xxxxxxxxxxxxxxx, "Esteban" <EstebanUno@xxx> wrote:
>
> I have a buy condition and a sell condition. The sell condition is 
> dependent on how long ago the buy was, among other things. Example:
> 
> Buy=buyCondition;
> barsAgo= barsSince(Buy)>1;
> Sell = sellCondition and barsAgo;
> 
> The problem is if a new duplicate buy signal occurs when a long 
> position is already held. I want the barsAgo variable to reference 
> the first actual signal in the series, and not show true just because 
> the previous bar had the same conditions as the actual original buy 
> signal.
> 
> When I use exRem(Buy,Sell) to remove extra bars, it gives me a Sell 
> variable not initialized error, unless I place it after the Sell 
> statement, but that has the effect of evaluating the subsequent buys 
> for the barsAgo statement. Am I clear with my question?
> 
> // I get initialized error.
> Buy=buyCondition;
> barsAgo= barsSince(Buy)>1;
> exRem(Buy,Sell);
> Sell = sellCondition and barsAgo;
> 
> // All buys are evaluated for barsAgo, not just the original one.
> Buy=buyCondition;
> barsAgo= barsSince(Buy)>1;
> Sell = sellCondition and barsAgo;
> exRem(Buy,Sell);
> 
> I've been going around in circles on this one for a while. Maybe 
> someone can help.
>



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

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