Mark The MEJT Bars In ThinkOrSwim

madantv73

New member
VIP
updated code can be found: https://usethinkscript.com/threads/mark-the-mejt-bars-in-thinkorswim.3238/#post-146786
C01uyzu.png
 
Last edited by a moderator:
I used the script written by@ madantv73 and modified the script to match the functionality of the original TradeStation script. The new script was written by me.
Ruby:
# TOS script to mark the MEJT bars
def begin = 1010;
def beginNoon = 1215;
def arrowsize = 5;
def firstbar = secondsFromTime(begin)==0;
def firstbarN = secondsFromTime(beginNoon)==0;



def count = if gettime() crosses above regularTradingstart(getyyyYMMDD())
then 1
else if !firstbar
then count[1] + 1
else
count[1];

DefineGlobalColor("Time", Color.YELLOW);
DefineGlobalColor("TimeR", color.RED);
plot changeBar = firstBar;
changeBar.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
changeBar.setlineWeight(arrowsize);
changeBar.setdefaultColor(globalColor("Time"));

plot changeBarN = firstbarN;
changeBarN.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
changeBarN.setlineWeight(arrowsize);
changeBarN.setdefaultColor(globalColor("TimeR"));

assignpriceColor(if secondsFromTime(1010) == 0 then GlobalColor("Time") else Color.Current);
assignpriceColor(if secondsFromTime(1015) == 0 then GlobalColor("Time") else Color.Current);
assignpriceColor(if secondsFromTime(1020) == 0 then GlobalColor("Time") else Color.Current);

assignpriceColor(if secondsFromTime(1215) == 0 then GlobalColor("TimeR") else Color.Current);
assignpriceColor(if secondsFromTime(1220) == 0 then GlobalColor("TimeR") else Color.Current);
assignpriceColor(if secondsFromTime(1225) == 0 then GlobalColor("TimeR") else Color.Current);
 
Last edited by a moderator:
input begin = 1010;
input arrowsize = 5;
plot firstbar = secondsFromTime(begin)==0;
def count = if gettime() crosses above regularTradingstart(getyyyYMMDD())
then 1
else if !firstbar
then count[1] + 1
else count[1];

DefineGlobalColor("Time", Color.YELLOW);
firstbar.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
firstbar.setlineWeight(arrowsize);
firstbar.setdefaultColor(globalColor("Time"));
plot xcount = if firstbar then count + 1 else double.nan;
xcount.setpaintingStrategy(paintingStrategy.VALUES_ABOVE);
xcount.setdefaultColor(globalColor("Time"));

input begin2 = 1015;
input arrowsize2 = 5;
plot secondbar = secondsFromTime(begin2)==0;
def count2 = if gettime() crosses above regularTradingstart(getyyyYMMDD())
then 1
else if !secondbar
then count2[1] + 1
else count2[1];

DefineGlobalColor("Time", Color.YELLOW);
secondbar.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
secondbar.setlineWeight(arrowsize2);
secondbar.setdefaultColor(globalColor("Time"));
plot xcount2 = if secondbar then count2 + 1 else double.nan;
xcount2.setpaintingStrategy(paintingStrategy.VALUES_ABOVE);
xcount2.setdefaultColor(globalColor("Time"));


input begin3 = 1020;
input arrowsize3 = 5;
plot thirdbar = secondsFromTime(begin3)==0;
def count3 = if gettime() crosses above regularTradingstart(getyyyYMMDD())
then 1
else if !thirdbar
then count3[1] + 1
else count3[1];

DefineGlobalColor("Time", Color.YELLOW);
thirdbar.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
thirdbar.setlineWeight(arrowsize3);
thirdbar.setdefaultColor(globalColor("Time"));
plot xcount3 = if thirdbar then count + 1 else double.nan;
xcount3.setpaintingStrategy(paintingStrategy.VALUES_ABOVE);
xcount3.setdefaultColor(globalColor("Time"));
Thank you for sharing this. I am seeing multiple "up" arrows at local peaks instead of local troughs. Is that the correct behavior? See the 5 mt /ES chart below for last two days as an example
Screenshot_3_71.png
 
I have found the MEJT system to be very valuable for intraday scalping.
There is actually a morning MEJT projection that develops from the three 5 min bars stating 7:05 ending 7:20 PST
The afternoon 5 min bars start 10:10 ending 10:25 PST
You can find a MEJT SYSTEM book on ebay to learn how price projections are generated.
Simple summary: When an SPX projected price point is generated at the end of Morning and Afternoon three 5 MIN! price bars. Using my trading system, if the market has moved in opposite direction of the projected price projection, not yet met. Then I can add confidence that any signal I receive to change direction back towards the projected price. I will have added confidence in.
This script with the 5 min bars and arrows shown in Yellow for AM and RED for PM are very helpful, especially once you have more knowledge of MEJT SYSTEM. I certainly appreciate the input
If trading the ES mini, you simply need to determine the current differential in price between ES and SPX. Use the projected price to determine what your ES target number is.
NOTE VERY IMPORTANT!!!
The original converted script shown is incorrect on the times for the AM and PM bars.
To give credit for MEJT SYSTEM you can follow Jeffrey Tennant here for a better general knowledge.
https://www.youtube.com/@jeffreytennant

ZD2FCVf.png

Here is the corrected version
Ruby:
# TOS script to mark the MEJT bars
def begin = 1005;
def beginNoon = 1310;
def arrowsize = 5;
def firstbar = secondsFromTime(begin)==0;
def firstbarN = secondsFromTime(beginNoon)==0;



def count = if gettime() crosses above regularTradingstart(getyyyYMMDD())
then 1
else if !firstbar
then count[1] + 1
else
count[1];

DefineGlobalColor("Time", Color.CYAN);
DefineGlobalColor("TimeR", color.YELLOW);
plot changeBar = firstBar;
changeBar.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
changeBar.setlineWeight(arrowsize);
changeBar.setdefaultColor(globalColor("Time"));

plot changeBarN = firstbarN;
changeBarN.setpaintingStrategy(paintingStrategy.BOOLEAN_ARROW_DOWN);
changeBarN.setlineWeight(arrowsize);
changeBarN.setdefaultColor(globalColor("TimeR"));

assignpriceColor(if secondsFromTime(1005) == 0 then GlobalColor("Time") else Color.Current);
assignpriceColor(if secondsFromTime(1010) == 0 then GlobalColor("Time") else Color.Current);
assignpriceColor(if secondsFromTime(1015) == 0 then GlobalColor("Time") else Color.Current);

assignpriceColor(if secondsFromTime(1310) == 0 then GlobalColor("TimeR") else Color.Current);
assignpriceColor(if secondsFromTime(1315) == 0 then GlobalColor("TimeR") else Color.Current);
assignpriceColor(if secondsFromTime(1320) == 0 then GlobalColor("TimeR") else Color.Current);
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
355 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top