Page 1 of 2

Can the 'Streams' be made transparent.

PostPosted: Sun Sep 18, 2011 7:19 am
by LordTwig
Hi there,

Is it possible to make the 'streams' (instance:addStream) so that it displays tranparently?

ie: I want to display full lenght (bar) streams on chart but have them transparent so that I can still see the trading candles

barTrigger = instance:addStream("Trigger", core.Bar, name, "Trigger", instance.parameters.Trigger_color, 0);

barBuy = instance:addStream("Buy", core.Bar, name, "Buy", instance.parameters.Buy_color, 0);
barStop = instance:addStream("Stop", core.Bar, name, "Stop", instance.parameters.Stop_color, 0);

barLimit = instance:addStream("Limit", core.Bar, name, "Limit", instance.parameters.Limit_color, 0);

barTradeDayEnd = instance:addStream("TradeDayEnd", core.Bar, name, "Day End", instance.parameters.TradeDayEnd_color, 0);


So need streams to be transparent or another option would be to place streams behind candles, either will do as long as I can see the candles

Any help would be appreciated.

Cheers
LordTwig

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 3:22 am
by sunshine
Looks like the usage of transparent channels could solve the issue.
Please see the method instance:createChannelGroup.

Please see also the example of an indicator with transparent channels:
Image

Trading Session Hours indicator

Also note that the standard Marketscope Ichimoku indicator uses this function.

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 7:02 am
by LordTwig
Hi Sunshine,

The trouble with

sunshine wrote:Looks like the usage of transparent channels could solve the issue.
Please see the method instance:createChannelGroup.


is that you need two (2) or more streams in channel for this to work, whereas my streams are independant of each other...? ......is that correct??

Yes I looked at the Session Trading Hours Indicator before posting, but cannot get it to work with only one stream.

Besides that, I would prefer the bars to be as shown 'full lenght' on chart (attached) but transparent or behind candles.

The reason I want to do this is the 'stream' dots or lines or widgets are too small and too close to candles, I prefer bigger and set straight horizontally, as shown.

Any way to do this??....... or add this feature to Marketscope?

Thanks
LordTwig

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 7:23 am
by sunshine
1) You can wait a bit for a next release of Marketscope which will provide the feature "draw in background" for all chart elements including indicators. Please watch for updates on the site.
2) However I believe it's possible to use transparent channels in this case. I'll prepare the example.

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 8:56 am
by sunshine
Please find the sample in the attachment. The indicator draws transparent bars with different colors for certain periods.
channel.png

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 10:13 am
by LordTwig
Hey, Sunshine,

Wow, thanks for that, looks just the way I want it.
I will attempt to incorporate in my indicator.

Cheers
LordTwig

Re: Can the 'Streams' be made transparent.

PostPosted: Tue Sep 20, 2011 11:34 am
by LordTwig
Sunshine,

I keep getting this error
'attempt to perform arithmetic on field '?' (a nil value)'

for this code
HighBorder[period] = source[period] * 1000;

if I remove the (* 1000) it loads but won't show transparent bar or any bar in fact.

Can you advise a fix?

LordTwig

Re: Can the 'Streams' be made transparent.

PostPosted: Wed Sep 21, 2011 6:44 am
by sunshine
If your indicator requires bar source (indicator:requiredSource(core.Bar)), use "source.close[period]" instead of "source[period]". Just a thought. It's hard to fix without seeing the full code.

Re: Can the 'Streams' be made transparent.

PostPosted: Fri Oct 07, 2011 10:09 am
by Nikolay.Gekht
Or check for something like source = ... somewhere else in the code. Probably you replaced the value of the source with number. I sometimes make such mistake with output streams, i.e. write
output = blah-blah-blah instead of output[period] = blah-blah-blah.

Re: Can the 'Streams' be made transparent.

PostPosted: Sat Oct 08, 2011 6:29 am
by LordTwig
Hi,

Yep, got it working now, thanks for your inputs......

LordTwig