Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
I'm trying to complete the BOTH function of this indicator, but am stuck on plotting both ls and ss at the same time. Can someone nudge me in the right direction? Thanks!
[code:1:e6d761775e]{User inputs}
plot:=Input("1)Long, 2)Short, 3)Both",1,3,1);
factor := Input("SafeZone Factor",0.0,20.0,2.0);
lookback:=Input("LookBack Period",10,300,99);
ls:=ExtFml("ElderDisk.SafeZoneLong",factor,lookback);
ss:=ExtFml("ElderDisk.SafeZoneShort",factor,lookback)
{Plot on price chart}
If(plot=1,ls,if(plot=2,ss, ... stuck[/code:1:e6d761775e]
|
|
|
|
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)
|
Try this. It works in a different application for me but in changing the numbers I might have messed it up. I can't test with your exact code as I don't have the DLL.
The principle is simple enough; one of the two signals only plots when the ValueWhen() function is triggered by a logical TRUE (on all bars). For the 1 and 2 options it plots N/A. The other output uses an If() function to shift between one plot and the other.
The N/A result may make this inappropriate for what you're trying to do but if it's just a visual signal (or two) that you want then it should be fine. I'm sure there are other ways to do the same thing. This just happens to be the one method I have already found to work. I use it in my Portfolio Equity tool to plot an equity curve, the number of active trades, or both (see the December issue of MSTT).
{User inputs}
plot:=Input("1)Long, 2)Short, 3)Both",1,3,1);
factor := Input("SafeZone Factor",0.0,20.0,2.0);
lookback:=Input("LookBack Period",10,300,99);
ls:=ExtFml("ElderDisk.SafeZoneLong",factor,lookback);
ss:=ExtFml("ElderDisk.SafeZoneShort",factor,lookback)
{Plot on price chart}
ValueWhen(1,Plot=3,ls);
If(Plot=1,ls,ss);
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
Thanks Roy!
I was thinking that the solution would be something that I've seen before, but, I hadn't... it worked perfectly... and I learned something. Thanks again. :D
|
|
|
|
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.