How to make indicator paint behind price

T

TylerDurden

New member
Does anyone know how to script the indicator so it will paint behind the price candle? Like the SMA that paints infront of the candle. It would be better if it paints behind the price bar
 
Last edited by a moderator:
P

Pensar

Active member
VIP
@TylerDurden Unfortunately, I dont believe thinkscript can do so. You are able to adjust the transparency of the indicator, though. In the indicator settings, click the color > more > HSV or HSL.
 
T

TylerDurden

New member
@TylerDurden Unfortunately, I dont believe thinkscript can do so. You are able to adjust the transparency of the indicator, though. In the indicator settings, click the color > more > HSV or HSL.
Too bad because with MT4 it is possible to program it that way. Those who know how to code should be able to get it done. This is the code on TOS for a SMA

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#

input price = FundamentalType.CLOSE;
input aggregationPeriod = AggregationPeriod.DAY;
input length = 9;
input displace = 0;
input showOnlyLastPeriod = no;

plot DailySMA;

if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) {
    DailySMA = Double.NaN;
} else {
    DailySMA = Average(fundamental(price, period = aggregationPeriod)[-displace], length);
}

DailySMA.SetDefaultColor(GetColor(1));
DailySMA.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Last edited:
T

TylerDurden

New member
I have an indicator for MT4 that does that and it's very useful to do better analysis of price action. But I can't do it in TOS like the pic shows. thanks.

 
Last edited:
rad14733

rad14733

Well-known member
VIP
Well, you might be able to trick TOS to put trend lines behind candles by employing a candlestick painting script as that should establish a study/strategy settings panel layer... Gonna check on that...

All that being said, there is not way to assign layer levels via ThinkScript...
 
T

TylerDurden

New member
Well, you might be able to trick TOS to put trend lines behind candles by employing a candlestick painting script as that should establish a study/strategy settings panel layer... Gonna check on that...

All that being said, there is not way to assign layer levels via ThinkScript...

Thanks for your reply. I was thinking if there is a way to make a strategy where the Moving Average stops painting when it hits the candle and starts painting again when it'ts not over the candle. Or make the MA paint the same color as the candle. That could do the work as well.

Please let me know.

Thanks,

-Tyler
 
rad14733

rad14733

Well-known member
VIP
So, let me get this straight, you would be OK with having just the current candlestick/bar not show a plot line over/under it but all others having it...??? That should be doable by adding an additional condition to the plot... Something to the effect of, semantically, !close[0] (current bar/candlestick)...
 
T

TylerDurden

New member
So, let me get this straight, you would be OK with having just the current candlestick/bar not show a plot line over/under it but all others having it...??? That should be doable by adding an additional condition to the plot... Something to the effect of, semantically, !close[0] (current bar/candlestick)...

Mmmm not really. The idea is to have a chart like in the following picture so it's easy to do the price analysis without the MA getting in the way like in the following picture.

 
rad14733

rad14733

Well-known member
VIP
Ok... I already gave the suggestion on what to try above... It would only be possible if you use a study to color the candlesticks/bars so a layer has been established... TOS offers no other way to accomplish the visual effect you desire... While I rarely ever use candlesticks I will try to see if my suggested method works...
 
rad14733

rad14733

Well-known member
VIP
Ok... I already gave the suggestion on what to try above... It would only be possible if you use a study to color the candlesticks/bars so a layer has been established... TOS offers no other way to accomplish the visual effect you desire... While I rarely ever use candlesticks I will try to see if my suggested method works...
Nope... I have not found a way to paint studies behind candlesticks... Might be worthwhile to contact TOS Support to see if there is interest in adding this feature into future releases...
 
T

TylerDurden

New member
Nope... I have not found a way to paint studies behind candlesticks... Might be worthwhile to contact TOS Support to see if there is interest in adding this feature into future releases...
Thanks for your help anyway.
 

Similar threads

Top