PureBytes Links
Trading Reference Links
|
This code can displace the priceplot, forward or backward, over a
stable EMA line.
disp=Param("Displacement",0,-20,20);
Ox=IIf(LastValue(Cum(1))-disp>Cum(1),Ref(O,disp),Null);
Hx=IIf(LastValue(Cum(1))-disp>Cum(1),Ref(H,disp),Null);
Lx=IIf(LastValue(Cum(1))-disp>Cum(1),Ref(L,disp),Null);
Cx=IIf(LastValue(Cum(1))-disp>Cum(1),Ref(C,disp),Null);
PlotOHLC(Ox,Hx,Lx,Cx,"",colorBlack,styleBar);
Plot(EMA(C,20),"",colorOrange,styleLine);
/JS
--- In amibroker@xxxxxxxxxxxxxxx, "dennisconnaccesstoledocom"
<dennisconn@xxxx> wrote:
> This may be something of a duplicate post, as I haven't yet seen
my
> original query in the message index. If so, I apologize; but this
> second attempt might better state my question...
>
> Even though I've searched the discussion boards and the mailing
list
> archives, I've not found an answer to this: how does one write a
code
> to plot a forward displaced moving average so that it can be
> displayed in the space to the right of the last price bar?
>
> Put another way, if I plot a moving average so that it's displaced
> forward 3 periods, I'd like to be able to plot where it will be in
> the future, 1 to 3 periods past where the most current price data
> ends. Here's the code I'm using:
>
> // Displaced Moving Averages (insert this code into "Built-in /
> Price" edit pane above "//--Indicator-End--" line)
> MA1 = Param ("MA1 length", 3, 2, 99, 1);
> D1 = Param ("MA1 displacement", -3, -9, 9, 1);
> Plot (Ref (MA (C, MA1), D1), "DMA1", 42);
>
> The code works fine, except that the plot of the forward displaced
> moving average is truncated at the last price bar on the chart, so
> that the last 3 values of the MA aren't displayed.
>
> Unless I've missed something in the manual, I can't figure out how
to
> code it to display the MA as I'd like. Any solution?
>
> DC
------------------------ 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/
|