PureBytes Links
Trading Reference Links
|
Below is the code to plot a straight line from Bar1 to Bar2. I want to
adapt this code to plot straight lines between my trade entry (BuyPrice or
ShortPrice) and exit (SellPrice and CoverPrice) points but somehow I can't
solve this programming problem. The final plot would appear like a ZigZag
line from trade to trade.
If anybody has done this or can help me on my way it would be much
appreciated,
happy trading,
Herman.
// Straight line from Bar1 to Bar2
LB = 10; //Number of bars ago to start
Length = 5; //Length of line in bars
X = C; //Variable to be sampled
Bar1 = LastValue(Cum(1)) - LB; //Start of line
Bar2 = Bar1 + Length; //End of line
InLine = Cum(1) >= bar1 AND Cum(1) <= bar2;
Bar = IIf(InLine,(Cum(1) - Bar1),0);
StartX = ValueWhen(Cum(1) == Bar1, X); //Startvalue for line
LastX = LastValue(ValueWhen(Cum(1) == Bar2, X)); //End value of line
Incr = (LastX - StartX)/Length; //Line increment/bar
Line = IIf(InLine, StartX + bar * Incr,-1e10);
Plot(Line,"",4,1);
Plot(C,"C",1,1);
------------------------ 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/l.m7sD/LIdGAA/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/
|