Discussions
»
Product and Service Development
»
Formula Assistance
»
how to draw a line for last two bars by an indicator
Rank: Member
Groups: Registered Users, Subscribers Joined: 8/19/2014(UTC) Posts: 23
Thanks: 4 times
|
Hello,
Appreciate your help ,
Can I draw a line for only last two bars (Candel) by an indicator ,
The Line is from
Ref(L,1) To Today H
Edited by user Sunday, September 11, 2016 7:43:48 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi homano
Try this as an indicator.
C1:=Cum(1);
Z:=LastValue(C1); Y:=Z-1;
ValueWhen(1,Y<=C1,If(Y=C1,L,H));
Hope this helps.
Roy
|
1 user thanked mstt for this useful post.
|
|
|
Rank: Member
Groups: Registered Users, Subscribers Joined: 8/19/2014(UTC) Posts: 23
Thanks: 4 times
|
Thank you very Much,
Please, I want to Extend The Line to the right one day more .
Is that possible.
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi
Indicators cannot be extended to the right of the last available (most recent) data bar.
Roy
|
|
|
|
Rank: Member
Groups: Registered Users, Subscribers Joined: 8/19/2014(UTC) Posts: 23
Thanks: 4 times
|
Hi Roy,,
Infact I tried to change the indicator to gives me as it is in the picture, but without result
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi
In looking at your latest image it appears that you've changed the reference point from the second-to-last bar to the third to last bar. The result is that the line simply continues to the last bar.
If what you're trying to do is to start the line at the LOW of the "nth" to last bar and finish at the HIGH of the last bar then a little more flexibility must be provided by the indicator. Once I've done that I'll post a revised version of the indicator with a an Input() function to control the gap between the starting point LOW and the finishing point HIGH. It should also be possible to apply the line to earlier data as well. An example might be starting at the LOW of the 10th to last bar and finishing at the HIGH or the 5th to last bar.
There is already a technique that allows virtually any plot to be blanked out for any number of bars after the intended finishing point. In your modified image the blue line from the middle bar to the last bar would effectively be erased. The advantage of doing that is that the price plot would not squashed by the line using the same scale as the chart and going ballistic (cramping the height of the bar chart).
Roy Edited by user Tuesday, September 13, 2016 12:01:11 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Registered Users, Subscribers Joined: 8/19/2014(UTC) Posts: 23
Thanks: 4 times
|
I hope that the Indicator can be more flexible it is wonderful.
Thank you for your help,
Regards
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi homano
This took a little longer to put together than I thought, thus the delay. Hopefully you'll be able to break the code down to individual steps and figure out how it works and how you might be able to adapt it as needed.
{Low to High Price Line}
{Roy Larsen, 14/9/2016}
Start:=Input("Low to High Price Line: Bars from Right, Start",1,999,10);
End:=Input("Bars from Right, End",0,999,5);
Span:=LastValue(Start-End);
TotBars:=LastValue(Cum(1));
StartSig:=(TotBars-Start)=Cum(1);
EndSig:=(TotBars-End)=Cum(1);
StartPrice:=LastValue(ValueWhen(1,StartSig,L));
EndPrice:=LastValue(ValueWhen(1,EndSig,H));
Inc:=(EndPrice-StartPrice)/(Start-End);
Line:=ValueWhen(1,StartSig,L) + Cum(Cum(Ref(StartSig,-1)*Inc));
Ref(Ref(Line,-End),End);
Roy
|
1 user thanked mstt for this useful post.
|
|
|
Rank: Member
Groups: Registered Users, Subscribers Joined: 8/19/2014(UTC) Posts: 23
Thanks: 4 times
|
How can I thank you ,,,
Great work
Thank you Roy
Edited by user Wednesday, September 14, 2016 9:24:24 AM(UTC)
| Reason: Not specified
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
how to draw a line for last two bars by an indicator
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.