[amibroker] Re: buy only if current position is zero

2009-05-19 Thread Mike
You don't need to do anything. That is the default built in behavior of AmiBroker (i.e. single position per symbol, redundant signals ignored). http://www.amibroker.com/guide/afl/afl_view.php?name=setbacktestmode Mike --- In amibroker@yahoogroups.com, zeek ing wrote: > > Is there a way to code

[amibroker] Re: buy only if current position is zero

2009-05-19 Thread noah.bender
That is true for the backtester but on the chart the code shows a 1 for buy and therefore plots an arrow. bc my code says if buy plot.. Now i know i have to write a loop to prevent a buy from showing up, but I am not sure how meaning a loop that will prevent a sell if I am in a buy.

[amibroker] Re: buy only if current position is zero

2009-05-19 Thread Mike
You don't need to write a loop. Use ExRem. Buy = ExRem(Buy, Sell); Sell = ExRem(Sell, Buy); However, if you plan to also backtest this code, then you would be better off to not use ExRem directly on Buy and Sell, but rather on temporary variables and plot the temporary variables instead. e.g.

[amibroker] Re: buy only if current position is zero

2009-05-19 Thread Mike
Sorry, My proposal did not take into consideration that you would be doing longs and shorts. You can ignore my previous post. Mike --- In amibroker@yahoogroups.com, "Mike" wrote: > > You don't need to write a loop. Use ExRem. > > Buy = ExRem(Buy, Sell); > Sell = ExRem(Sell, Buy); > > However