NexusFi: Find Your Edge


Home Menu

 





Thinkscript and Z-Order...


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,928 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Is there any way to "z-order" the various elements in a study? More specifcally, I want to bring the yellow line and the white baseline "forward" so they lay on top of the green and red histograms, if possible. Currently, the histograms are "on top" and make the yellow line and white baseline look like they are dashed lines, as seen in the sample image below...



Any help/assistance would be greatly appreciated. Thanks in advance...


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Hormuz Surges From 14% to 26.5% Intraday as Irans Answer …
Prediction Markets & Event Contracts
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
CFTC Workforce Shrinks 24% to 15-Year Low While Predicti …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
205 thanks
Sober Journey With S&P
21 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
Thanks Mike. Godspeed.
7 thanks
  #2 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

The plot order is according to which one is first on the code. You have to move the plot text for the avg and zero line before the histogram plot in the thinkscript.


Reply With Quote
Thanked by:
  #3 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19


Thanks for your reply, rmejia. I understand. Unfortunately, since the yellow "avg" line is derived from the histograms, the plots cannot be reordered...


Reply With Quote
  #4 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

Can you put the histogram formula on the avg plot ? I have a study where the avg was = ((h+l+c/3),ema period), the h and l being the histogram so I substituted those for instead of just using h to using what h was equal to.

So to move it infront of the histogram plot the formula changed to:
plot ave = expAverage((high("$TICK")+low("$TICK")+close("$TICK"))/3,emaPeriod);

from
plot ave = expAverage(h+l+c)/3,emaPeriod);


Reply With Quote
Thanked by:
  #5 (permalink)
netarchitech
NY, NY
 
Posts: 68 since Dec 2011
Thanks Given: 27
Thanks Received: 19

Thank you, rmejia, for your reply and continuing assistance. It is certainly appreciated. As for the element ordering, I received the answer I needed from a fellow scripter on another forum...

It turns out that the plots can be reordered as necessary, but it requires defining (def) certain plots ahead of time, so to speak. I hope that makes sense, but if not, below are code snippets that hopefully do a better job than I

Below is a snippet from the original code:

 
Code
plot "DI+" = 100 * MovingAverage(averageType, plusDM, length) / ATR;
"DI+".SetDefaultColor(color.DARK_GREEN);
"DI+".SetLineWeight(3);
"DI+".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

plot "DI-" = 100 * MovingAverage(averageType, minusDM, length) / ATR;
"DI-".SetDefaultColor(color.RED);
"DI-".SetLineWeight(3);
"DI-".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;

plot ADX = MovingAverage(averageType, DX, length);
ADX.SetDefaultColor(GetColor(4));
ADX.SetLineWeight(3);

plot "20Line" = 20;
"20Line".SetDefaultColor(GetColor(9));
"20Line".SetLineWeight(1);

And below is the updated code snippet:

 
Code
plot "20Line" = 20;
"20Line".SetDefaultColor(GetColor(9));
"20Line".SetLineWeight(1);

def DIplus  = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def DIminus = 100 * MovingAverage(averageType, minusDM, length) / ATR;
def DX = if (DIplus + DIminus > 0) then 100 * AbsValue(DIplus - DIminus) / (DIplus + DIminus) else 0;

plot ADX = MovingAverage(averageType, DX, length);
ADX.SetDefaultColor(GetColor(4));
ADX.SetLineWeight(3);

plot "DI+" = DIplus;
"DI+".SetDefaultColor(color.DARK_GREEN);
"DI+".SetLineWeight(3);
"DI+".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
"DI+".HideBubble();
"DI+".HideTitle();

plot "DI-" = DIminus;
"DI-".SetDefaultColor(color.RED);
"DI-".SetLineWeight(3);
"DI-".SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
"DI-".HideBubble();
"DI-".HideTitle();

I hope this proves informative/helpful to any/all whom might be interested...


Reply With Quote




Last Updated on February 19, 2015


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts