PureBytes Links
Trading Reference Links
|
<SPAN
class=152235205-29112003>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):
<SPAN
class=152235205-29112003>
ApplyStop( type, mode,
amount, exitatstop, volatile = False )
<SPAN
class=152235205-29112003>
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)
<SPAN
class=152235205-29112003>dave
<SPAN
class=152235205-29112003>
<BLOCKQUOTE
>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 ofprofit 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
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|