Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

sean

Help with TS Paint Bar

Recommended Posts

Hi all

 

I need help with TS paint bar

 

I like to paint bar with MACD Histogram colors

 

inputs: FastLength( 12 ),

SlowLength( 26 ),

MACDLength( 9 ) ,

 

HistabvZeroUpColor(Green),

HistabvZeroDwnColor(DarkGreen),

HistblwZeroFallColor(Red),

HistblwZeroRiseColor(DarkRed);

 

variables: MACDValue(0),

MACDAvg(0),

MACDDiff(0);

 

MACDValue = MACD( Close, FastLength, SlowLength );

MACDAvg = XAverage(MACDValue, MACDLength);

MACDDiff = MACDValue - MACDAvg ;

 

Plot1( MACDValue, "MACD" ) ;

Plot2( MACDAvg, "MACDAvg" ) ;

{Plot3( MACDDiff, "MACDDiff" ) ;}

Plot4( 0, "ZeroLine" ) ;

 

var:color(0);

plot3(MACDDiff,"MACDDiff",color);

 

if MACDDiff > 0 Then begin

If MacdDiff > MacdDiff[1] then setplotcolor(3, HistabvZeroUpColor)

else setplotcolor(3, HistabvZeroDwnColor);

end;

if MACDDiff < 0 Then begin

If MACDDiff < MACDDiff[1]then setplotcolor(3, HistblwZeroFallColor)

else setplotcolor(3, HistblwZeroRiseColor);

end;

 

 

 

 

 

{ Alert criteria }

if MACDDiff crosses over 0 then

Alert( "Bullish alert" )

 

 

 

thanks in advance

Share this post


Link to post
Share on other sites

Here you go this should do it,

 

inputs: FastLength( 12 ),

SlowLength( 26 ),

MACDLength( 9 ) ,

HistabvZeroUpColor(Green),

HistabvZeroDwnColor( DarkGreen ),

HistblwZeroFallColor(Red),

HistblwZeroRiseColor(DarkRed);

 

variables: MACDValue(0),

MACDAvg(0),

MACDDiff(0);

 

MACDValue = MACD( Close, FastLength, SlowLength );

MACDAvg = XAverage(MACDValue, MACDLength);

MACDDiff = MACDValue - MACDAvg ;

 

 

 

plotpb(h,l,o,c,"MACDDiff");

 

if MACDDiff > 0 Then begin

If MacdDiff > MacdDiff[1] then begin

setplotcolor(1, HistabvZeroUpColor);

setplotcolor(2, HistabvZeroUpColor);

setplotcolor(3, HistabvZeroUpColor);

setplotcolor(4, HistabvZeroUpColor);

end;

If MacdDiff < MacdDiff[1] then begin

setplotcolor(1, HistabvZeroDwnColor);

setplotcolor(2, HistabvZeroDwnColor);

setplotcolor(3, HistabvZeroDwnColor);

setplotcolor(4, HistabvZeroDwnColor);

end;

end;

 

if MACDDiff < 0 Then begin

If MACDDiff < MACDDiff[1]then begin

setplotcolor(1, HistblwZeroFallColor);

setplotcolor(2, HistblwZeroFallColor);

setplotcolor(3, HistblwZeroFallColor);

setplotcolor(4, HistblwZeroFallColor);

end;

If MACDDiff > MACDDiff[1]then begin

setplotcolor(1, HistblwZeroRiseColor);

setplotcolor(2, HistblwZeroRiseColor);

setplotcolor(3, HistblwZeroRiseColor);

setplotcolor(4, HistblwZeroRiseColor);

end;

end;

 

 

 

 

{ Alert criteria }

if MACDDiff crosses over 0 then

Alert( "Bullish alert" )

 

 

 

Hope this helps

 

Blu-Ray

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.