Australian (ASX) Stock Market Forum

Profit/stop based sell rules in Amibroker?

Joined
24 April 2007
Posts
68
Reactions
0
I tried running a backtest with a technical 'buy=' condition, but without a 'sell=' condition, and just specifying profit and loss targets in the settings panel, but the backtester won't run. error "missing buy/sell variable assignment"

Do I have to include a "sell=" condition for the backtester to run or can I specify profit/loss stop in the code instead? If you have a basic example that would be helpful.
 
I tried running a backtest with a technical 'buy=' condition, but without a 'sell=' condition, and just specifying profit and loss targets in the settings panel, but the backtester won't run. error "missing buy/sell variable assignment"

Do I have to include a "sell=" condition for the backtester to run or can I specify profit/loss stop in the code instead? If you have a basic example that would be helpful.
Howdy again TelstraReg,
Yep you'll have to put a sell=0; inside your code. It will declare the sell variable, and always make it return false, ie never sell. That way the backtester settings like n-bar stop, trailing stop, etc. will be the only ones that determine the sell.
(You could also put all the n-bar stop, etc. in code if you want 'complete' control)
 
I think you're better off putting your stop conditions in your code using the ApplyStop function rather than relying on your panel settings being correct. I have all my stop panel settings disabled.

Cheers,
GP
 
I think you're better off putting your stop conditions in your code using the ApplyStop function rather than relying on your panel settings being correct. I have all my stop panel settings disabled.

Cheers,
GP

Now that I know how, I couldnt agree more.
 
Top