Try Ref(Buy, 0) and see if that works for you.

I don't have access to AmiBroker on this computer, so I can't say for 
sure if it will work. But it should be easy to try.

--- In [email protected], "cnh4_2000" <[EMAIL PROTECTED]> wrote:
>
> I'm backtesting a system which requires me to take action #1 if BUY 
> was true(and SHORT was false) and take action #2 if SHORT was true
> (and BUY was false). Obviously, this evaluation is done after after 
> the BUY and SHORT signals are checked. 
> 
> Here are the different things I've tried which all dont seem to be 
> producing the right result. In other words, when backtesting long 
> trades only, my profit is different when I manually 
> section "ProfitFactor" compared to when I attempt to dynamically 
set 
> it based on whether or not BUY is true.
> 
> Attempt 1
> 
> ProfitFactor=IIf(Lastvalue(Buy),Value1,Value2);
> 
> Attempt 2
> 
> ProfitFactor=IIf(Lastvalue(Buy,False),Value1,Value2);
> 
> Attempt 3
> 
> ProfitFactor=IIf(Buy,Value1,Value2);
> 
> Attempt 4
> 
> ProfitFactor=IIf(selectedvalue(Buy,False),Value1,Value2);
> 
> 
> 
> 
> None of these seem to produce the right result during my backtest. :
> ( Any advise would be appreciated. Thanks.
>


Reply via email to