Change of a bar color on condition

Moderator: admin

Change of a bar color on condition

Postby jgwill » Sun Aug 02, 2015 10:19 am

Hi,

I would need information that would help changing a bar color ?
Thank
:D
jgwill
 
Posts: 23
Joined: Tue Aug 30, 2011 9:58 pm
Location: Maliotenam, Canada

Re: Change of a bar color on condition

Postby Victor.Tereschenko » Tue Aug 04, 2015 7:09 am

jgwill wrote:Hi,

I would need information that would help changing a bar color ?
Thank
:D

Do you need to change a bar color in your indicator? If so you can do like this:
Code: Select all
function Prepare()
...
    your_stream = instance:addStream("stream", core.Line, name .. ".stream", "stream", core.rgb(0, 0, 0), first);
...
end

function Update(period, mode)
    your_stream:setColor(period, core.rgb(128, 128, 128));
end
“There are only three sports: bullfighting, motor racing, and mountaineering; all the rest are merely games.” (c) Ernest Hemingway
Victor.Tereschenko
FXCodeBase: Confirmed User
 
Posts: 144
Joined: Fri Nov 19, 2010 8:55 am

Re: Change of a bar color on condition

Postby jgwill » Mon Oct 12, 2015 1:55 pm

Thank for the code Victor. Rather, I'd like to change the bar color (or candle) like turn Blue if this or that...
thank :)
jgwill
 
Posts: 23
Joined: Tue Aug 30, 2011 9:58 pm
Location: Maliotenam, Canada

Re: Change of a bar color on condition

Postby jgwill » Sun Dec 20, 2015 5:10 pm

I was wondering if :
your_stream:setColor(period, core.rgb(128, 128, 128));

in the Update() function will update just a bar or the entire stream ??
thank
jgwill
 
Posts: 23
Joined: Tue Aug 30, 2011 9:58 pm
Location: Maliotenam, Canada

Re: Change of a bar color on condition

Postby Julia CJ » Mon Dec 21, 2015 2:43 am

Hi Jgwill,

Please read this information:

http://www.fxcodebase.com/documents/Ind ... pdate.html
Julia CJ
 


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 12 guests