PureBytes Links
Trading Reference Links
|
Hi,
I really am having problems with my system timing. I hope someone
may help please.
Firstly, if you place the code below in an indicator the...
Buy signal = green up triangle.
Max Loss (20%) = Red No.1 circle
Trailing Stop = Orange No. 2 circle
Profit Exit (25%) = Green No.3 circle
Also, the white line on the chart is the 25% profit exit and the red
line is the 20% max loss and the blue line is the trailing stop.
When there is a buy trigger I want to trade the following day's OPEN
and the max loss and profit exit is calculated on THIS open price, NOT
the previous trigger day.
The exit whether a profit exit, max loss or trailing stop I want
triggered when the CLOSE crosses any of them and I trade on the
following day's OPEN.
The trailing stop trigger looks OK (the orange ones) but the problem
is the profit and max loss exits there is an exit when the high
crosses the lines not just the CLOSE.
I don't really know if I have the delays, the applystop "ExitAtStop"
or Equity(1) wrong???
Thanks, Glenn
// Buy Signal
prd=0.005;
N=LinRegSlope(C,5)>prd
AND LinRegSlope(C,21)>prd
AND LinRegSlope(C,55)>prd;
Buy=N AND Ref(N,-1)==0;
BuyPrice=Open;
// Sell Signals
Sell=Close<Ref(LLV(Low,11),-1);
SellPrice=Open;
// %Stops
SetTradeDelays(1,1,0,0);
ApplyStop(stopTypeProfit,stopModePercent,25,2,False,False);
ApplyStop(stopTypeLoss,stopModePercent,20,2,False,False);
Equity(1);
// Charting
GraphXSpace=10;
_N(
Title=Name()
+" "
+Date()
+" Close="+WriteVal(C,1.3)
+" Open="+WriteVal(O,1.3)
+" Vol="+WriteVal(V,1.0)
+ EncodeColor(colorGreen)+" Profit="+WriteVal(ValueWhen(Buy,Ref
(Open*1.25,1)),1.3)
+ EncodeColor(colorRed)+" Max Loss="+WriteVal(ValueWhen(Buy,Ref
(Open*0.80,1)),1.3));
Binary=Ref(Flip(Buy,Sell),-1);
ColProf=IIf(Binary,55,256);
ColMaxL=IIf(Binary,32,256);
Plot(LLV(Low,11),"Trailing Stop",6);
Plot(Close,"Close",colorBlack,128);
PlotShapes(IIf(Buy,shapeUpTriangle,shapeNone),5,0,L,-10);
PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),4,0,H,-10);
PlotShapes(IIf(Sell==1,shapeDigit1,shapeNone),9,0,H,30);
PlotShapes(IIf(Sell==2,shapeDigit2,shapeNone),4,0,H,30);
PlotShapes(IIf(Sell==3,shapeDigit3,shapeNone),5,0,H,30);
Plot(ValueWhen(Buy,Ref(Open*1.25,1)),"Profit",ColProf,4|2048|4096);
Plot(ValueWhen(Buy,Ref(Open*0.80,1)),"Max
Loss",ColMaxL,4|2048|4096);
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
------------------------ 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
---------------------------------------------------------------------~->
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|