Discussions
»
Product and Service Development
»
Formula Assistance
»
Plot previous trough or otherwise make it zero based on a condition.
Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Hi,
I have a custom indicator, planning to use for entry. This has values of peaks and troughs of the price chart.
When a condition is fulfilled at the latest peak, i want the previous trough value to be plotted/ visible, while all other trough values is to be zero/invisible.
Appreciating your valuable advice,
Regards,
Pakki
|
|
|
|
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 Pakki
Here's a formula that plots the last valid Trough value. This code provides a starting point - it is not a total solution. You will need to include your own signal conditions into the trigger variable and adjust the PeakBar(), Trough() and TroughBar() parameters to suit.
{Last Trough Value} A:=TroughBars(1,C,5); B:=Cum(A=0); F:=PeakBars(1,C,5); G:=Cum(F=0); Trigger:=B=LastValue(B) AND G>=LastValue(G)-1; ValueWhen(1,Trigger,Trough(1,C,5));
Roy
|
|
|
|
Rank: Member
Groups: Registered, Registered Users Joined: 8/19/2011(UTC) Posts: 16
|
Thanks Roy,
Your solution did help me to move forward, going forward, actually i want the last trough bar(not value) to be plotted/highlighted in its(last trough's) position not at the latest peak position. All other inputs being same.
Pakki
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Product and Service Development
»
Formula Assistance
»
Plot previous trough or otherwise make it zero based on a condition.
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.