| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Paintbar Indicator.. The goal for now is to just use a SMA, and when price is below the MA to plot the color of the bar RED, when price is above the MA to plot the color of the bar BLUE, I have done this and it works, but my next task that I wanted to do, is to make it so that the first time price closes above the SMA, or below the color would be changed to yellow..... Any idea on how to modify the code to support this?? Inputs: price(Close), SMA(12), upColour(Blue), downColour(Red); plotpb(high,low, "SMA"); { Color criteria } if (Value1 > Value1[1]) then setplotcolor(1, upColour) else if (Value1 < Value1[1]) then SetPlotColor(1, downColour); | ||
| |
|
| | #2 | ||
![]() | Re: Paintbar Indicator.. Quote:
just add the 2nd criteria, as you have described... Code: Inputs: price(Close), SMA(12),
upColour(Blue), downColour(Red);
plotpb(high,low, "SMA");
{ Color criteria }
if ((Value1 > Value1[1])
and (Value1[1] < Value1[2]) )
or
( (Value1 < Value1[1])
and (Value1[1] > Value1[2]) )
then
setplotcolor(1, Yellow); ps. please use code tag when posting codes. It is the # key at the top of the message window frame.
__________________ Only an idiot would reply to a stupid post | ||
| |
|
| | #3 | ||
![]() | Re: Paintbar Indicator.. Quote:
Code: Inputs: price(Close), SMA_Lngth(12),
upColour(Blue), downColour(Red);
var: TheSMA(0), CurrentColor(0), ClosedOvr(False), ClosedUndr(False), FirstClsOvr(False), FirstClsUndr(False);
plotpb(high,low, "SMA");
TheSMA=AVERAGE(Close, SMA_Lngth);
ClosedOvr=Close > TheSMA;
ClosedUndr=Close < TheSMA;
FirstClsOvr = ClosedOvr[1] and ClosedOvr[2] = False;
FirstClsUndr = ClosedUndr[1] and ClosedUndr[2] = False;
If FirstClsOvr then
CurrentColor = 0
Else If FirstClsOvr[1] then
CurrentColor = 1
Else if FirstClsUndr[1] then
CurrentColor = -1;
{ Color criteria }
if CurrentColor = 1 then
setplotcolor(1, upColour)
else if CurrentColor = -1 then
SetPlotColor(1, downColour) else SetPlotColor(1, Yellow);
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. | ||
| |
|
| | #4 | ||
![]() | Re: Paintbar Indicator.. It's set for the 34EMA but its easily changed. | ||
| |
|
| | #5 | ||
![]() | Re: Paintbar Indicator.. | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with Creating a 9/30 Crossover Paintbar Indicator | Disco Scottie | Coding Forum | 3 | 12-13-2010 04:38 AM |
| Paintbar Factory | ultacom | Trading Indicators | 1 | 11-21-2010 03:38 PM |
| VPCI As PaintBar | mcerio | Coding Forum | 17 | 10-17-2010 11:59 PM |
| Trend Indicator Paintbar | Squire69 | Coding Forum | 12 | 08-15-2010 05:11 PM |
| Paintbar Plotting | chrisleonard | Coding Forum | 8 | 10-02-2009 12:50 PM |