Can the 'Streams' be made transparent.

Section for discussions related to indicators, use of indicators, and building of trading stategies using indicators.

Moderator: admin

Can the 'Streams' be made transparent.

Postby LordTwig » Sun Sep 18, 2011 7:19 am

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
Attachments
Bars on Chart.doc
Bars are shown on screenshot but cover the candles
(92.5 KiB) Downloaded 1029 times
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Can the 'Streams' be made transparent.

Postby sunshine » Tue Sep 20, 2011 3:22 am

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.
sunshine
 

Re: Can the 'Streams' be made transparent.

Postby LordTwig » Tue Sep 20, 2011 7:02 am

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
Attachments
Bars on Chart.png
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Can the 'Streams' be made transparent.

Postby sunshine » Tue Sep 20, 2011 7:23 am

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.
sunshine
 

Re: Can the 'Streams' be made transparent.

Postby sunshine » Tue Sep 20, 2011 8:56 am

Please find the sample in the attachment. The indicator draws transparent bars with different colors for certain periods.
channel.png
Attachments
channel.lua
(1.84 KiB) Downloaded 1008 times
sunshine
 

Re: Can the 'Streams' be made transparent.

Postby LordTwig » Tue Sep 20, 2011 10:13 am

Hey, Sunshine,

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

Cheers
LordTwig
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Can the 'Streams' be made transparent.

Postby LordTwig » Tue Sep 20, 2011 11:34 am

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
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Re: Can the 'Streams' be made transparent.

Postby sunshine » Wed Sep 21, 2011 6:44 am

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.
sunshine
 

Re: Can the 'Streams' be made transparent.

Postby Nikolay.Gekht » Fri Oct 07, 2011 10:09 am

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.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Can the 'Streams' be made transparent.

Postby LordTwig » Sat Oct 08, 2011 6:29 am

Hi,

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

LordTwig
Cheers
LordTwig
LordTwig
FXCodeBase: Confirmed User
 
Posts: 157
Joined: Fri Mar 12, 2010 3:15 am

Next

Return to Discussions

Who is online

Users browsing this forum: No registered users and 9 guests