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

[amibroker] Re: Why doesn't this work



PureBytes Links

Trading Reference Links

Dave,

I changed the volitility parameter to "True." But when I do an 
exploration I see the same thing ... when the price drops below 30 
pips of profit it reverts to the 50 pip stop loss (within a single 
trade). 

James

--- In amibroker@xxxxxxxxxxxxxxx, "Dave Merrill" <dmerrill@xxxx> 
wrote:
> check your parameters for ApplyStop! look at Volatile (this is 
straight out
> of the help; put your cursor somewhere within the word ApplyStop 
and press
> F1 to see it):
> 
> ApplyStop( type, mode, amount, exitatstop, volatile = False )
> volatile -
> decides if amount (or distance) (3rd parameter) is sampled at the 
trade
> entry and remains fixed during the trade (Volatile = FALSE - old 
behaviour)
> or if can vary during the trade (Volatile = TRUE) (allows single 
line
> Chandelier exit implementation)
> 
> dave
> 
>   Getting closer and closer ...
> 
>   Gary: I used the lastvalue function as you suggested and it
>   eliminated the "bad argument" error. Thanks!
> 
>   Dave: You were right that I wasn't using "Buyprice" correctly. I 
was
>   able to get what I wanted by making a new variable "priceatbuy."
>   Thanks!
> 
>   And I tweaked a couple of other things. But now I have another
>   problem I'm trying to work through. To restate what I'm trying to
>   do ... I want a 50 pip stoploss, but once I have 30 pips of
>   profit I want to switch to a 20 pip trailing stop. Here is the 
code
>   in it's current state:
> 
>   Buy = Cross(EMA(Close,12),EMA(Close,26));
>   Short = Cross(EMA(Close,26),EMA(Close,12));
>   Sell = Short;
>   Cover = Buy;
>   PositionSize=100000;
>   priceatbuy=ValueWhen(Buy,BuyPrice,1);
>   Var1=IIf(High>=(priceatbuy+0.003),2,0);
>   Var2=IIf(High>=(priceatbuy+0.003),0.002,0.005);
>   ApplyStop(LastValue(Var1),2,Var2,True,False);
> 
>   My problem is that the trailing stop doesn't stick. If the profit
>   for a trade goes back below 30 pips it reverts to the 50 pip stop
>   loss. What I want to backtest is that the trailing stop (once
>   triggered) remains throughout that particular trade. Then the 
next
>   trade starts with the 50 pip simple stop loss. Any ideas?
> 
>   All help is truly appreciated!
> 
>   James


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/