Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Hi,
I have a custom indicator for determining the support lines. The indicator has value if there is support and no value if there is no support.
Using this,i am trying to draw last two support horizontal lines for the last two values from the indicator as support. How do i code this?
Thanks in advance.
Pakki
|
|
|
|
Rank:: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Hi jjstein,
Horizontal:=Valuewhen(1, condition, indicator value);
Horizontal;
This gives the horizontal values continuously, but i want this, only for last two values.
Thanks,
Pakki
|
|
|
|
Rank:: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
So...you want to plot a line for the last two bars only, at the value specified by "condition", is that right?
|
|
|
|
Rank:: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Also -- What is the condition?
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Yes that's right, i want for only last Values,
Also the condition is
condition is if indicator.value 0, i want these last two values of the indicator to be shown as horizontal lines.
Pakki
|
|
|
|
Rank:: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
Pakki -- Try this:
Lookback:=Input("Lookback",2,500,21); Length:=Input("Length",2,50,2);
Horizontal:=LLV(C,Lookback); FirstX:=LastValue(Cum(1))-Length-1; Support:=If(BarsSince(Cum(1)=FirstX)>-1, LastValue(Horizontal), 0);
Support;
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Johnathan, Great help it has been.
Appreciate that. Thanks
pakki
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.